Module Name: src
Committed By: pgoyette
Date: Mon Mar 9 21:49:26 UTC 2020
Modified Files:
src/sys/arch/amd64/amd64: trap.c
src/sys/compat/netbsd32: netbsd32_mod.c
Log Message:
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.126 -r1.127 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.19 -r1.20 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.126 src/sys/arch/amd64/amd64/trap.c:1.127
--- src/sys/arch/amd64/amd64/trap.c:1.126 Sun Mar 8 00:53:12 2020
+++ src/sys/arch/amd64/amd64/trap.c Mon Mar 9 21:49:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.126 2020/03/08 00:53:12 pgoyette Exp $ */
+/* $NetBSD: trap.c,v 1.127 2020/03/09 21:49:26 pgoyette 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.126 2020/03/08 00:53:12 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.127 2020/03/09 21:49:26 pgoyette Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -348,8 +348,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.19 src/sys/compat/netbsd32/netbsd32_mod.c:1.20
--- src/sys/compat/netbsd32/netbsd32_mod.c:1.19 Mon Mar 9 01:06:34 2020
+++ src/sys/compat/netbsd32/netbsd32_mod.c Mon Mar 9 21:49:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_mod.c,v 1.19 2020/03/09 01:06:34 pgoyette Exp $ */
+/* $NetBSD: netbsd32_mod.c,v 1.20 2020/03/09 21:49:26 pgoyette 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.19 2020/03/09 01:06:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.20 2020/03/09 21:49:26 pgoyette 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;