diff options
author | dzwdz | 2022-04-28 19:45:36 +0200 |
---|---|---|
committer | dzwdz | 2022-04-28 19:45:36 +0200 |
commit | 866b7c764e3ed3031c96c23c856ede7955f2706e (patch) | |
tree | 389d020f3508ed39a5c6a4c301485d6539fbee7b /src | |
parent | f13392202cdeee846b544dec880a94a35a642246 (diff) |
init: run shells from a child process to expose bug in process_free()
Diffstat (limited to 'src')
-rw-r--r-- | src/init/main.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/init/main.c b/src/init/main.c index ef67958..488ec67 100644 --- a/src/init/main.c +++ b/src/init/main.c @@ -28,6 +28,23 @@ int main(void) { MOUNT("/bind/", fs_passthru(NULL)); + if (_syscall_fork()) { + /* (used to) expose a bug in the kernel + * the program will flow like this: + * 1. we launch the forked init + * 2. the forked init launches both shells + * 3. one of the shells quit + * 4. the forked init picks it up and quits + * + * then, in process_kill, the other shell will be deathbedded + * + * before i implement(ed) reparenting, it was a lingering running child + * of a dead process, which is invalid state + */ + _syscall_await(); + _syscall_exit(1); + } + if (!_syscall_fork()) { __stdin = __stdout = _syscall_open(argify("/com1")); if (__stdout < 0) _syscall_exit(1); |