[llvm-dev] pie and sanitizers

Bill Seurer via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 22 06:56:01 PST 2017


We recently set up a new powerpc system with Ubuntu 17.10 for llvm 
development work.  It works ok for llvm except that most of the msan and 
tsan tests fail.  From a bit of experimentation and reading it looks 
like pie is the culprit.


Ubuntu now uses pie by default and they even have a note about it:

"Failures using ThreadSanitizer

Another source of build failures occurs when building with 
ThreadSanitizer (aka TSAN), which doesn't work with pie binaries. These 
packages need to disable via -no-pie. "

(from https://wiki.ubuntu.com/SecurityTeam/PIE)


So I tried forcing -no-pie on the msan amd tsan tests and the msan tests 
all worked but one (which seems to be failing for some other reason) and 
many of the failing tsan ones work as well (I need to further 
investigate the other failures).

Looking at the virtual addresses that are used with pie on this new 
system I don't think that I can adjust the ranges that msan and tsan use 
to accommodate things. For example on an older Ubuntu 16.04 system (with 
pie forced on) a trivial little test program run multiple times sees low 
memory addresses in the range

0x0000000100000984 to 0x000000013FFF0984

while on the 17.10 system

0x00000001002409B4 to 0x00001000FFF409B4

which is orders of magnitude larger.

I am not sure why the range is so large.  On another non-Ubuntu system 
with similar kernel and binutils versions I don't see this.  So, any 
ideas on how to handle this?

For immediate needs is there some way to locally add options when 
testing besides modifying the lit.cfg files?
-- 

-Bill Seurer



More information about the llvm-dev mailing list