Opened 3 years ago

Closed 3 years ago

#19821 closed defect (fixed)

--expensive-hardening makes configure check for curve25519-donna-c64 to fail

Reported by: yurivict271 Owned by:
Priority: Medium Milestone: Tor: 0.2.8.x-final
Component: Core Tor/Tor Version: Tor: 0.2.8.6
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

On FreeBSD 10.3 the error message is:

# cc -o conftest -O2 -pipe  -fstack-protector -fno-strict-aliasing -static -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer -fasynchronous-unwind-tables  -Is
rc/common  -Wl,-rpath,/usr/local/lib -fstack-protector x.c -lpthread -lexecinfo
/tmp/x-85cb71.o: In function `asan.module_ctor':
x.c:(.text+0x65): undefined reference to `__asan_init_v3'
cc: error: linker command failed with exit code 1 (use -v to see invocation)

Another failure in configure phase 'checking size of int8_t... 0' makes it to fail entirely.

Sanitizer options are causing this.

expensive-hardening isn't normally enabled by the port. I tried to enable it and ran into this problem.

To reproduce: in FreeBSD port security/tor add this line 'CONFIGURE_ARGS+=--enable-expensive-hardening' and run make.

Child Tickets

Change History (9)

comment:1 Changed 3 years ago by nickm

Hm. Are you able to look through config.log to see why this is happening?

comment:2 Changed 3 years ago by yurivict271

This is the command line that I picked from config.log in OP.
When -fsanitize=address -fsanitize=undefined is removed it succeeds.
Otherwise I don't know much about sanitizer.

Compiler is clang 3.4.1

comment:3 Changed 3 years ago by nickm

Can you tell what's in x.c ? And what's around that command line?

comment:4 Changed 3 years ago by yurivict271

Command line is from config.log:

cc -o conftest -O2 -pipe  -fstack-protector -fno-strict-aliasing -static -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer -fasynchronous-unwind-tables  -Is
rc/common  -Wl,-rpath,/usr/local/lib -fstack-protector x.c -lpthread -lexecinfo

x.c is the corresponding failed program from config.log:

/* confdefs.h */
#define PACKAGE_NAME "tor"
#define PACKAGE_TARNAME "tor"
#define PACKAGE_VERSION "0.2.8.6"
#define PACKAGE_STRING "tor 0.2.8.6"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PACKAGE "tor"
#define VERSION "0.2.8.6"
#define FLEXIBLE_ARRAY_MEMBER /**/
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_ACCEPT4 1
#define HAVE_BACKTRACE 1
#define HAVE_CLOCK_GETTIME 1
#define HAVE_FLOCK 1
#define HAVE_GETADDRINFO 1
#define HAVE_GETIFADDRS 1
#define HAVE_GETPASS 1
#define HAVE_GETRLIMIT 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_GMTIME_R 1
#define HAVE_INET_ATON 1
#define HAVE_IOCTL 1
#define HAVE_ISSETUGID 1
#define HAVE_LOCALTIME_R 1
#define HAVE_MEMMEM 1
#define HAVE_PIPE 1
#define HAVE_PIPE2 1
#define HAVE_READPASSPHRASE 1
#define HAVE_SIGACTION 1
#define HAVE_SOCKETPAIR 1
#define HAVE_STATVFS 1
#define HAVE_STRLCAT 1
#define HAVE_STRLCPY 1
#define HAVE_STRNLEN 1
#define HAVE_STRPTIME 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOULL 1
#define HAVE_SYSCONF 1
#define HAVE_SYSCTL 1
#define HAVE_UNAME 1
#define HAVE_USLEEP 1
#define HAVE_VASPRINTF 1
#define HAVE_PTHREAD_H 1
#define HAVE_PTHREAD_CREATE 1
#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
#define HAVE_EVENT_GET_VERSION_NUMBER 1
#define HAVE_EVUTIL_SECURE_RNG_SET_URANDOM_DEVICE_FILE 1
#define HAVE_EVUTIL_SECURE_RNG_INIT 1
#define HAVE_EVENT2_EVENT_H 1
#define HAVE_EVENT2_DNS_H 1
#define HAVE_EVENT2_BUFFEREVENT_SSL_H 1
#define USE_BUFFEREVENTS 1
#define HAVE_STRUCT_SSL_METHOD_ST_GET_CIPHER_BY_CHAR 1
#define HAVE_SSL_CIPHER_FIND 1
/* end confdefs.h.  */
      #include <stdint.h>
      typedef unsigned uint128_t __attribute__((mode(TI)));
  int func(uint64_t a, uint64_t b) {
           uint128_t c = ((uint128_t)a) * b;
           int ok = ((uint64_t)(c>>96)) == 522859 &&
             (((uint64_t)(c>>64))&0xffffffffL) == 3604448702L &&
                 (((uint64_t)(c>>32))&0xffffffffL) == 2351960064L &&
                 (((uint64_t)(c))&0xffffffffL) == 0;
           return ok;
      }

int
main ()
{
    int ok = func( ((uint64_t)2000000000) * 1000000000,
                   ((uint64_t)1234567890) << 24);
        return !ok;

  ;
  return 0;
}

comment:5 Changed 3 years ago by yurivict271

This might be a bug in clang as well, I am reporting it here because I see it on the tor project.

Did you test this option with clang compiler on linux?

Last edited 3 years ago by yurivict271 (previous) (diff)

comment:6 Changed 3 years ago by nickm

Milestone: Tor: 0.2.8.x-final

Actually, I think this is one of the longstanding clang installation bugs that we have a better workaround for in 0.2.9.

When you try with git master, do you get this message?

configure: error: The compiler supports -fsanitize=address, but for some reason I was not 
able to link when using it. Are you missing run-time support? With GCC you need libubsan.so,
 and with Clang you need libclang_rt.ubsan*

If so, you probably need to install a version of clang with the required runtime libraries. (IIRC Some distributions began accidentally omitting these libraries when clang deprecated autotools and switched to cmake or whatever they're using now.)

comment:7 Changed 3 years ago by nickm

Status: newneeds_information

comment:8 Changed 3 years ago by yurivict271

Now it works fine on FreeBSD 11 with 3.8.0.

It must be clang-3.4.1 that caused a problem on FreeBSD 10.

Please close this case then.

comment:9 Changed 3 years ago by nickm

Resolution: fixed
Status: needs_informationclosed

cool; thanks!

Note: See TracTickets for help on using tickets.