Opened 4 years ago

Closed 3 years ago

#17508 closed defect (fixed)

Using FORTIFY_SOURCE breaks inlining of memcpy when comiling Tor Browser with ASan

Reported by: gk Owned by: tbb-team
Priority: Medium Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: tbb-hardened, ff45-esr-will-have
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

While it is a known thing that ASan is not working particularly well with FORTIFY_SOURCE (#14821 and https://code.google.com/p/address-sanitizer/issues/detail?id=247) this combination is breaking Tor Browser compilation directly:

In file included from ../../dist/system_wrappers/sys/cdefs.h:3:0,
                 from /usr/include/features.h:346,
                 from ../../dist/system_wrappers/features.h:3,
                 from /home/ubuntu/install/gcc/include/c++/5.1.0/x86_64-unknown-linux-gnu/bits/os_defines.h:39,
                 from /home/ubuntu/install/gcc/include/c++/5.1.0/x86_64-unknown-linux-gnu/bits/c++config.h:482,
                 from /home/ubuntu/install/gcc/include/c++/5.1.0/cstddef:44,
                 from ../../dist/system_wrappers/cstddef:3,
                 from ../../dist/include/mozilla/Compiler.h:46,
                 from ../../dist/include/mozilla/Attributes.h:12,
                 from ../../dist/include/mozilla/Assertions.h:16,
                 from ../../dist/include/mozilla/ArrayUtils.h:14,
                 from /home/ubuntu/build/tor-browser/xpcom/threads/BackgroundHangMonitor.cpp:7,
                 from /home/ubuntu/build/tor-browser/obj-x86_64-unknown-linux-gnu/xpcom/threads/Unified_cpp_xpcom_threads0.cpp:2:
/usr/include/bits/string3.h: In member function 'void mozilla::ThreadStackHelper::FillThreadContext(void*)':
/usr/include/bits/string3.h:49:1: error: inlining failed in call to always_inline 'void* memcpy(void*, const void*, size_t) throw ()': function attribute mismatch
 __NTH (memcpy (void *__restrict __dest, __const void *__restrict __src,
 ^
In file included from /home/ubuntu/build/tor-browser/obj-x86_64-unknown-linux-gnu/xpcom/threads/Unified_cpp_xpcom_threads0.cpp:29:0:
/home/ubuntu/build/tor-browser/xpcom/threads/ThreadStackHelper.cpp:730:66: error: called from here
          &context.uc_mcontext.gregs[REG_R8], 8 * sizeof(int64_t));
                                                                  ^
make[5]: Leaving directory `/home/ubuntu/build/tor-browser/obj-x86_64-unknown-linux-gnu/xpcom/threads'
make[5]: *** [Unified_cpp_xpcom_threads0.o] Error 1

It is not clear why this is happening right now. We only workaround this problem by backporting

https://hg.mozilla.org/mozilla-central/rev/5e86358d4ec2
https://hg.mozilla.org/mozilla-central/rev/33e89c9a4172

Child Tickets

Change History (2)

comment:1 Changed 4 years ago by gk

Keywords: tbb-hardened added; tbb-hardening removed

comment:2 Changed 3 years ago by gk

Keywords: ff45-esr-will-have added
Resolution: fixed
Status: newclosed

Fixed in 6.0a5.

Note: See TracTickets for help on using tickets.