Created attachment 180684 [details] v0 With DRI3 enabled Xserver may create a lot of temporary files under /var/tmp. Per hier(7) /var/tmp has to be persistent across reboots. However, Xserver fails to clean up temporary files on its own. On the other hand /tmp can use tmpfs(5) for faster access, mimicking /dev/shm on Linux. $ ls -l /var/tmp/shm* -rw------- 1 root wheel 4B Mar 10 13:18 /var/tmp/shmfd-BguYGR -rw------- 1 root wheel 4B Mar 10 13:18 /var/tmp/shmfd-GB5BR6 -rw------- 1 root wheel 4B Mar 10 13:18 /var/tmp/shmfd-Gn3rZg -rw------- 1 root wheel 4B Mar 10 13:18 /var/tmp/shmfd-HGV0zt -rw------- 1 root wheel 4B Mar 10 13:18 /var/tmp/shmfd-KRLyPk -rw------- 1 root wheel 4B Mar 10 13:18 /var/tmp/shmfd-YvGU8y -rw------- 1 root wheel 4B Mar 10 13:18 /var/tmp/shmfd-nLoJJ6 -rw------- 1 root wheel 4B Mar 10 13:18 /var/tmp/shmfd-sUaud9 -rw------- 1 root wheel 4B Mar 10 13:18 /var/tmp/shmfd-vTOEKK -rw------- 1 root wheel 4B Mar 10 13:18 /var/tmp/shmfd-yvrKri $ fstat /var/tmp/shm* USER CMD PID FD MOUNT INUM MODE SZ|DV R/W NAME root Xorg 36979 512 /var/tmp 1087 -rw------- 4 rw /var/tmp/shmfd-HGV0zt root Xorg 36979 513 /var/tmp 1088 -rw------- 4 rw /var/tmp/shmfd-yvrKri root Xorg 36979 514 /var/tmp 1091 -rw------- 4 rw /var/tmp/shmfd-GB5BR6 root Xorg 36979 515 /var/tmp 1090 -rw------- 4 rw /var/tmp/shmfd-Gn3rZg
Linuxulator already uses /tmp as /dev/shm per base r218497 and base r283461.
Good catch. I added --with-shared-memory-dir=/tmp to xorg-server during the 1.18.4 update for the same reason. I didn't notice libxshmfence had the same issue, but I'm not using using a kernel with DRI3 so it hasn't been making temp files.
A commit references this bug: Author: rezny Date: Sat Mar 11 21:24:30 UTC 2017 New revision: 435962 URL: https://svnweb.freebsd.org/changeset/ports/435962 Log: - Set the shared memory directory to /tmp to prevent polluting /var/tmp [1] - Strip the installed library PR: 217676 [1] Submitted by: jbeich [1] Approved by: swills (mentor) Differential Revision: https://reviews.freebsd.org/D9951 Changes: head/x11/libxshmfence/Makefile
A commit references this bug: Author: jbeich Date: Tue Jul 4 13:47:46 UTC 2017 New revision: 445016 URL: https://svnweb.freebsd.org/changeset/ports/445016 Log: x11/libxshmfence: don't leak /tmp/shmfd* files with O_CLOEXEC - Both mkostemp() and mkstemp() need explicit call to unlink() - Unobfuscate fallback if both O_TMPFILE and mksotemp() are N/A - O_TMPFILE (Linux-only) appeared after O_CLOEXEC, no need to check PR: 217676 (for tracking) MFH: 2017Q3 2017Q2 Changes: head/x11/libxshmfence/Makefile head/x11/libxshmfence/files/patch-src__xshmfence_alloc.c
A commit references this bug: Author: jbeich Date: Thu Jul 6 03:01:05 UTC 2017 New revision: 445124 URL: https://svnweb.freebsd.org/changeset/ports/445124 Log: MFH: r445016 x11/libxshmfence: don't leak /tmp/shmfd* files with O_CLOEXEC - Both mkostemp() and mkstemp() need explicit call to unlink() - Unobfuscate fallback if both O_TMPFILE and mksotemp() are N/A - O_TMPFILE (Linux-only) appeared after O_CLOEXEC, no need to check PR: 217676 (for tracking) Approved by: ports-secteam (junovitch) Changes: _U branches/2017Q3/ branches/2017Q3/x11/libxshmfence/Makefile branches/2017Q3/x11/libxshmfence/files/patch-src__xshmfence_alloc.c
A commit references this bug: Author: jbeich Date: Thu Jul 6 03:02:59 UTC 2017 New revision: 445125 URL: https://svnweb.freebsd.org/changeset/ports/445125 Log: MFH: r445016 x11/libxshmfence: don't leak /tmp/shmfd* files with O_CLOEXEC - Both mkostemp() and mkstemp() need explicit call to unlink() - Unobfuscate fallback if both O_TMPFILE and mksotemp() are N/A - O_TMPFILE (Linux-only) appeared after O_CLOEXEC, no need to check PR: 217676 (for tracking) Approved by: ports-secteam (junovitch) Changes: _U branches/2017Q2/ branches/2017Q2/x11/libxshmfence/Makefile branches/2017Q2/x11/libxshmfence/files/patch-src__xshmfence_alloc.c