Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/kern Pull up following revision(s) (requested by chri...



details:   https://anonhg.NetBSD.org/src/rev/d2dfbaaa3661
branches:  netbsd-9
changeset: 938113:d2dfbaaa3661
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Sep 02 12:42:32 2020 +0000

description:
Pull up following revision(s) (requested by christos in ticket #1072):

        sys/kern/kern_syscall.c: revision 1.21

PR/55629: Andreas Gustafsson: Don't crash when an emulation does not provide
e_dtrace_syscall (like compat_netbsd32)

diffstat:

 sys/kern/kern_syscall.c |  21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diffs (59 lines):

diff -r c94368568380 -r d2dfbaaa3661 sys/kern/kern_syscall.c
--- a/sys/kern/kern_syscall.c   Wed Sep 02 12:40:06 2020 +0000
+++ b/sys/kern/kern_syscall.c   Wed Sep 02 12:42:32 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_syscall.c,v 1.18 2019/05/06 08:05:03 kamil Exp $  */
+/*     $NetBSD: kern_syscall.c,v 1.18.2.1 2020/09/02 12:42:32 martin Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_syscall.c,v 1.18 2019/05/06 08:05:03 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_syscall.c,v 1.18.2.1 2020/09/02 12:42:32 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_modular.h"
@@ -238,11 +238,16 @@
 trace_enter(register_t code, const struct sysent *sy, const void *args)
 {
        int error = 0;
+#if defined(PTRACE) || defined(KDTRACE_HOOKS)
+       struct proc *p = curlwp->l_proc;
+#endif
 
 #ifdef KDTRACE_HOOKS
        if (sy->sy_entry) {
-               struct emul *e = curlwp->l_proc->p_emul;
-               (*e->e_dtrace_syscall)(sy->sy_entry, code, sy, args, NULL, 0);
+               struct emul *e = p->p_emul;
+               if (e->e_dtrace_syscall)
+                       (*e->e_dtrace_syscall)(sy->sy_entry, code, sy, args,
+                           NULL, 0);
        }
 #endif
 
@@ -253,7 +258,7 @@
        ktrsyscall(code, args, sy->sy_narg);
 
 #ifdef PTRACE
-       if ((curlwp->l_proc->p_slflag & (PSL_SYSCALL|PSL_TRACED)) ==
+       if ((p->p_slflag & (PSL_SYSCALL|PSL_TRACED)) ==
            (PSL_SYSCALL|PSL_TRACED)) {
                proc_stoptrace(TRAP_SCE, code, args, NULL, 0);
                if (curlwp->l_proc->p_slflag & PSL_SYSCALLEMU) {
@@ -282,8 +287,10 @@
 
 #ifdef KDTRACE_HOOKS
        if (sy->sy_return) {
-               (*p->p_emul->e_dtrace_syscall)(sy->sy_return, code, sy, args,
-                   rval, error);
+               struct emul *e = p->p_emul;
+               if (e->e_dtrace_syscall)
+                       (*p->p_emul->e_dtrace_syscall)(sy->sy_return, code, sy,
+                           args, rval, error);
        }
 #endif
 



Home | Main Index | Thread Index | Old Index