Module Name: src
Committed By: rin
Date: Wed Sep 15 11:03:25 UTC 2021
Modified Files:
src/sys/arch/sh3/sh3: exception.c
Log Message:
For kernel mode address error, do not overwrite tf->tf_spc and tf->tf_r0
*before* checking pcb->pbc_onfault != NULL.
Should fix part of
PR port-sh3/56382
PR port-sh3/56401
i.e., DDB will no longer wrongly indicate NULL as fault PC for kernel mode
address error (and 0xe == EFAULT as r0).
Yes, we have another bugs that cause panics described in the two PRs, but
now we can examine them more easily :).
To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/sh3/sh3/exception.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/sh3/sh3/exception.c
diff -u src/sys/arch/sh3/sh3/exception.c:1.73 src/sys/arch/sh3/sh3/exception.c:1.74
--- src/sys/arch/sh3/sh3/exception.c:1.73 Tue Dec 3 12:42:21 2019
+++ src/sys/arch/sh3/sh3/exception.c Wed Sep 15 11:03:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: exception.c,v 1.73 2019/12/03 12:42:21 ad Exp $ */
+/* $NetBSD: exception.c,v 1.74 2021/09/15 11:03:24 rin Exp $ */
/*-
* Copyright (c) 2002, 2019 The NetBSD Foundation, Inc. All rights reserved.
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.73 2019/12/03 12:42:21 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.74 2021/09/15 11:03:24 rin Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -196,11 +196,10 @@ general_exception(struct lwp *l, struct
case EXPEVT_ADDR_ERR_LD: /* FALLTHROUGH */
case EXPEVT_ADDR_ERR_ST:
pcb = lwp_getpcb(l);
- KDASSERT(pcb->pcb_onfault != NULL);
+ if (__predict_false(pcb->pcb_onfault == NULL))
+ goto do_panic;
tf->tf_spc = (int)pcb->pcb_onfault;
tf->tf_r0 = EFAULT;
- if (tf->tf_spc == 0)
- goto do_panic;
break;
case EXPEVT_ADDR_ERR_LD | EXP_USER: /* FALLTHROUGH */