Re: Go binary panics on amd64-current - SIG*unknown
On Jan 7, 9:03pm, al...@yandex.ru (Alexander Nasonov) wrote: -- Subject: Re: Go binary panics on amd64-current - SIG*unknown Thanks! Committed (3 x) christos
Re: Go binary panics on amd64-current - SIG*unknown
Christos Zoulas wrote: > Index: linux_sigaction.c > === > RCS file: /cvsroot/src/sys/compat/linux/common/linux_sigaction.c,v > retrieving revision 1.34 > diff -u -u -r1.34 linux_sigaction.c > --- linux_sigaction.c 17 Oct 2008 20:21:34 - 1.34 > +++ linux_sigaction.c 7 Jan 2018 00:10:43 - > @@ -84,6 +84,15 @@ > linux_old_to_native_sigaction(&nbsa, &nlsa); > } > sig = SCARG(uap, signum); > + /* > + * XXX: Linux has 33 realtime signals, the go binary wants to > + * reset all of them; nothing else uses the last RT signal, so for > + * now ignore it. > + */ > + if (sig == LINUX__NSIG) { > + uprintf("%s: setting signal %d ignored\n", __func__, sig); > + sig--; /* back to 63 which is ignored */ > + } > if (sig < 0 || sig >= LINUX__NSIG) > return (EINVAL); > if (sig > 0 && !linux_to_native_signo[sig]) { it works but you patched the wrong file, this change should go into linux_signal.c. -- Alex
Re: Go binary panics on amd64-current - SIG*unknown
Ah, I thought I mentioned it in my email. Yes, it’s Linux binary.Sent from Yandex.Mail for mobile: http://m.ya.ru/ymail
Re: Go binary panics on amd64-current - SIG*unknown
In article <20180106224309.w2vicky2i6rf6fvu@neva>, Alexander Nasonov wrote: >I downloaded IACA tool from intel.com but I couldn't run it: > >$ ktrace ./iaca-v3.0-lin64/iaca >fatal error: rt_sigaction read failure > >runtime stack: >runtime.throw(0x75de24, 0x19) >/nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/panic.go:596 +0x95 >runtime.getsig(0x40, 0x441c60) >/nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/os_linux.go:427 +0x92 >runtime.initsig(0xe59d00) > >/nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/signal_unix.go:79 >+0x98 >runtime.mstart1() >/nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/proc.go:1175 +0xa4 >runtime.mstart() >/nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/proc.go:1149 +0x64 > >goroutine 1 [runnable]: >runtime.main() >/nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/proc.go:106 >runtime.goexit() >/nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/asm_amd64.s:2197 +0x1 > >goroutine 17 [syscall, locked to thread]: >runtime.goexit() >/nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/asm_amd64.s:2197 +0x1 > > >$ kdump > > 5477 5477 iaca CALL rt_sigaction(SIG*unknown 64*,0,0x7f7fe580,8) > 5477 5477 iaca RET rt_sigaction -1 errno -22 Invalid argument > 5477 5477 iaca CALL rt_sigaction(SIG*unknown 64*,0,0x7f7fe8b8,8) > 5477 5477 iaca RET rt_sigaction -1 errno -22 Invalid argument > >$ uname -a >NetBSD neva 8.99.7 NetBSD 8.99.7 (GENERIC_KASLR) #0: Sat Nov 18 09:54:53 >GMT 2017 >alnsn@neva:/home/alnsn/netbsd-current/clean/src/sys/arch/amd64/compile/obj/GENERIC_KASLR > amd64 > >I don't know if it matters but I have PAX protections enabled: > >$ sysctl -a |grep -w pax | grep enabled >security.pax.mprotect.enabled = 1 >security.pax.segvguard.enabled = 1 >security.pax.aslr.enabled = 1 Index: linux_sigaction.c === RCS file: /cvsroot/src/sys/compat/linux/common/linux_sigaction.c,v retrieving revision 1.34 diff -u -u -r1.34 linux_sigaction.c --- linux_sigaction.c 17 Oct 2008 20:21:34 - 1.34 +++ linux_sigaction.c 7 Jan 2018 00:10:43 - @@ -84,6 +84,15 @@ linux_old_to_native_sigaction(&nbsa, &nlsa); } sig = SCARG(uap, signum); + /* +* XXX: Linux has 33 realtime signals, the go binary wants to +* reset all of them; nothing else uses the last RT signal, so for +* now ignore it. +*/ + if (sig == LINUX__NSIG) { + uprintf("%s: setting signal %d ignored\n", __func__, sig); + sig--; /* back to 63 which is ignored */ + } if (sig < 0 || sig >= LINUX__NSIG) return (EINVAL); if (sig > 0 && !linux_to_native_signo[sig]) {
Re: Go binary panics on amd64-current - SIG*unknown
I think the issue is caused by linux defining signals from 1 to LINUX__NSIG, while the linux compat code in netbsd recognises signals from 1 to LINUX__NSIG-1. That's why the binary is aborting when calling sigaction on signal 64, which is LINUX__NSIG on amd64. - S
Re: Go binary panics on amd64-current - SIG*unknown
On Sat, Jan 06, 2018 at 10:43:09PM +, Alexander Nasonov wrote: > runtime.getsig(0x40, 0x441c60) > /nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/os_linux.go:427 > +0x92 Is that a linux binary? that seems to come from: https://github.com/golang/go/blob/eaf603601bf79216772ba36a9b981f21b50ade96/src/runtime/os_linux.go#L427 (btw, there were some discrepancies between go and netbsd along these lines, which might be related: https://github.com/golang/go/commit/c6e7cb4a375966f7b034e6dbf439a58ea326104a )
Go binary panics on amd64-current - SIG*unknown
I downloaded IACA tool from intel.com but I couldn't run it: $ ktrace ./iaca-v3.0-lin64/iaca fatal error: rt_sigaction read failure runtime stack: runtime.throw(0x75de24, 0x19) /nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/panic.go:596 +0x95 runtime.getsig(0x40, 0x441c60) /nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/os_linux.go:427 +0x92 runtime.initsig(0xe59d00) /nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/signal_unix.go:79 +0x98 runtime.mstart1() /nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/proc.go:1175 +0xa4 runtime.mstart() /nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/proc.go:1149 +0x64 goroutine 1 [runnable]: runtime.main() /nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/proc.go:106 runtime.goexit() /nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/asm_amd64.s:2197 +0x1 goroutine 17 [syscall, locked to thread]: runtime.goexit() /nfs/iil/disks/kfw/tools/go/go-latest/src/runtime/asm_amd64.s:2197 +0x1 $ kdump 5477 5477 iaca CALL rt_sigaction(SIG*unknown 64*,0,0x7f7fe580,8) 5477 5477 iaca RET rt_sigaction -1 errno -22 Invalid argument 5477 5477 iaca CALL rt_sigaction(SIG*unknown 64*,0,0x7f7fe8b8,8) 5477 5477 iaca RET rt_sigaction -1 errno -22 Invalid argument $ uname -a NetBSD neva 8.99.7 NetBSD 8.99.7 (GENERIC_KASLR) #0: Sat Nov 18 09:54:53 GMT 2017 alnsn@neva:/home/alnsn/netbsd-current/clean/src/sys/arch/amd64/compile/obj/GENERIC_KASLR amd64 I don't know if it matters but I have PAX protections enabled: $ sysctl -a |grep -w pax | grep enabled security.pax.mprotect.enabled = 1 security.pax.segvguard.enabled = 1 security.pax.aslr.enabled = 1 -- Alex