A host signal that ends elfuse leaves its temp-dir files instead of removing them
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 62/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- c
- Lĩnh vực
- operating-systems
Hướng nghiên cứu
The cleanup is unlink_own_transport in src/syscall/proc.c, registered by proc_preempt_init through atexit; read it first and note the paths it builds. Add sigaction handlers for SIGTERM/SIGINT/SIGHUP that unlink those same precomputed paths, then re-raise under SIG_DFL. Reproduce with the fork-then-hang probe under gtimeout -s TERM 2, diffing ls $TMPDIR | grep '^elfuse-' before and after; tests/test-rosetta-audit.sh (tls0-known-hang, timeout 5) triggers it too. Done when a signalled run leaves no elfuse-* files and the exit status is unchanged.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
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:
| build | stop | exit status | files left |
|---|---|---|---|
| upstream/main c57282f | gtimeout -s TERM 2 |
124 | elfuse-life-<ns>, elfuse-pidseq-<ns>, elfuse-procs-<ns>, elfuse-sig-<pid> |
| #538 head d823f7e | gtimeout -s TERM 2 |
124 | the same four, plus elfuse-sigchld-<pid> |
| #538 head d823f7e | gtimeout -s INT 2 |
124 | the same five |
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.
Reproduce
#include <sys/wait.h>
#include <unistd.h>
int main(void)
{
pid_t c = fork();
if (c == 0)
_exit(0);
waitpid(c, NULL, 0);
sleep(5);
return 0;
}
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.
Origin
Follow-up from #538 (https://github.com/sysprog21/elfuse/pull/538).
- Ngôn ngữ chính
- C
- Star
- 287
- Fork
- 33
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 18
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sysprog21/elfuse
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của sysprog21/elfuse
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
libreswan/libreswan#3185 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
[SDL3pp] update to 0.12.0Đang mởcategory:port-update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[InstCombine] 23.x folds 0.0 * (0.0 / x) to 0.0 when x may be zero (fixed on main by #202482)Đang mởllvm:instcombine
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
llvm/llvm-project#246503 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày