Sibling vCPUs keep running through a MAP_SHARED overlay

Đang mở
#495 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
48/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, go, macos
Lĩnh vực
backend, operating-systems

Hướng nghiên cứu

Start in src/syscall/proc.c at vcpu_handle_canceled_exit (around lines 4593–4655) and trace its EL1 and signal-delivery returns against thread_fork_barrier_check. Review hvf_apply_file_overlay_quiesced and the normal worker exit path in src/runtime/forkipc.c to understand the impact. Reproduce with the Go 1.23 workload and GOMAXPROCS=4; done means siblings stay quiesced through the overlay and the reported crashes and hangs no longer reproduce.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

thread_quiesce_siblings does not hold every sibling. The quiesce kicks each sibling with hv_vcpus_exit, but vcpu_handle_canceled_exit can return VCPU_RESUME before it reaches thread_fork_barrier_check (src/syscall/proc.c:4655). Two branches do this: the EL1 early return (:4593) and the signal-delivery branch (:4641). The kick is one-shot, and the quiesce raises no attention bit, so that sibling keeps running guest code. When the caller is hvf_apply_file_overlay_quiesced, which calls hv_vm_unmap on the segment, the sibling takes a stage-2 translation fault:

unexpected exception EC=0x20 syndrome=0x82000007 VA=0x83950 PA=0x83950
unexpected exception EC=0x20 syndrome=0x82000086 VA=0x83950 PA=0xfeff010950

The second form has S1PTW set and faults on the page-table pool.

When the faulting vCPU is a worker, its run loop stops, the thread goes through the normal exit path (src/runtime/forkipc.c:1160), and the 128 exit code is dropped. The process keeps running one thread short. A Go guest then hangs with every remaining thread in futex_wait. Linux would kill the thread group with SIGSEGV instead.

Reproduce: Go 1.23 telemetry mmaps its counter file MAP_SHARED, so any Go tool does this. On upstream main 170b5df, with golang:1.23-alpine through scripts/elfuse-oci.py, each iteration runs go env GOROOT and then gofmt -l over net, runtime and crypto and gofmt -d over fmt, with GOMAXPROCS=4:

  • with GODEBUG=schedtrace=10: 20 crash reports and 2 hangs in 59 iterations
  • without schedtrace: 0 in 400
  • with schedtrace after go telemetry off: 0 in 60

It is not clear why schedtrace raises the rate.

Calling thread_fork_barrier_check() at the top of vcpu_handle_canceled_exit, before the EL1 early return, gave 0 crashes in 120 iterations, and the make check unit suites pass with it. Moving the check above only the signal branch was not enough (4 crashes in 8 iterations). A kick to a vCPU that is outside hv_vcpu_run is held for the next run (checked: CANCELED within 0.002 ms), so the gap is in how the CANCELED exit is handled, not a lost kick.

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của sysprog21/elfuse

Tất cả issue của sysprog21/elfuse

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.