`getppid` names an exited adopter instead of the current one after two quick reparents
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá 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
Start with proc_notify_reparent, lifecycle_reparent_complete, and the child drain in src/syscall/proc.c; compare that flow with proc_lifecycle_sync_self. The issue describes a race where a delayed reparent record can overwrite the child's cached parent after a newer reparent. Reproduce the quick-reparent scenario and verify that getppid reports the current adopter after the drain processes the notification.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What happens
When a process exits, proc_process_exit in src/syscall/proc.c reparents its live children in the lifecycle registry and then calls proc_notify_reparent for each one. That function appends an R <ns> <pid> <ppid> record to the child's signal transport and resends it, up to 20 times over 50 ms, until lifecycle_reparent_complete(pid, ppid) sees the registry ack. The child's drain applies the newest R record it reads (proc_set_ppid), then calls lifecycle_ack_reparent, which acks only when the registry's ppid still equals the record's.
Three processes A, B and C, with C a child of A:
- A exits and reparents C to B in the registry, then loops in
proc_notify_reparent(C, B). - Before C acks B, B exits and reparents C to D. C drains
R ... Dand acks D. - A's loop still sees
lifecycle_reparent_complete(C, B)as false, because the registry now says D, so A appendsR ... Bagain. - C's next drain applies
proc_set_ppid(B).lifecycle_ack_reparent(C, B)is a no-op because the registry says D, and nothing corrects C's cached ppid.
getppid in C then returns B, which has exited. On Linux it returns D.
Evidence
Found by reading proc_notify_reparent, lifecycle_reparent_complete and the drain in src/syscall/proc.c at abd83d1 (#538); not run. Raised in review: https://github.com/sysprog21/elfuse/pull/538#discussion_r4608448061
Cause
The drain trusts the ppid that the R record carries. A record can still arrive after a newer reparent has been acked, and the record carries no generation number. Checked by reading, not by a run.
Reproduce
Not reproduced. A probe would need a parent and its replacement adopter to exit within the 50 ms retry window of proc_notify_reparent, with the grandchild polling getppid.
Possible fix
Treat an R record as a doorbell only. The drain reads the ppid from the process's own registry entry, as proc_lifecycle_sync_self does, and acks that value. #538 already runs the drain's registry work after releasing the transport flock, so the drain can take the registry lock there.
Origin
Follow-up from #538 (https://github.com/sysprog21/elfuse/pull/538#discussion_r4608448061). The race predates #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