You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A host signal that ends elfuse leaves its temp-dir files instead of removing them #548
unlink_own_transport in src/syscall/proc.c removes a process's temp-dir files when it exits: its signal transport elfuse-sig-<pid> and, for the namespace owner, the registry files elfuse-procs-<ns>, elfuse-life-<ns> and elfuse-pidseq-<ns>. #538 adds the SIGCHLD flag file elfuse-sigchld-<pid> to the same function. It runs only through atexit, and elfuse installs no host handler for SIGTERM, SIGINT or SIGHUP. When timeout, Ctrl-C or a closed terminal ends elfuse, the host process dies without running it, and the files stay in the temp dir until the OS purges it. A run that exits normally removes all of them.
Evidence
The probe below (fork one child, wait for it, sleep), stopped after 2 s:
The same probe left nothing when it ran to the end. The tls0-known-hang case of tests/test-rosetta-audit.sh stops elfuse with timeout 5 on purpose, so every make test-matrix run adds files. One developer machine's temp dir held 1636 elfuse-pidseq-*, 287 elfuse-life-*, 216 elfuse-procs-* and 19 elfuse-sigchld-* files.
Cause
proc_preempt_init registers unlink_own_transport with atexit, and nothing else removes these files. A process that a signal ends does not run atexit handlers. Checked by reading and by the runs above.
T=$(getconf DARWIN_USER_TEMP_DIR)
ls "$T"| grep '^elfuse-'| sort > before.txt
gtimeout -s TERM 2 build/elfuse ./fork-then-hang
ls "$T"| grep '^elfuse-'| sort > after.txt
comm -13 before.txt after.txt
Possible fix
Install host handlers for SIGTERM, SIGINT and SIGHUP that unlink this process's own files, from paths computed before the handler can run, and then re-raise the signal under SIG_DFL, so the parent still sees the same death. This does not cover SIGKILL or a crash.
Have a new namespace owner remove elfuse-* files whose owning host process is gone. This covers SIGKILL too, but costs a directory scan at every root start.
Activity