From 71ab344524a14f00f21c4c5638906d7b965d2b64 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Thu, 1 Jul 2021 21:04:06 +0300 Subject: Add sv_onexec_old() sysent hook for exec event Unlike sv_onexec(), it is called from the old (pre-exec) sysentvec structure. The old vmspace for the process is still intact during the call. Reviewed by: dchagin, markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30987 --- sys/kern/kern_exec.c | 2 ++ sys/sys/sysent.h | 1 + 2 files changed, 3 insertions(+) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index c3c23f44189e..763196a593e4 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1064,6 +1064,8 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) sigfastblock_clear(td); umtx_exec(p); + if (p->p_sysent->sv_onexec_old != NULL) + p->p_sysent->sv_onexec_old(td); itimers_exec(p); if (sv->sv_onexec != NULL) sv->sv_onexec(p, imgp); diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index e0e5e351ae20..869c140c06f5 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -150,6 +150,7 @@ struct sysentvec { u_long *sv_hwcap2; /* Value passed in AT_HWCAP2. */ const char *(*sv_machine_arch)(struct proc *); vm_offset_t sv_fxrng_gen_base; + void (*sv_onexec_old)(struct thread *td); void (*sv_onexec)(struct proc *, struct image_params *); void (*sv_onexit)(struct proc *); void (*sv_ontdexit)(struct thread *td); -- cgit v1.2.3