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
This commit is contained in:
Konstantin Belousov 2021-07-01 21:04:06 +03:00
parent edcf1054d3
commit 71ab344524
2 changed files with 3 additions and 0 deletions

View File

@ -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);

View File

@ -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);