|
Message-ID: <7e5cec16-6b96-c585-98d4-86cacafbd84e@gmail.com> Date: Wed, 26 Jun 2019 00:18:05 +0100 From: Radostin Stoyanov <rstoyanov1@...il.com> To: musl@...ts.openwall.com Cc: dalias@...ifal.cx Subject: seccomp causes pthread_join() to hang Hello, In the test suite of CRIU [1] we have noticed an interesting bug which is caused by commit 8f11e6127fe93093f81a52b15bb1537edc3fc8af ("track all live threads in an AS-safe, fully-consistent linked list") [2]. When seccomp is used in a multithreaded application it may cause pthread_join() to hang. This is a minimal application to reproduce the issue: #include <errno.h> #include <seccomp.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <unistd.h> static void *fn() { scmp_filter_ctx ctx = seccomp_init(SCMP_ACT_KILL); if (!ctx) { perror("seccomp_init"); goto err; } if (seccomp_load(ctx) < 0) { perror("seccomp_load"); goto err; } /* This should cause SIG_KILL */ getpid(); err: return (void *)1; } int main() { pthread_t t1; if (pthread_create(&t1, NULL, fn, NULL)) { perror("pthread_create"); return -1; } if (pthread_join(t1, NULL)) { perror("pthread_join"); return -1; } return 0; } Expected behaviour: Thread t1 should receive SIG_KILL and the main thread should return 0. Actual behaviour: pthread_join() hangs. Reproducibility: Always Regression: Yes This bug can be reproduced with Alpine 3.10 ($ docker run -it alpine:3.10 sh). [1] https://criu.org/ [2] https://git.musl-libc.org/cgit/musl/commit/?id=8f11e6127fe93093f81a52b15bb1537edc3fc8af Kind regards, Radostin
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.