Bug 289739 - linuxemu path translation fails for ELF interpreter being a absolute symlink
Summary: linuxemu path translation fails for ELF interpreter being a absolute symlink
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 14.3-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Pouria Mousavizadeh Tehrani
URL:
Keywords:
Depends on:
Blocks: 247219
  Show dependency tree / graph
 
Reported: 2025-09-21 15:02 UTC by Benjamin Takacs
Modified: 2026-08-12 13:09 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Takacs 2025-09-21 15:02:21 UTC
When creating a linux userland via debootstrap the default ELF interpreter is an absolute symlink to the real ELF interpreter. And when pointing compat.linux.emul_path to that userland and trying to run any ELF executable from it, it results in:

ELF interpreter /lib64/ld-linux-x86-64.so.2 not found, error 2

After changing that absolute symlink to a relative one, the executable works fine.

This suggests path translation didn't get triggered again for the absolute symlink and only the root file system gets searched for it, but not under compat.linux.emul_path.

Fixing this would allow userlands created via debootstrap to be used directly on the host without chroot, for usecases where you don't want that seperation.
Comment 1 Ricardo Branco 2026-04-26 15:45:42 UTC
Seems like this change is the culprit:
https://reviews.freebsd.org/D40479
Comment 2 Ricardo Branco 2026-04-26 16:52:00 UTC
This fixes it for me:
https://github.com/freebsd/freebsd-src/pull/2166
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-05-01 20:28:24 UTC
A commit in branch main references this bug:

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

commit 459ac3044b516af698d7342431bdbcf784fdf7a4
Author:     Ricardo Branco <rbranco@suse.de>
AuthorDate: 2026-04-26 16:44:39 +0000
Commit:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-05-01 20:27:36 +0000

    namei: Preserve ABI root for absolute symlinks before fallback

    D40479 changed namei() so that an absolute symlink target
    encountered during an ABI-root lookup restarts from the native root.
    This helps the native fallback case, but it also makes successful
    lookups inside an ABI root escape that root while following absolute
    symlinks.

    Only switch absolute symlink lookup to the native root after namei()
    is already in the restarted/native fallback pass.
    Do not mark the lookup as restarted merely because an absolute
    symlink was encountered while still resolving inside the ABI root.

    This preserves the intended native fallback behavior while keeping
    absolute symlinks within a successfully resolved ABI-root path in
    the ABI namespace.

    Signed-off-by:  Ricardo Branco <rbranco@suse.de>
    PR:             289739
    Reviewed by:    kib
    Fixes:          cea7c564c70a ("namei: Reset the lookup to ...")
    Pull-Request:   https://github.com/freebsd/freebsd-src/pull/2166

 sys/kern/vfs_lookup.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)