On Thu, Jun 09, 2022 at 09:23:50PM +0300, Nir Soffer wrote:
On Thu, Jun 9, 2022 at 6:24 PM Richard W.M. Jones
<rjones(a)redhat.com> wrote:
> $ emacs -nw run.in # comment out GODEBUG line
...
> $ make -C golang check
> ...
> PASS: run-tests.sh
So when skipping libnbd_020_aio_buffer_test.go we don't get the warning about
Go pointer in C memory?
No, I commented out the GODEBUG line.
Enabling the GODEBUG line (ie. the normal case) gives:
$ uname -m
riscv64
$ git restore run.in
$ make
...
/home/rjones/d/libnbd/run go build
write of Go pointer 0x3fbc028000 to non-Go memory 0x3fe899bb20
fatal error: Go pointer stored into non-Go memory
runtime stack:
runtime.dopanic_m
../../../libgo/go/runtime/panic.go:1211
runtime.fatalthrow
../../../libgo/go/runtime/panic.go:1071
runtime.throw
../../../libgo/go/runtime/panic.go:1042
runtime.cgoCheckWriteBarrier..func1
../../../libgo/go/runtime/cgocheck.go:55
runtime.systemstack..func1
../../../libgo/go/runtime/stubs.go:63
runtime_mstart
../../../libgo/runtime/proc.c:593
goroutine 1 [running, locked to thread]:
runtime.mcall
../../../libgo/runtime/proc.c:343
runtime.systemstack
../../../libgo/go/runtime/stubs.go:66
runtime.cgoCheckWriteBarrier
../../../libgo/go/runtime/cgocheck.go:53
runtime.wbBufFlush
../../../libgo/go/runtime/mwbbuf.go:196
runtime.gcWriteBarrier
../../../libgo/go/runtime/mgc_gccgo.go:168
runtime.main
../../../libgo/go/runtime/proc.go:209
make[2]: *** [Makefile:1089: all-local] Aborted (core dumped)
The stack trace is not very interesting:
Thread 2 (Thread 0x3fbbfff150 (LWP 269087)):
#0 0x0000003fe72f9a60 in syscall () from /lib64/lp64d/libc.so.6
#1 0x0000003fe7e72f88 in __go_syscall6 (flag=<optimized out>, a1=<optimized
out>, a2=<optimized out>, a3=<optimized out>, a4=<optimized out>,
a5=<optimized out>, a6=<optimized out>) at
../../../libgo/runtime/go-varargs.c:109
#2 0x0000003fe814b05c in runtime.futex (val3=<optimized out>, addr2=<optimized
out>, ts=<optimized out>, val=<optimized out>, op=<optimized out>,
addr=<optimized out>) at ../../../libgo/go/runtime/os_linux.go:17
#3 runtime.futexsleep (addr=0x3fe899a878 <runtime.sched+240>, val=<optimized
out>, ns=<optimized out>) at ../../../libgo/go/runtime/os_linux.go:59
#4 0x0000003fe815970c in runtime.notetsleep_internal (n=n@entry=0x3fe899a878
<runtime.sched+240>, ns=ns@entry=60000000000) at
../../../libgo/go/runtime/lock_futex.go:204
#5 0x0000003fe81598ce in runtime.notetsleep (n=n@entry=0x3fe899a878
<runtime.sched+240>, ns=60000000000) at ../../../libgo/go/runtime/lock_futex.go:227
#6 0x0000003fe8179e9c in runtime.sysmon () at ../../../libgo/go/runtime/proc.go:4210
#7 0x0000003fe817c1a6 in runtime.mstart1 () at ../../../libgo/go/runtime/proc.go:1074
#8 0x0000003fe7e7379e in runtime_mstart (arg=<optimized out>) at
../../../libgo/runtime/proc.c:611
#9 0x0000003fe723f606 in start_thread () from /lib64/lp64d/libpthread.so.0
#10 0x0000003fe72fc28e in __thread_start () from /lib64/lp64d/libc.so.6
Thread 1 (Thread 0x3fe7221630 (LWP 269040)):
#0 0x0000003fe7287084 in raise () from /lib64/lp64d/libc.so.6
#1 0x0000003fe8150cca in runtime.dieFromSignal (sig=sig@entry=6) at
../../../libgo/go/runtime/signal_unix.go:668
#2 0x0000003fe816ebdc in runtime.sigfwdgo (ctx=0x3fc059fc40, info=0x3fc059fbc0,
sig=<optimized out>) at ../../../libgo/go/runtime/signal_unix.go:883
#3 runtime.sigtrampgo (sig=<optimized out>, info=0x3fc059fbc0, ctx=0x3fc059fc40) at
../../../libgo/go/runtime/signal_unix.go:392
#4 <signal handler called>
#5 0x0000003fe7287084 in raise () from /lib64/lp64d/libc.so.6
#6 0x0000003fe8150cca in runtime.dieFromSignal (sig=sig@entry=6) at
../../../libgo/go/runtime/signal_unix.go:668
#7 0x0000003fe8150d42 in runtime.crash () at
../../../libgo/go/runtime/signal_unix.go:763
#8 0x0000003fe8155132 in runtime.fatalthrow () at
../../../libgo/go/runtime/panic.go:1072
#9 runtime.throw (s=...) at ../../../libgo/go/runtime/panic.go:1042
#10 0x0000003fe81551c4 in runtime.cgoCheckWriteBarrier..func1 () at
../../../libgo/go/runtime/cgocheck.go:55
#11 0x0000003fe814bf3e in runtime.systemstack..func1 (origg=0x3fbc000a80) at
../../../libgo/go/runtime/stubs.go:63
#12 0x0000003fe7e7376e in runtime_mstart (arg=<optimized out>) at
../../../libgo/runtime/proc.c:593
#13 0x0000000000035abe in main (argc=<optimized out>, argv=<optimized out>) at
../../../libgo/runtime/go-main.c:58
#14 0x0000003fe7277956 in __libc_start_main () from /lib64/lp64d/libc.so.6
#15 0x0000000000035afc in _start ()
My money is still on a buggy golang runtime.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
nbdkit - Flexible, fast NBD server with plugins
https://gitlab.com/nbdkit/nbdkit