Exit of the last `clone(CLONE_VM)` child ends the parent process
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- c, linux
調査の方向性
Start in src/runtime/forkipc.c at vm_clone_thread_run around line 1446 and read the proc_request_exit_group call and its comment. Compare the clone child’s exit handling with the Linux behavior described in the issue, including how the parent is woken and how waitpid receives the child status. Done means the parent remains alive to wait for the child and return its own exit code.
索引モデルが issue の本文から書いたものです。
説明
When the last clone(CLONE_VM) child (without CLONE_THREAD) of an elfuse process exits, vm_clone_thread_run (src/runtime/forkipc.c:1446, at 173b23b) calls proc_request_exit_group with the child's exit code. The parent ends with it, even when the parent is still running and has more work to do.
On Linux the child is a separate process. Its exit raises SIGCHLD in the parent, waitpid returns its status, and the parent keeps running.
Reproduce (static aarch64 binary):
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
static volatile int go;
static int child(void *a) { (void) a; while (!go) usleep(1000); return 0; }
int main(void) {
char *stk = malloc(1 << 16);
pid_t c = clone(child, stk + (1 << 16), CLONE_VM | SIGCHLD, NULL);
go = 1;
int st;
pid_t w = waitpid(c, &st, 0);
dprintf(2, "waited %d st=%x\n", w, st);
return 3;
}
- Linux 6.18.57 (qemu reference VM): prints
waited <pid> st=0, exits 3. - elfuse at 173b23b: prints nothing after the clone and exits 0, the child's code.
The comment at the call says the exit_group is there so that a main thread blocked in futex_wait or its run loop wakes up. To match Linux, that main thread would need another way to wake, and the parent would need to exit only through its own exit or exit_group.
test-proc-limits works around this in #448 by running its VM-clone check in a fork child.
Checked, not affected: posix_spawn, which glibc implements with clone(CLONE_VM | CLONE_VFORK). A static glibc guest that spawns busybox true, waits for it and returns 3 prints spawn rc=0 waited <pid> st=0 and exits 3, under elfuse at 173b23b and on Linux 6.18.57 alike.
- 主要言語
- 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日 初心者へのやさしさ 55/100
メンテナーはふだん 3 日以内に返信
sysprog21/elfuse の issue をすべて見る
似ている issue
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
linux-test-project/ltp#1343 · コメント 1 件 ·
-
test_audio_host: out-of-bounds read in test_audio_host_uses_exponential_full_speed_iso_intervalオープンfollowup Prio 📌
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
docs
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
micropython/micropython#19798 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100