If we need to create the link target of /dev/shm, make its mode 1777

To match the behavior of a tmpfs mount.  Otherwise non-root user (for
e.g. the tester user) will get errors using Glibc shm functions.
This commit is contained in:
Xi Ruoyao 2024-02-04 22:56:04 +08:00
parent 8cf42d4c72
commit 7436c28ae4
No known key found for this signature in database
GPG Key ID: ACAAD20E19E710E3
2 changed files with 3 additions and 3 deletions

View File

@ -100,7 +100,7 @@ mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
symbolic link to a directory, typically
<filename class="directory">/run/shm</filename>.
The /run tmpfs was mounted above so in this case only a
directory needs to be created.</para>
directory needs to be created with a correct mode.</para>
<para>In other host systems <filename>/dev/shm</filename> is a mount point
for a tmpfs. In that case the mount of /dev above will only create
@ -108,7 +108,7 @@ mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
we must explicitly mount a tmpfs:</para>
<screen><userinput>if [ -h $LFS/dev/shm ]; then
mkdir -pv $LFS$(realpath /dev/shm)
install -v -d -m 1777 $LFS$(realpath /dev/shm)
else
mount -vt tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
fi</userinput></screen>

View File

@ -130,7 +130,7 @@ mounttype proc proc proc
mounttype sys sysfs sysfs
mounttype run tmpfs run
if [ -h $LFS/dev/shm ]; then
mkdir -pv $LFS$(realpath /dev/shm)
install -v -d -m 1777 $LFS$(realpath /dev/shm)
else
mounttype dev/shm tmpfs tmpfs -o nosuid,nodev
fi