Convert the sendsig_sigcontext_16 function pointer to use the new
compat_hook mechanism. XXX Despite being a kernel<-->module abi change, this should be XXX pulled up to -9
This commit is contained in:
parent
d5b364b035
commit
7b0f5c9e07
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_sig_16.c,v 1.3 2019/01/27 02:08:39 pgoyette Exp $ */
|
||||
/* $NetBSD: kern_sig_16.c,v 1.4 2019/11/10 13:28:06 pgoyette Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -66,7 +66,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sig_16.c,v 1.3 2019/01/27 02:08:39 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sig_16.c,v 1.4 2019/11/10 13:28:06 pgoyette Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -84,6 +84,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_sig_16.c,v 1.3 2019/01/27 02:08:39 pgoyette Exp
|
|||
#include <sys/kauth.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/compat_stub.h>
|
||||
|
||||
#include <uvm/uvm_object.h>
|
||||
#include <uvm/uvm_prot.h>
|
||||
|
@ -155,8 +156,8 @@ kern_sig_16_init(void)
|
|||
emul_netbsd.e_esigcode = esigcode;
|
||||
emul_netbsd.e_sigobject = &emul_netbsd_object;
|
||||
rw_exit(&exec_lock);
|
||||
KASSERT(sendsig_sigcontext_vec == NULL);
|
||||
sendsig_sigcontext_vec = sendsig_sigcontext;
|
||||
MODULE_HOOK_SET(sendsig_sigcontext_16_hook, "sndsig16",
|
||||
sendsig_sigcontext);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
@ -188,7 +189,6 @@ kern_sig_16_fini(void)
|
|||
syscall_establish(NULL, kern_sig_16_syscalls);
|
||||
return EBUSY;
|
||||
}
|
||||
sendsig_sigcontext_vec = NULL;
|
||||
|
||||
#if defined(COMPAT_SIGCONTEXT)
|
||||
/*
|
||||
|
@ -204,6 +204,8 @@ kern_sig_16_fini(void)
|
|||
emul_netbsd.e_esigcode = NULL;
|
||||
emul_netbsd.e_sigobject = NULL;
|
||||
rw_exit(&exec_lock);
|
||||
|
||||
MODULE_HOOK_UNSET(sendsig_sigcontext_16_hook);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: compat_stub.c,v 1.15 2019/07/20 18:23:05 christos Exp $ */
|
||||
/* $NetBSD: compat_stub.c,v 1.16 2019/11/10 13:28:06 pgoyette Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2018 The NetBSD Foundation, Inc.
|
||||
|
@ -274,3 +274,8 @@ struct ifmedia_80_post_hook_t ifmedia_80_post_hook;
|
|||
*/
|
||||
struct netbsd32_machine32_hook_t netbsd32_machine32_hook;
|
||||
struct netbsd32_reg_validate_hook_t netbsd32_reg_validate_hook;
|
||||
|
||||
/*
|
||||
* Hook for sendsig_sigcontext_16
|
||||
*/
|
||||
struct sendsig_sigcontext_16_hook_t sendsig_sigcontext_16_hook;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_sig.c,v 1.376 2019/10/21 17:07:00 mgorny Exp $ */
|
||||
/* $NetBSD: kern_sig.c,v 1.377 2019/11/10 13:28:06 pgoyette Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -70,7 +70,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.376 2019/10/21 17:07:00 mgorny Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.377 2019/11/10 13:28:06 pgoyette Exp $");
|
||||
|
||||
#include "opt_ptrace.h"
|
||||
#include "opt_dtrace.h"
|
||||
|
@ -100,6 +100,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.376 2019/10/21 17:07:00 mgorny Exp $"
|
|||
#include <sys/cpu.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sdt.h>
|
||||
#include <sys/compat_stub.h>
|
||||
|
||||
#ifdef PAX_SEGVGUARD
|
||||
#include <sys/pax.h>
|
||||
|
@ -131,7 +132,6 @@ static void sigswitch_unlock_and_switch_away(struct lwp *);
|
|||
static void sigacts_poolpage_free(struct pool *, void *);
|
||||
static void *sigacts_poolpage_alloc(struct pool *, int);
|
||||
|
||||
void (*sendsig_sigcontext_vec)(const struct ksiginfo *, const sigset_t *);
|
||||
int (*coredump_vec)(struct lwp *, const char *) =
|
||||
__FPTRCAST(int (*)(struct lwp *, const char *), enosys);
|
||||
|
||||
|
@ -2147,10 +2147,8 @@ sendsig(const struct ksiginfo *ksi, const sigset_t *mask)
|
|||
case 0:
|
||||
case 1:
|
||||
/* Compat for 1.6 and earlier. */
|
||||
if (sendsig_sigcontext_vec == NULL) {
|
||||
break;
|
||||
}
|
||||
(*sendsig_sigcontext_vec)(ksi, mask);
|
||||
MODULE_HOOK_CALL_VOID(sendsig_sigcontext_16_hook, (ksi, mask),
|
||||
break);
|
||||
return;
|
||||
case 2:
|
||||
case 3:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sys_sig.c,v 1.49 2019/11/09 23:34:13 pgoyette Exp $ */
|
||||
/* $NetBSD: sys_sig.c,v 1.50 2019/11/10 13:28:06 pgoyette Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
|
||||
|
@ -66,7 +66,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sys_sig.c,v 1.49 2019/11/09 23:34:13 pgoyette Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sys_sig.c,v 1.50 2019/11/10 13:28:06 pgoyette Exp $");
|
||||
|
||||
#include "opt_dtrace.h"
|
||||
|
||||
|
@ -81,6 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: sys_sig.c,v 1.49 2019/11/09 23:34:13 pgoyette Exp $"
|
|||
#include <sys/kmem.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sdt.h>
|
||||
#include <sys/compat_stub.h>
|
||||
|
||||
SDT_PROVIDER_DECLARE(proc);
|
||||
SDT_PROBE_DEFINE2(proc, kernel, , signal__clear,
|
||||
|
@ -413,11 +414,9 @@ sigaction1(struct lwp *l, int signum, const struct sigaction *nsa,
|
|||
v0v1valid = true;
|
||||
else if ((p->p_lflag & PL_SIGCOMPAT) == 0) {
|
||||
kernconfig_lock();
|
||||
if (sendsig_sigcontext_vec == NULL) {
|
||||
(void)module_autoload("compat_16",
|
||||
MODULE_CLASS_ANY);
|
||||
}
|
||||
if (sendsig_sigcontext_vec != NULL) {
|
||||
(void)module_autoload("compat_16",
|
||||
MODULE_CLASS_ANY);
|
||||
if (sendsig_sigcontext_16_hook.hooked) {
|
||||
/*
|
||||
* We need to remember if the
|
||||
* sigcontext method may be useable,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: compat_stub.h,v 1.19 2019/09/27 00:32:03 pgoyette Exp $ */
|
||||
/* $NetBSD: compat_stub.h,v 1.20 2019/11/10 13:28:06 pgoyette Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2018 The NetBSD Foundation, Inc.
|
||||
|
@ -35,6 +35,7 @@
|
|||
#include <sys/module_hook.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sigtypes.h>
|
||||
|
||||
/*
|
||||
* NOTE: If you make changes here, please remember to update the
|
||||
|
@ -357,4 +358,12 @@ struct reg;
|
|||
MODULE_HOOK(netbsd32_machine32_hook, const char *, (void));
|
||||
MODULE_HOOK(netbsd32_reg_validate_hook, int,
|
||||
(struct lwp *, const struct reg *));
|
||||
|
||||
/*
|
||||
* Hook for compat_16 sendsig_sigcontext
|
||||
*/
|
||||
struct ksiginfo;
|
||||
MODULE_HOOK(sendsig_sigcontext_16_hook, void,
|
||||
(const struct ksiginfo *, const sigset_t *));
|
||||
|
||||
#endif /* _SYS_COMPAT_STUB_H */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: signalvar.h,v 1.97 2019/10/12 19:57:09 kamil Exp $ */
|
||||
/* $NetBSD: signalvar.h,v 1.98 2019/11/10 13:28:06 pgoyette Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -204,8 +204,6 @@ extern struct pool ksiginfo_pool;
|
|||
/*
|
||||
* Modularity / compatibility.
|
||||
*/
|
||||
extern void (*sendsig_sigcontext_vec)(const struct ksiginfo *,
|
||||
const sigset_t *);
|
||||
extern int (*coredump_vec)(struct lwp *, const char *);
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue