elfuse segfaults after a failed guest init under a host RLIMIT_AS
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- c, macos
調査の方向性
Read the guest initialization failure path at src/core/bootstrap.c:421 and the mmap error handling at src/core/guest.c:608. Reproduce with the 1 TiB host limit using the command described in the issue and ELFUSE_STARTUP_TRACE=1; the evidence shows the crash occurs after guest_init fails. Done means elfuse reports the setup failure and exits non-zero without a segmentation fault.
索引モデルが issue の本文から書いたものです。
説明
Background
Guest rlimits are seeded from elfuse's host limits at boot, so #448 added tests/test-rlimit-seed.sh, which starts elfuse under ulimit -v and reads the guest's /proc/self/limits. With the limit at 1.5 TiB the lane passed on macOS 27 but exited 139 on the CI runner, in its first case and with nothing on stderr, on both runs of ae9252b. #448 now uses 6 TiB, where the runner passes. Draft PR #457 then ran elfuse on the runner at three limits and found two separate crashes. This issue is the one at 1 TiB; the one at 1.5 TiB is #459.
Intention
When elfuse cannot set up guest memory, it should report that and exit non-zero, as it already starts to do here, instead of segfaulting on the way out.
Evidence
#457 job on the runner: macOS 26.4.1 (25E253), Mac16,10 (M4), 24 GiB, elfuse at #448's tip. Every run was started as bash -c 'ulimit -v <KiB>; exec elfuse ...' with ELFUSE_STARTUP_TRACE=1.
ulimit -v |
elfuse --version |
busybox true, --verbose busybox cat /proc/self/limits, test-proc-limits |
Last startup step reached |
|---|---|---|---|
| 1 TiB | exit 0 | exit 139, every run | none after primary_mmap |
| 1.5 TiB | exit 0 | exit 139, every run (#459) | build_linux_stack |
| 6 TiB | exit 0 | exit 0 | hv_vcpu_create, then the guest runs |
Where each run stops in elfuse's boot:
#459 at 1.5 TiB: segfault in here
│ 6 TiB: reaches here
▼ ▼
┌─────────┬────────────┬─────────┬─────────────┬─────────┬───────┐
│ primary │ guest_init │ ...boot │ build_linux │ hv_vcpu │ guest │
│ mmap │ (slab) │ steps │ _stack │ _create │ runs │
└─────────┴────────────┴─────────┴─────────────┴─────────┴───────┘
▲
#458 at 1 TiB: slab fails, error printed, segfault on the way out
--version boots no guest and never crashed, and the guest never ran an instruction in any crashing run, so the segfault is in the elfuse host process.
At 1 TiB all three slab sizes fail, 2^40, 2^38 and 2^36 bytes, and elfuse reports it, then dies:
startup primary_mmap 1.296 ms
guest: mmap: Cannot allocate memory
startup primary_mmap 0.275 ms
guest: mmap: Cannot allocate memory
startup primary_mmap 0.070 ms
guest: mmap: Cannot allocate memory
ERROR src/core/guest.c:608: guest: hv_vm_map failed at every attempted slab size (start=40-bit, floor=36-bit)
ERROR src/core/bootstrap.c:422: failed to initialize guest
Segmentation fault: 11
So the crash is on the path that runs after guest_init returns an error (src/core/bootstrap.c:421), which should have ended in a clean exit.
Not confirmed:
- Which instruction faults. The runner left no crash report under
~/Library/Logs/DiagnosticReportsfor these processes. - Whether the failure path crashes only under an AS limit. Any
guest_initfailure takes the same path, but no other way to make it fail was tried. - Why the runner needs so much more address space. On macOS 27 (M-series) the same build boots under 1 TiB by falling back to a smaller slab; on the runner even the 2^36 slab fails under 1 TiB.
Refs #448, #457
- 主要言語
- C
- スター
- 275
- フォーク
- 29
- 平均マージ
- 2日 8時間
- マージ済み PR(30日)
- 17
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sysprog21/elfuse のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 3 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 3 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 3 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 3 日以内に返信
sysprog21/elfuse の issue をすべて見る
似ている issue
-
v9.6.0: CMake incorrectly enforces presence of libevdev対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
IoTSDK
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Azure/azure-iot-sdk-c#2776 ·
メンテナーはふだん 2 日以内に返信
-
[Bug] Unhandled ValueError terminates watchdog thread when GISRC value contains multiple colonsオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
bug Component component: net
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
RT-Thread/rt-thread#11913 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
contiki-ng/contiki-ng#3289 ·
メンテナーはふだん 3 日以内に返信