git: 62ba4cd34067 - main - Call sv_onexec hook after the process VA is created.

Dmitry Chagin dchagin at FreeBSD.org
Tue Jul 20 07:10:25 UTC 2021


The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=62ba4cd340670e901fbaab98766bd5490b4334bd

commit 62ba4cd340670e901fbaab98766bd5490b4334bd
Author:     Dmitry Chagin <dchagin at FreeBSD.org>
AuthorDate: 2021-07-20 06:55:14 +0000
Commit:     Dmitry Chagin <dchagin at FreeBSD.org>
CommitDate: 2021-07-20 06:55:14 +0000

    Call sv_onexec hook after the process VA is created.
    
    For future use in the Linux emulation layer call sv_onexec hook right after
    the new process address space is created. It's safe, as sv_onexec used only
    by Linux abi and linux_on_exec() does not depend on a state of process VA.
    
    Reviewed by:            kib
    Differential revision:  https://reviews.freebsd.org/D30899
    MFC after:              2 weeks
---
 sys/kern/kern_exec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index edb4ad1af3c1..eff48b2c86f3 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1072,8 +1072,6 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv)
 	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);
 
 	EVENTHANDLER_DIRECT_INVOKE(process_exec, p, imgp);
 
@@ -1165,6 +1163,8 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv)
 	vmspace->vm_ssize = sgrowsiz >> PAGE_SHIFT;
 	vmspace->vm_maxsaddr = (char *)stack_addr;
 
+	if (sv->sv_onexec != NULL)
+		sv->sv_onexec(p, imgp);
 	return (0);
 }
 


More information about the dev-commits-src-main mailing list