Backport from upstream: https://github/golang/go/commit/2673f9ed Original header: From 2673f9ed23348c634f6331ee589d489e4d9c7a9b Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 12 Jul 2017 10:12:50 -0600 Subject: [PATCH] runtime: pass CLONE_SYSVSEM to clone SysV semaphore undo lists should be shared by threads, just like several other resources listed in cloneFlags. Currently we don't do this, but it probably doesn't affect anything because 1) probably nobody uses SysV semaphores from Go and 2) Go-created threads never exit until the process does. Beyond being the right thing to do, user-level QEMU requires this flag because it depends on glibc to create new threads and glibc uses this flag. Fixes #20763. --- src/runtime/os_linux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/os_linux.c b/src/runtime/os_linux.c index 0d8ffc9..573be7c 100644 --- a/src/runtime/os_linux.c +++ b/src/runtime/os_linux.c @@ -150,6 +150,7 @@ runtime·newosproc(M *mp, void *stk) | CLONE_FS /* share cwd, etc */ | CLONE_FILES /* share fd table */ | CLONE_SIGHAND /* share sig handler table */ + | CLONE_SYSVSEM /* share SysV semaphore undo lists (see issue #20763) */ | CLONE_THREAD /* revisit - okay for now */ ; -- 2.31.1