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
This commit is contained in:
parent
5ff17943ef
commit
4e8cb9d821
|
@ -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:
|
||||
|
|
|
@ -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, struct trapframe *frame)
|
|||
/* 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;
|
||||
|
|
Loading…
Reference in New Issue