This is an archive of the discontinued LLVM Phabricator instance.

[asan] Fix read_binary_name_regtest.c test dying with SIGPIPE
ClosedPublic

Authored by iii on Mar 22 2020, 3:12 PM.

Details

Summary

Disable symbolization of results, since llvm-symbolizer cannot start
due to restricted readlink(), causing the test to die with SIGPIPE.

Diff Detail

Event Timeline

iii created this revision.Mar 22 2020, 3:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 22 2020, 3:12 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript

Why does this test pass on other platforms?

iii added a comment.EditedMar 24 2020, 9:50 AM

It fails for me both on x86_64 and s390x.
I think there might be a race: if we manage to write CODE lines before llvm-symbolizer exits, we just get a "Failed to use and restart external symbolizer" message.
However, if we write at a later point in time, we get a SIGPIPE.

One can induce the race as follows:

build$ PATH=$PWD/bin:$PATH gdb projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Linux/Output/read_binary_name_regtest.c.tmp
(gdb) b WriteToFile
Breakpoint 1 at 0x4d5970: file llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp, line 184.
(gdb) r
Breakpoint 1, __sanitizer::WriteToFile (fd=6, buff=buff@entry=0x7ffff50ed018, buff_size=buff_size@entry=158, bytes_written=bytes_written@entry=0x7fffffffb2b8, error_p=error_p@entry=0x0)
(gdb) c
Program received signal SIGPIPE, Broken pipe.
__sanitizer::internal_write (fd=6, buf=buf@entry=0x7ffff50ed018, count=count@entry=158) at llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:222
iii added a comment.Mar 24 2020, 10:44 AM

Come to think of it, the most important thing actually must be that this is with -DBUILD_SHARED_LIBS=ON. I don't think static builds are affected.

eugenis accepted this revision.Mar 24 2020, 10:48 AM

OK, makes sense, LGTM.

This revision is now accepted and ready to land.Mar 24 2020, 10:48 AM
This revision was automatically updated to reflect the committed changes.