/compat/linux/dev and an odd program

Andriy Gapon avg at FreeBSD.org
Tue Dec 6 16:58:52 UTC 2016


I have an old binary-only Linux program that, for whatever reason, opens
/dev/null with O_CREAT flag (O_WRONLY | O_CREAT | O_TRUNC).  That works fine
when there is no /compat/linux/dev: the code in kern_alternate_path() sees that
the directory does not exist, strips /compat/linux prefix and, so, the real
/dev/null is found.  But typically, if linux_base is installed, there is
/compat/linux/dev directory, because of /compat/linux/dev/shm/.  The code will
see the directory and, thus, it will try to open /compat/linux/dev/null.  But
there is no such file, so it will try to create it.  And fail with EPERM for a
non-privileged user.

I wonder if anyone has thoughts or suggestions on this situation.
Either an administrative solution or a code change would be fine for me.
Thanks!

-- 
Andriy Gapon


More information about the freebsd-emulation mailing list