hyperboria / bugs

Peer-to-peer IPv6 networking, secure and near-zero-conf.
154 stars 17 forks source link

cjdns v20.2: segfault on Alpine x86 #186

Open CasperVector opened 5 years ago

CasperVector commented 5 years ago

Steps to reproduce:

$ qemu-system-i386 -enable-kvm -m 1024M -cdrom alpine-standard-3.8.2-x86.iso
# yes '' | setup-interfaces && /etc/init.d/networking start
# echo 'https://mirrors.dotsrc.org/alpine/v3.8/main' > /etc/apk/repositories
# apk update && apk add build-base python nodejs linux-headers
$ wget https://github.com/cjdelisle/cjdns/archive/cjdns-v20.2.tar.gz
$ tar xf cjdns-*.tar.gz && cd cjdns-*/
$ sed -ri '/march=native/ s@^[ \t]+@&//@' node_build/make.js
$ ./do || ./build_linux/test_testcjdroute_c
$ NO_TEST=1 ./do && ./cjdroute --version
progval commented 5 years ago

I can reproduce it in a chroot with a Debian 9 kernel, using http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/x86/alpine-minirootfs-3.8.2-x86.tar.gz (2MB)

progval commented 5 years ago

But doing the same using Alpine x86_64 (http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/x86_64/alpine-minirootfs-3.8.2-x86_64.tar.gz) works.

Given that cjdns the backtrace is

#0  0xf7fc62d3 in do_relocs (dso=dso@entry=0xf7ffcc00 <app>, rel=0x565564d4, rel_size=7928, stride=2) at ldso/dynlink.c:417
#1  0xf7fc6c72 in reloc_all (p=p@entry=0xf7ffcc00 <app>) at ldso/dynlink.c:1211
#2  0xf7fc83ed in __dls3 (sp=0xffffd6f0) at ldso/dynlink.c:1659
#3  0xf7fc7bf1 in __dls2 (base=0xf7f70000 "\177ELF\001\001\001", sp=<optimized out>) at ldso/dynlink.c:1441
#4  0xf7fc5b49 in _dlstart () from /lib/ld-musl-i386.so.1

(ie. it crashes before cjdns even gets called)

I think this might be a bug in musl itself.

CasperVector commented 5 years ago

What about test_testcjdroute_c? Also try static linking (setting LDFLAGS=-static in the environment)?