Opened 6 years ago

Closed 5 years ago

#9699 closed defect (worksforme)

tor curve25519 fail

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

Description

Tor fails to compile on CentOS 5.9 unless I use --disable-curve25519 and I don't want to miss out on curve25519.

This is compile fail with git from a few minutes ago:

if gcc -DHAVE_CONFIG_H -I. -I. -I. -DTOR_UNIT_TESTS -I./src/ext -Isrc/ext -I./src/common -Isrc/common -I./src/or -Isrc/or -DSHARE_DATADIR="\"/usr/share\"" -DLOCALSTATEDIR="\"/usr/var\"" -DBINDIR="\"/usr/bin\"" -I./src/common -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector -fwrapv --param ssp-buffer-size=1 -fPIE -Wall -fno-strict-aliasing -MT src/common/src_common_libor_event_testing_a-compat_libevent.o -MD -MP -MF "src/common/.deps/src_common_libor_event_testing_a-compat_libevent.Tpo" -c -o src/common/src_common_libor_event_testing_a-compat_libevent.o test -f 'src/common/compat_libevent.c' || echo './'src/common/compat_libevent.c; \

then mv -f "src/common/.deps/src_common_libor_event_testing_a-compat_libevent.Tpo" "src/common/.deps/src_common_libor_event_testing_a-compat_libevent.Po"; else rm -f "src/common/.deps/src_common_libor_event_testing_a-compat_libevent.Tpo"; exit 1; fi

rm -f src/common/libor-event-testing.a
ar cru src/common/libor-event-testing.a src/common/src_common_libor_event_testing_a-compat_libevent.o
ranlib src/common/libor-event-testing.a
if gcc -DHAVE_CONFIG_H -I. -I. -I. -I./src/ext -Isrc/ext -I./src/common -Isrc/common -I./src/or -Isrc/or -DSHARE_DATADIR="\"/usr/share\"" -DLOCALSTATEDIR="\"/usr/var\"" -DBINDIR="\"/usr/bin\"" -I./src/common -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-all -Wstack-protector -fwrapv --param ssp-buffer-size=1 -fPIE -Wall -fno-strict-aliasing -MT src/ext/curve25519_donna/src_common_libcurve25519_donna_a-curve25519-donna-c64.o -MD -MP -MF "src/ext/curve25519_donna/.deps/src_common_libcurve25519_donna_a-curve25519-donna-c64.Tpo" -c -o src/ext/curve25519_donna/src_common_libcurve25519_donna_a-curve25519-donna-c64.o test -f 'src/ext/curve25519_donna/curve25519-donna-c64.c' || echo './'src/ext/curve25519_donna/curve25519-donna-c64.c; \

then mv -f "src/ext/curve25519_donna/.deps/src_common_libcurve25519_donna_a-curve25519-donna-c64.Tpo" "src/ext/curve25519_donna/.deps/src_common_libcurve25519_donna_a-curve25519-donna-c64.Po"; else rm -f "src/ext/curve25519_donna/.deps/src_common_libcurve25519_donna_a-curve25519-donna-c64.Tpo"; exit 1; fi

src/ext/curve25519_donna/curve25519-donna-c64.c: In function ‘curve25519_donna’:
src/ext/curve25519_donna/curve25519-donna-c64.c:451: error: unrecognizable insn:
(insn 10003 10002 10004 20 src/ext/curve25519_donna/curve25519-donna-c64.c:261 (parallel [

(set (reg:CC 17 flags)

(unspec:CC [

(reg:DI 2 cx [orig:375 t$0.894 ] [375])
(const_int 2251799813685229 [0x7ffffffffffed])

] 24))

(set (reg:DI 2 cx [orig:375 t$0.894 ] [375])

(plus:DI (reg:DI 2 cx [orig:375 t$0.894 ] [375])

(const_int 2251799813685229 [0x7ffffffffffed])))

]) -1 (nil)

(nil))

src/ext/curve25519_donna/curve25519-donna-c64.c:451: internal compiler error: in extract_insn, at recog.c:2084
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccZzU4qG.out file, please attach this to your bugreport.
make[1]: * [src/ext/curve25519_donna/src_common_libcurve25519_donna_a-curve25519-donna-c64.o] Error 1
make[1]: Leaving directory `/root/Tor/tor'
make:
* [all] Error 2

Child Tickets

Change History (6)

comment:1 Changed 6 years ago by arma

Component: - Select a componentTor
Keywords: tor-client added

comment:2 Changed 6 years ago by nickm

This is almost 100% certainly a compiler bug. What compiler is this using? You might need to build Tor with a more recent GCC.

comment:3 Changed 6 years ago by tmpname0901

I had no problems building curve25519-donna-c64 on multiple CentOS 5.9 (x86_64) systems.

I'll take a stab at guessing what is different between your environment and mine: I'm building with gcc44, not the default CentOS5 GCC 4.1.x development tools.

Do this to install the newer devel tools:

yum -y install gcc44 gcc44-c++ binutils220

Then specify gcc44 as your compiler:

export CC=gcc44
export CXX=g++44

and CPU type of "native":

CFLAGS='-O2 -g -march=native -mno-avx"
CFLAGS='-O2 -g -march=native -mno-avx"

The CPU type referred to above is optional. GCC will attempt to optimize the code to match the capabilities of your CPU. This doesn't work in a KVM VPS, but it is generally a Good Thing. The "-mno-avx" is because the assembler doesn't understand the AVX instruction set.

comment:4 Changed 6 years ago by nickm

tmpname0901: Can you think of any simple check to detect the broken default centos 5.9 compiler? If you can find a tiny program that the default compiler refuses to compile correctly, we could use that to detect a broken implementation at build time from the configure script.

comment:5 in reply to:  4 Changed 6 years ago by tmpname0901

Replying to nickm:

tmpname0901: Can you think of any simple check to detect the broken default centos 5.9 compiler? If you can find a tiny program that the default compiler refuses to compile correctly, we could use that to detect a broken implementation at build time from the configure script.

No, I don't have a test case, beyond the obvious whittling down of curve25519-donna-c64.c until the mis-compilation is no longer seen. Or maybe playing with the compiler switches.

I use gcc44 not because I fear the buggy default compiler but because the newer version of GCC has better support for contemporary CPUs and general optimization. (GCC v4.1 was released in Feb. 2007 - that's a long time ago in CPU generations.) Tor can be CPU-intensive and I want to give it every advantage that the hardware can provide.

comment:6 Changed 5 years ago by nickm

Resolution: worksforme
Status: newclosed

It looks like the buggy compiler didn't propagate into general use. Closing this.

Note: See TracTickets for help on using tickets.