util: open mesa_cache_* with CLOEXEC
Fix the leak of the mesa_cache database FDs into the child processes.
--
The e
flag requires glibc 2.7, and not sure which musl(latest stable certainly has it) version, but it's used throughout both libc libraries.
It's also not clear how far should I go with it, since mesa uses a lot of fopen
stuff without e
, regular open usually is with CLOEXEC
.
This was brought here https://github.com/alacritty/alacritty/issues/8249 (though, not sure they have the exact same issue, as I've seen myself),
but basically if you run any terminal that does stuff with mesa and runs child process after setting up some of it basic render stuff, you'll
see a lot of mesa_cache_
stuff open in the child process.
You can check that with ls -la /proc/self/fd
from such terminal (alacritty/kitty/whatever). Maybe even any other program launched from your wayland compositor will work, since it could also leak that way (niri certainly did so).
To test in your setup you'd have to restart everything (since stuff just sticks), but after that once I run ls -la /proc/self/fd
from alacritty/kitty I don't have mesa descriptors and see just 3 /dev/pty
stuff, as I should.