diff options
author | Tom Smeding <tom@tomsmeding.com> | 2022-09-08 14:25:27 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2022-09-08 14:25:27 +0200 |
commit | 813aae5bddcb2f8e34371cd5be44f8dcbfdf8a04 (patch) | |
tree | 2bd99d6dd9671b5628f2da729252f968c8629030 /bugs/efault.md | |
parent | f4288dd09a9be0dad2cf955695d66d1b37c107d2 (diff) |
Add efault diagnosis, thanks int-e
Diffstat (limited to 'bugs/efault.md')
-rw-r--r-- | bugs/efault.md | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/bugs/efault.md b/bugs/efault.md index c66a6e1..1d434e2 100644 --- a/bugs/efault.md +++ b/bugs/efault.md @@ -2,8 +2,11 @@ I have written a program; suppose it's called `worker`. (While the program is written in Haskell, I don't think that's particularly relevant to this post.) + (EDIT: Reproducer can be found [here](https://git.tomsmeding.com/snap-efault/tree/).) +(EDIT 2: Diagnosis by `int-e` on irc [here](https://paste.tomsmeding.com/D22SvR2T).) + When run, `worker` starts a bunch of copies of a script. Under normal circumstances this script sets up a container using Linux cgroups and Linux user namespaces, but none of that is relevant because the strange behaviour in question occurs just fine without all of that -- in fact, we'll let it start the following script, say `./sleep.sh`: @@ -54,5 +57,11 @@ Somehow, starting a script is different from starting a native process (and chan That's the job of the loader, as far as I know. So what gives? -I'll try to reduce my own program to a minimal reproducer, and if I find anything I'll post an update to this post. -In the meantime, spookiness. +### The cause + +<s>I'll try to reduce my own program to a minimal reproducer, and if I find anything I'll post an update to this post. +In the meantime, spookiness.</s> + +`snap-server` [modifies the environment](https://github.com/snapframework/snap-server/blob/8d89c10014d8d295bfbf5419bbb8551de32d7f85/src/Snap/Http/Server.hs#L161) to set the locale, and `setenv(3)` is not atomic. +In particular, it breaks `execve(2)` when they race, and this is what happens. +All possible solutions to this problem are hacks. |