[Bug 248184] readlink("/proc/curproc/file") returns arbitrary correct name for programs with more than one link (name)

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 28 Oct 2021 17:51:50 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248184

--- Comment #8 from commit-hook@FreeBSD.org ---
A commit in branch main references this bug:

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

commit 0c10648fbb758bb76fd29330b7fe1bc519252325
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-10-23 00:24:08 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-10-28 17:49:31 +0000

    exec: provide right hardlink name in AT_EXECPATH

    For this, use vn_fullpath_hardlink() to resolve executable name for
    execve(2).

    This should provide the right hardlink name, used for execution, instead
    of random hardlink pointing to this binary.  Also this should make the
    AT_EXECNAME reliable for execve(2), since kernel only needs to resolve
    parent directory path, which should always succeed (except pathological
    cases like unlinking a directory).

    PR:     248184
    Reviewed by:    markj
    Tested by:      pho
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D32611

 sys/kern/kern_exec.c | 38 ++++++++++++++++++++++++++++----------
 1 file changed, 28 insertions(+), 10 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.