Vincent sent a build log for this off-line with a gdb backtrace. The
backtrace at the point of failure is below.
The SIGSETXID signal handler is calling abort. This abort is almost
certainly coming from this diff:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=13f7fe35ae2b0ea55dc4b9628763aafdc8bdc30c
The way setgid works is that it sets up __xidcmd and then sends a
signal to every thread telling it to run the syscall stored in
__xidcmd. Running this syscall is failing for some reason.
Previously the result of the syscall was not checked, and now it is,
so it may have always been failing.
I tried running the test program under strace -f on my eglibc 2.15
system. I do in fact see that the system call fails:
[pid 19733] setgid(0 <unfinished ...>
[pid 19733] <... setgid resumed> ) = -1 EPERM (Operation not permitted)
[pid 19732] setgid(0 <unfinished ...>
[pid 19732] <... setgid resumed> ) = -1 EPERM (Operation not permitted)
[pid 19731] setgid(0 <unfinished ...>
[pid 19731] <... setgid resumed> ) = -1 EPERM (Operation not permitted)
[pid 19730] setgid(0 <unfinished ...>
[pid 19730] <... setgid resumed> ) = -1 EPERM (Operation not permitted)
[pid 19729] setgid(0) = -1 EPERM (Operation not permitted)
[pid 19728] setgid(0 <unfinished ...>
[pid 19728] <... setgid resumed> ) = -1 EPERM (Operation not permitted)
And, you know what? That's exactly correct. The test is running
setgid(0). It's supposed to fail. The point of the test is not to
see whether setgid succeeds, it's to see whether it doesn't hang.
This is a bug introduced by the above patch to glibc. The effect of
the change is that any invalid call to setgid is going to abort the
program. That is not right. This change to glibc should be reverted.
You can almost certainly recreate the bug yourself by running a
multi-threaded program in C and calling setgid(0). I don't have an
easy way to do that since I'm not running the new glibc. Let me know
if you have trouble creating a C test case.
Ian
Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffeffff700 (LWP 15230)]
0x00007ffff731ebf7 in raise () from /lib64/libc.so.6
#0 0x00007ffff731ebf7 in raise () from /lib64/libc.so.6
#1 0x00007ffff732085a in abort () from /lib64/libc.so.6
#2 0x00007ffff76b4cb6 in sighandler_setxid () from /lib64/libpthread.so.0
#3 <signal handler called>
#4 runtime.futex () at /usr/lib/golang/src/pkg/runtime/sys_linux_amd64.s:268
#5 0x0000000000417587 in runtime.futexsleep (
addr=<error reading variable: Attempt to dereference a generic pointer.>,
val=<error reading variable: Attempt to dereference a generic pointer.>,
ns=<error reading variable: Attempt to dereference a generic pointer.>)
at /usr/lib/golang/src/pkg/runtime/os_linux.c:49
#6 0x0000000000410056 in runtime.notesleep (
n=<error reading variable: Attempt to dereference a generic pointer.>)
at /usr/lib/golang/src/pkg/runtime/lock_futex.c:134
#7 0x000000000041b6c1 in stopm ()
at /usr/lib/golang/src/pkg/runtime/proc.c:932
#8 0x000000000041bc91 in startlockedm (
gp=<error reading variable: Attempt to dereference a generic pointer.>)
at /usr/lib/golang/src/pkg/runtime/proc.c:1078
#9 0x000000000041c57b in schedule ()
at /usr/lib/golang/src/pkg/runtime/proc.c:1327
#10 0x000000000041b006 in runtime.mstart ()
at /usr/lib/golang/src/pkg/runtime/proc.c:606
#11 0x0000000000405673 in crosscall_amd64 ()
at /builddir/build/BUILD/go/src/pkg/runtime/cgo/gcc_amd64.S:35
#12 0x00007fffeffff9c0 in ?? ()
#13 0x00007fffeffff700 in ?? ()
#14 0x0000000000001000 in ?? ()
#15 0x00007ffff72e7c00 in ?? ()
#16 0x0000000000000000 in ?? ()
A debugging session is active.
Inferior 1 [process 15222] will be killed.
Quit anyway? (y or n) [answered Y; input not from terminal]
+ ./test.test
SIGABRT: abort
PC=0x7f1edd315bf7
goroutine 1 [chan receive]:
testing.RunTests(0x5ffca8, 0x9bbd20, 0x29, 0x29, 0x1)
/usr/lib/golang/src/pkg/testing/testing.go:472 +0x8d5
testing.Main(0x5ffca8, 0x9bbd20, 0x29, 0x29, 0x9b5790, ...)
/usr/lib/golang/src/pkg/testing/testing.go:403 +0x84
main.main()
_/builddir/build/BUILD/go/misc/cgo/test/_test/_testmain.go:129 +0x9c
goroutine 3 [syscall]:
os/signal.loop()
/usr/lib/golang/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
/usr/lib/golang/src/pkg/os/signal/signal_unix.go:27 +0x31
goroutine 4 [syscall]:
runtime.goexit()
/usr/lib/golang/src/pkg/runtime/proc.c:1394
goroutine 5 [syscall]:
_/builddir/build/BUILD/go/misc/cgo/test._Cfunc_usleep(0x7f1e00002710, 0x424239)
_/builddir/build/BUILD/go/misc/cgo/test/_test/_cgo_defun.c:778 +0x31
created by _/builddir/build/BUILD/go/misc/cgo/test.lockOSThreadCallback
/usr/lib/golang/misc/cgo/test/issue3775.go:35 +0x36
goroutine 6 [select]:
_/builddir/build/BUILD/go/misc/cgo/test.testSetgid(0xc21006d000)
/usr/lib/golang/misc/cgo/test/setgid_linux.go:27 +0x1ce
_/builddir/build/BUILD/go/misc/cgo/test.TestSetgid(0xc21006d000)
/usr/lib/golang/misc/cgo/test/cgo_linux_test.go:9 +0x27
testing.tRunner(0xc21006d000, 0x9bbd20)
/usr/lib/golang/src/pkg/testing/testing.go:391 +0x8b
created by testing.RunTests
/usr/lib/golang/src/pkg/testing/testing.go:471 +0x8b2
goroutine 7 [syscall]:
_/builddir/build/BUILD/go/misc/cgo/test._Cfunc_setgid(0x0, 0x0)
_/builddir/build/BUILD/go/misc/cgo/test/_test/_cgo_defun.c:643 +0x31
_/builddir/build/BUILD/go/misc/cgo/test.func·014()
/usr/lib/golang/misc/cgo/test/setgid_linux.go:24 +0x2e
created by _/builddir/build/BUILD/go/misc/cgo/test.testSetgid
/usr/lib/golang/misc/cgo/test/setgid_linux.go:26 +0x7f
rax 0x0
rbx 0x9ca180
rcx 0xffffffffffffffff
rdx 0x6
rdi 0x3b7f
rsi 0x3b84
rbp 0x0
rsp 0x7f1eda9da838
r8 0x0
r9 0x0
r10 0x8
r11 0x202
r12 0x7f1edd2dec00
r13 0x0
r14 0x7f1eda9db700
r15 0x7f1eda9db9c0
rip 0x7f1edd315bf7
rflags 0x202
cs 0x33
fs 0x0
gs 0x0