From 813aae5bddcb2f8e34371cd5be44f8dcbfdf8a04 Mon Sep 17 00:00:00 2001
From: Tom Smeding I have written a program; suppose it's called The impossible EFAULT
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.)
(EDIT: Reproducer can be found here.)
+(EDIT 2: Diagnosis by int-e
on irc here.)
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
:
#!/bin/bash
@@ -41,5 +42,9 @@ Somehow, starting a script is different from starting a native process (and chan
posix_spawnp
shouldn't care what it is starting!
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
+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.
+snap-server
modifies the environment 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.
--
cgit v1.2.3-70-g09d2