It seems that pathname "prefixing" is not performed for unix domain socket calls in linux emulation e.g. "/compat/linux" prefix is never tried to be prepended for bind() and connect() calls. When mixed with filesystem calls this leads to linux applications failing in scenarios like this: mkdir("/tmp/foo"); //this will create /compat/linux/tmp/foo/ directory s = socket(AF_LOCAL, SOCK_DGRAM, PF_LOCAL); strcpy(addr.sun_path, "/tmp/foo/bar"); addr.sun_family = AF_LOCAL; bind(s, (struct sockaddr *) &addr, SUN_LEN(&addr)); //this will try to bind socket in /tmp/foo/ directory //which does not exist I have experinced this problem on FreeBSD 5.2.1 with two real-life applications: oracle 9.2.0.4.0 IBM WebSphere MQ 5.3 Fix: fix should not be very hard to implement, but I'd prefer that someone more familiar with the code would do it (someone who wrote the similar code for filesystem calls). How-To-Repeat: Existence of this problem can be easily verified using a small program with the above code (make sure /tmp/foo directory is not existant).
Responsible Changed From-To: freebsd-bugs->emulation Reassign to appropriate mailing list.
State Changed From-To: open->feedback Does this problem still persists on a recent FreeBSD? If yes, I suggest to try to come up with a patch, since most of the problems are fixed by people which need a particular feature (we don't have a maintainer for the linuxolator).
State Changed From-To: feedback->open Feedback reveived, the bug still exist in -current. http://www.freebsd.org/cgi/query-pr.cgi?pr=72920
State Changed From-To: open->analyzed ISTM 'analyzed' is a better state for this.
State Changed From-To: analyzed->closed
State Changed From-To: closed->analyzed Revert accidental status change.
take
batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=fd745e1db6b561900b8e5e9caa4ed05cf15398b3 commit fd745e1db6b561900b8e5e9caa4ed05cf15398b3 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2023-05-29 08:16:46 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2023-05-29 08:16:46 +0000 linux(4): Use pwd_altroot() to tell namei() about ABI root path PR: 72920 Differential Revision: https://reviews.freebsd.org/D40090 MFC after: 2 month sys/amd64/linux/linux_sysvec.c | 6 +- sys/amd64/linux32/linux32_machdep.c | 12 +- sys/amd64/linux32/linux32_sysvec.c | 6 +- sys/arm64/linux/linux_sysvec.c | 4 +- sys/compat/linux/linux_emul.c | 47 +---- sys/compat/linux/linux_emul.h | 3 +- sys/compat/linux/linux_file.c | 407 ++++++------------------------------ sys/compat/linux/linux_mib.c | 4 - sys/compat/linux/linux_misc.c | 120 ++--------- sys/compat/linux/linux_stats.c | 111 ++-------- sys/compat/linux/linux_uid16.c | 43 +--- sys/compat/linux/linux_util.c | 41 ++-- sys/compat/linux/linux_util.h | 25 +-- sys/i386/linux/linux_machdep.c | 15 +- sys/i386/linux/linux_sysvec.c | 7 +- 15 files changed, 158 insertions(+), 693 deletions(-)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3d2fec7db856c67e1a94a87a846d8ffe6f48b61f commit 3d2fec7db856c67e1a94a87a846d8ffe6f48b61f Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2023-05-29 08:15:28 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2023-05-29 08:15:28 +0000 namei: Add the abilty for the ABI to specify an alternate root path For now a non-native ABI (i.e., Linux) uses the kern_alternate_path() facility to dynamically reroot lookups. First, an attempt is made to lookup the file in /compat/linux/original-path. If that fails, the lookup is done in /original-path. Thats requires a bit of code in every ABI syscall implementation where path name translation is needed. Also our kern_alternate_path() does not properly lookups absolute symlinks in second attempt, i.e., does not append /compat/linux part to the resolved link. The change is intended to avoid this by specifiyng the ABI root directory for namei(), using one call to pwd_altroot() during exec-time into the ABI. In that case namei() will dynamically reroot lookups as mentioned above. PR: 72920 Reviewed by: kib Differential revision: https://reviews.freebsd.org/D38933 MFC after: 2 month sys/kern/kern_descrip.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++-- sys/kern/vfs_cache.c | 4 ++-- sys/kern/vfs_lookup.c | 30 +++++++++++++++++++++--- sys/sys/filedesc.h | 4 ++++ sys/sys/namei.h | 11 +++++++-- 5 files changed, 101 insertions(+), 9 deletions(-)
^Triage: committed directly to -14, so the mfc-stable14 flag is OBE. The mfc-stable[11|12] flags' values are now OBE.
^Triage: FreeBSD 12 is now out of support.