zlacker

[parent] [thread] 3 comments
1. 10000t+(OP)[view] [source] 2022-09-10 20:18:25
Embryonic processes. Basically:

1. Call a function that creates an empty child process in a suspended state.

2. Call functions that: map/write memory into the child process’s address space; add file descriptors to the child process; set the child process’s initial register values; and so on.

3. Call a function to unsuspend and run the child process.

replies(1): >>lgg+e6
2. lgg+e6[view] [source] 2022-09-10 21:19:35
>>10000t+(OP)
fork() is terrible, but embryonic processes also have a lot of performance issues and prevent a number of valuable security mitigations. In general a spawn() style mechanism seems like a better approach (despite the deficiencies of specific examples like posix_spawn()).
replies(1): >>matu3b+Lk
◧◩
3. matu3b+Lk[view] [source] [discussion] 2022-09-10 23:55:47
>>lgg+e6
What is better in an unfixable race condition (the time before the execve where stuff leaks)?
replies(1): >>lgg+jt
◧◩◪
4. lgg+jt[view] [source] [discussion] 2022-09-11 01:34:41
>>matu3b+Lk
I think it goes without saying that since I stated fork() is terrible that I am not advocating for spawning new processes via any of the variants of exec() since they all depend on fork(). I directly stated posix_spawn() was the right technique (despite its deficiencies and a somewhat terrible interface).

My point was that embryonic processes aren't really the right solution since they require exposing a whole bunch to powerful primitives like read/write of remote address spaces in order to spawn processes. That ends up being slow (because each one of those calls is necessarily a syscall and requires manipulating page tables to mess with the other process). It also means to prevent abuse you need to be very carefully control when to revoke those privileges.

The obvious solution is to take all the operations you would have done to the remote process, encode them in some form, and pass them off to a secure agent (in this case the kernel) that can do them in bulk. That solves both perf issues (1 syscall, and no repeated round tripping through multiple address spaces), and the security issue (you no longer need to expose primitives to manipulate the remote process to every process that is allowed to spawn a new one).

[go to top]