Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Jun 2024 15:19:53 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 279570] linuxulator: linux_mkdir returns EACCES instead of EEXIST for mountpoints
Message-ID:  <bug-279570-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D279570

            Bug ID: 279570
           Summary: linuxulator: linux_mkdir returns EACCES instead of
                    EEXIST for mountpoints
           Product: Base System
           Version: 14.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: kempe@lysator.liu.se

The Linux version of Planescape Torment Enhanced Edition crashed when tryin=
g to
save games. I have traced the issue to linux_mkdir returning EACCES instead=
 of
the expected EEXIST when traversing the file system hierarchy.


/bin is a directory on the ZFS root dataset, running mkdir and linux_mkdir
gives the exected behaviour:

~> truss /bin/mkdir /bin &| grep mkdir
mkdir("/bin",0777)                               ERR#17 'File exists'
mkdir: write(2,"mkdir: ",7)                              =3D 7 (0x7)

~> truss /compat/linux/bin/mkdir /bin &| grep mkdir
linux_mkdir("/bin",511)                          ERR#-17 'File exists'
/compat/linux/bin/mkdir: linux_write(0x2,0x7fffffff96b0,0x19)            =
=3D 25
(0x19)

/usr/home is a ZFS dataset mounted on /usr, mounted on the root ZFS dataset=
. It
gives the unexpected behaviour:

~> truss /bin/mkdir /usr/home &| grep mkdir
mkdir("/usr/home",0777)                          ERR#17 'File exists'
mkdir: write(2,"mkdir: ",7)                              =3D 7 (0x7)

~> truss /compat/linux/bin/mkdir /usr/home &| grep mkdir
linux_mkdir("/usr/home",511)                     ERR#-13 'Permission denied'
/compat/linux/bin/mkdir: linux_write(0x2,0x7fffffff96b0,0x19)            =
=3D 25
(0x19)

As can be seen, FreeBSD mkdir returns file exists as expected, but Linux mk=
dir
returns permission denied. Setting compat.linux.emul_path=3D/ and getting m=
kdir
to work with environment variables makes it have the correct behaviour.

# sysctl compat.linux.emul_path=3D/
compat.linux.emul_path: /compat/linux -> /
~> env LD_LIBRARY_PATH=3D/compat/linux/usr/lib64 truss /compat/linux/bin/mk=
dir
/usr/home &| grep mkdir
linux_mkdir("/usr/home",511)                     ERR#-17 'File exists'
/compat/linux/bin/mkdir: linux_write(0x2,0x7fffffff9680,0x19)            =
=3D 25
(0x19)

Indicating that there seems to be an issue with how the file system objects=
 are
being resolved.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-279570-227>