diff options
Diffstat (limited to 'main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch')
-rw-r--r-- | main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch b/main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch new file mode 100644 index 0000000000..e7d39dd71e --- /dev/null +++ b/main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch @@ -0,0 +1,31 @@ +From 8f7bc690f07e90177b176b6e19736ad7c1d49840 Mon Sep 17 00:00:00 2001 +From: Rich Felker <dalias@aerifal.cx> +Date: Fri, 5 Dec 2014 21:19:39 -0500 +Subject: [PATCH] use direct syscall rather than write function in posix_spawn + child + +the write function is a cancellation point and accesses thread-local +state belonging to the calling thread in the parent process. since +cancellation is blocked for the duration of posix_spawn, this is +probably safe, but it's fragile and unnecessary. making the syscall +directly is just as easy and clearly safe. +--- + src/process/posix_spawn.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c +index af12731..0bdf71c 100644 +--- a/src/process/posix_spawn.c ++++ b/src/process/posix_spawn.c +@@ -136,7 +136,7 @@ static int child(void *args_vp) + fail: + /* Since sizeof errno < PIPE_BUF, the write is atomic. */ + ret = -ret; +- if (ret) while (write(p, &ret, sizeof ret) < 0); ++ if (ret) while (__syscall(SYS_write, p, &ret, sizeof ret) < 0); + _exit(127); + } + +-- +2.2.0 + |