Module Name: src
Committed By: martin
Date: Tue Mar 10 06:47:55 UTC 2020
Modified Files:
src/sys/arch/amd64/amd64 [netbsd-9]: trap.c
src/sys/compat/netbsd32 [netbsd-9]: netbsd32_mod.c
Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #778):
sys/compat/netbsd32/netbsd32_mod.c: revision 1.20
sys/arch/amd64/amd64/trap.c: revision 1.127
Rework previous, so that the real syscall code is not invoked from within
the module_hook code. Otherwise, if the syscall just happens to be exit()
we will exit while still holding a reference to the hook's localcount, and
nothing will ever release that reference. Attempts to manually unload the
module will hang indefinitely, as will modstat(8).
XXX pullup-9
To generate a diff of this commit:
cvs rdiff -u -r1.121.2.2 -r1.121.2.3 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.15.4.3 -r1.15.4.4 src/sys/compat/netbsd32/netbsd32_mod.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/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.121.2.2 src/sys/arch/amd64/amd64/trap.c:1.121.2.3
--- src/sys/arch/amd64/amd64/trap.c:1.121.2.2 Mon Mar 9 13:12:14 2020
+++ src/sys/arch/amd64/amd64/trap.c Tue Mar 10 06:47:55 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.121.2.2 2020/03/09 13:12:14 martin Exp $ */
+/* $NetBSD: trap.c,v 1.121.2.3 2020/03/10 06:47:55 martin Exp $ */
/*
* Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.121.2.2 2020/03/09 13:12:14 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.121.2.3 2020/03/10 06:47:55 martin Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -356,8 +356,11 @@ trap(struct trapframe *frame)
MODULE_HOOK_CALL(amd64_oosyscall_hook, (p, frame),
ENOSYS, hook_ret);
- if (hook_ret == 0)
+ if (hook_ret == 0) {
+ /* Do the syscall */
+ p->p_md.md_syscall(frame);
goto out;
+ }
}
/* FALLTHROUGH */
case T_TSSFLT|T_USER:
Index: src/sys/compat/netbsd32/netbsd32_mod.c
diff -u src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.3 src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.4
--- src/sys/compat/netbsd32/netbsd32_mod.c:1.15.4.3 Mon Mar 9 09:55:52 2020
+++ src/sys/compat/netbsd32/netbsd32_mod.c Tue Mar 10 06:47:55 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_mod.c,v 1.15.4.3 2020/03/09 09:55:52 martin Exp $ */
+/* $NetBSD: netbsd32_mod.c,v 1.15.4.4 2020/03/10 06:47:55 martin Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.15.4.3 2020/03/09 09:55:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.15.4.4 2020/03/10 06:47:55 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_execfmt.h"
@@ -151,9 +151,6 @@ amd64_oosyscall_handle(struct proc *p, s
/* Advance past the lcall and save instruction size. */
frame->tf_rip += sz;
frame->tf_err = sz;
-
- /* Do the syscall */
- p->p_md.md_syscall(frame);
return 0;
} else
return EPASSTHROUGH;