git: e4ce23b238a1 - main - fexecve(2): restore the attempts to calculate the executable path

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 03 Nov 2021 13:10:37 UTC
The branch main has been updated by kib:

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

commit e4ce23b238a162f5d36afe8ef49dcd66901138a1
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-11-03 12:58:03 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-11-03 13:10:22 +0000

    fexecve(2): restore the attempts to calculate the executable path
    
    vn_fullpath() call was not converted to pass newtextvp, instead it used
    imgp->vp which is still NULL there.  As result vn_fullpath() always
    returned EINVAL and execpath was recorded from the value of arg0.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/kern/kern_exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 780b917ad21d..c5b450b04240 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -537,7 +537,7 @@ interpret:
 		    &newtextvp);
 		if (error)
 			goto exec_fail;
-		if (vn_fullpath(imgp->vp, &imgp->execpath,
+		if (vn_fullpath(newtextvp, &imgp->execpath,
 		    &imgp->freepath) != 0)
 			imgp->execpath = args->fname;
 		vn_lock(newtextvp, LK_SHARED | LK_RETRY);