Opened 6 years ago

Closed 5 years ago

#10695 closed defect (worksforme)

tor on mipsel

Reported by: lamero Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

i'm trying to compile tor for mipsel and, all go for good but when start binary it give me segmentation fault. Other application work good...strange only tor goes in segmentation fault.

i use this setup:


for first openssl

#!/bin/bash
export TOOLCHAIN=/opt/cross/mipsel-unknown-linux-gnu
export CC=$TOOLCHAIN/bin/mipsel-unknown-linux-gnu-gcc
export RANLIB=$TOOLCHAIN/bin/mipsel-unknown-linux-gnu-ranlib
./Configure --prefix=$TOOLCHAIN/mipsel-unknown-linux-gnu/sys-root/usr/ linux-generic32 shared

libevent:
#!/bin/bash
export TOOLCHAIN=/opt/cross/mipsel-unknown-linux-gnu
export CC=$TOOLCHAIN/bin/mipsel-unknown-linux-gnu-gcc
export RANLIB=$TOOLCHAIN/bin/mipsel-unknown-linux-gnu-ranlib
./configure --prefix=$TOOLCHAIN/mipsel-unknown-linux-gnu/sys-root/usr/ --host=mipsel-unknown-linux-gnu


Then zlib

#!/bin/bash
export TOOLCHAIN=/opt/cross/mipsel-unknown-linux-gnu
export CC=$TOOLCHAIN/bin/mipsel-unknown-linux-gnu-gcc
export RANLIB=$TOOLCHAIN/bin/mipsel-unknown-linux-gnu-ranlib
./configure --prefix=$TOOLCHAIN/mipsel-unknown-linux-gnu/sys-root/usr/

at the and i compile tor

#!/bin/bash
export TOOLCHAIN=/opt/cross/mipsel-unknown-linux-gnu
export CC=$TOOLCHAIN/bin/mipsel-unknown-linux-gnu-gcc
export RANLIB=$TOOLCHAIN/bin/mipsel-unknown-linux-gnu-ranlib
./configure --prefix=$TOOLCHAIN/mipsel-unknown-linux-gnu/sys-root/usr/ --host=mipsel-unknown-linux-gnu --disable-asciidoc


When i launch openssl binary on mipsel machine it work good and all the other's application.
Only tor goes in segmentation fault...very strange...
i Have also tryied to make strace ./tor and this is the result:

./tor
Segmentation fault

Then with strace:

strace ./tor
execve("./tor", tor?, 12 vars */) = 0
brk(0) = 0x55a4e000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x773d1000
uname({sys="Linux", node="dm800se", ...}) = 0
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=10585, ...}) = 0
mmap(NULL, 10585, PROT_READ, MAP_PRIVATE, 3, 0) = 0x773cc000
close(3) = 0
open("/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\300\27\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=104116, ...}) = 0
mmap(NULL, 164720, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x77370000
mprotect(0x77389000, 61440, PROT_NONE) = 0
mmap(0x77398000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x77398000
close(3) = 0
open("/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\0=\0\0004\0\0\0"..., 512) = 512
lseek(3, 620, SEEK_SET) = 620
read(3, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0", 32) = 32
fstat64(3, {st_mode=S_IFREG|0755, st_size=570664, ...}) = 0
mmap(NULL, 623536, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x772d4000
mprotect(0x7735c000, 61440, PROT_NONE) = 0
mmap(0x7736b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x87000) = 0x7736b000
close(3) = 0
open("/usr/lib/libevent-2.0.so.5", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\360|\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=278032, ...}) = 0
mmap(NULL, 319184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x77284000
mprotect(0x772c1000, 65536, PROT_NONE) = 0
mmap(0x772d1000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3d000) = 0x772d1000
close(3) = 0
open("/usr/lib/libssl.so.1.0.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0`\244\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=376684, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x773cb000
mmap(NULL, 421136, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7721c000
mprotect(0x7726e000, 61440, PROT_NONE) = 0
mmap(0x7727d000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x51000) = 0x7727d000
close(3) = 0
open("/lib/libcrypto.so.1.0.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0PR\3\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1813864, ...}) = 0
mmap(NULL, 1743936, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x77070000
mprotect(0x771f1000, 65536, PROT_NONE) = 0
mmap(0x77201000, 90112, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x181000) = 0x77201000
mmap(0x77217000, 11328, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x77217000
close(3) = 0
open("/lib/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0 \31\0\0004\0\0\0"..., 512) = 512
lseek(3, 676, SEEK_SET) = 676
read(3, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0", 32) = 32
fstat64(3, {st_mode=S_IFREG|0755, st_size=37312, ...}) = 0
mmap(NULL, 99040, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x77054000
mprotect(0x7705c000, 61440, PROT_NONE) = 0
mmap(0x7706b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7706b000
close(3) = 0
open("/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\200\v\0\0004\0\0\0"..., 512) = 512
lseek(3, 636, SEEK_SET) = 636
read(3, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0", 32) = 32
fstat64(3, {st_mode=S_IFREG|0755, st_size=14736, ...}) = 0
mmap(NULL, 78064, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x77040000
mprotect(0x77043000, 61440, PROT_NONE) = 0
mmap(0x77052000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x77052000
close(3) = 0
open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\244\272\1\0004\0\0\0"..., 512) = 512
lseek(3, 700, SEEK_SET) = 700
read(3, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0", 32) = 32
fstat64(3, {st_mode=S_IFREG|0755, st_size=1663880, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x773ca000
mmap(NULL, 1646432, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76eac000
mprotect(0x77026000, 65536, PROT_NONE) = 0
mmap(0x77036000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17a000) = 0x77036000
mmap(0x7703c000, 8032, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7703c000
close(3) = 0
open("/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\10\0\1\0\0\0\340c\0\0004\0\0\0"..., 512) = 512
lseek(3, 676, SEEK_SET) = 676
read(3, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0\20\0\0\0", 32) = 32
fstat64(3, {st_mode=S_IFREG|0755, st_size=113612, ...}) = 0
mmap(NULL, 177168, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x76e80000
mprotect(0x76e99000, 61440, PROT_NONE) = 0
mmap(0x76ea8000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x76ea8000
mmap(0x76eaa000, 5136, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x76eaa000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x773c9000
set_thread_area(0x773d0860) = 0
mprotect(0x77036000, 12288, PROT_READ) = 0
mprotect(0x76ea8000, 4096, PROT_READ) = 0
mprotect(0x77052000, 4096, PROT_READ) = 0
mprotect(0x7706b000, 4096, PROT_READ) = 0
mprotect(0x7736b000, 4096, PROT_READ) = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x5756aa1e} ---
+++ killed by SIGSEGV +++
Segmentation fault

Child Tickets

Attachments (3)

build.log (50.5 KB) - added by lamero 6 years ago.
make log
config.log (495.4 KB) - added by lamero 6 years ago.
build1.log (3.4 KB) - added by lamero 6 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 6 years ago by nickm

Milestone: Tor: unspecified

Interesting. From the strace, it appears that the crash is happening during the link process, or immediately after. That suggests some problem with how the build is happening. It's possible that Tor's build process is using your toolchain badly, or invoking incorrect link commands, or something.

Try building Tor with "make V=1" and have a look through the command lines that Tor is using to compile and link. Do they look right? Are there any linker or compiler options that are missing, or which look wrong?

Changed 6 years ago by lamero

Attachment: build.log added

make log

comment:2 Changed 6 years ago by lamero

make V=1 give me this (see build.log)

comment:3 Changed 6 years ago by nickm

I wonder if this could be a problem with our hardening options. Does the configure option "--disable-gcc-hardening" help at all?

Other than that, you might want to show that log to some people who know more about mipsel. It's possible that there's some problem there that I'm not seeing.

Changed 6 years ago by lamero

Attachment: config.log added

Changed 6 years ago by lamero

Attachment: build1.log added

comment:4 Changed 6 years ago by lamero

It works! :) Thanks!
Can you explain me what is --disable-gcc-hardening?

comment:5 Changed 6 years ago by nickm

The --disable-gcc-hardening flag turns off support for some of the options that improve the security of generated binaries. The ones that it disabled in your case are:

-D_FORTIFY_SOURCE=2 -Wstack-protector -fwrapv --param ssp-buffer-size=1 -fPIE

It looks like at least one of those is broken with your mipsel tool chain. It would be good if we could find out which one, and have that one only get disabled.

comment:6 Changed 5 years ago by nickm

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.