This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Make the UBSan coverage-levels.cc test be Linux specific
ClosedPublic

Authored by kubamracek on Mar 11 2015, 4:59 PM.

Details

Reviewers
kcc
samsonov
Summary

The ubsan/TestCases/Misc/coverage-levels.cc is currently broken in the OS X buildbot: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/2144/console

However, XFAIL: darwin is not enough, because it fails only on i386, but not on x86_64. Let's move the test into a Linux/ subdirectory to make it not run on Darwin at all.

Diff Detail

Event Timeline

kubamracek updated this revision to Diff 21793.Mar 11 2015, 4:59 PM
kubamracek retitled this revision from to [compiler-rt] Make the UBSan coverage-levels.cc test be Linux specific.
kubamracek updated this object.
kubamracek edited the test plan for this revision. (Show Details)
kubamracek added subscribers: Unknown Object (MLST), zaks.anna, kcc and 2 others.

Do you understand why it fails on x86_64?

Do you understand why it fails on x86_64?

Yes, I already sent it into the mailing list:

I believe this recent change (r231413) caused a subtle change in behavior that is causing a test failure on the Darwin buildbot at http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/2083/console. The test is failing for a few days already, but it’s hard to tell which exact patch caused the regression, because the bot was offline for a day and a half when it occurred.

I think the cause is this: The old code in CovDump() iterates over the process map, but it intentionally skips over segments that are not executable. The new code in DumpOffsets() asks GetModuleNameAndOffsetForPC instead, which contains a bug/feature that is triggered for in a 64-bit binary when a 4GB __PAGEZERO (with protection=0) segment is present. In that case GetModuleNameAndOffsetForPC will say that the resulting offset is larger than 4GB, and the subsequent check in DumpOffsets that asserts offset > 0xffffffffU will ignore that item and not print it into the coverage file.

I also realized that simply ignoring __PAGEZERO in the Darwin implementation of process maps is not going to work easily, because there seems to be other code that relies on this behavior (I can’t tell if that’s a bug or a feature). What do you think would be way to fix this?

This patch is based on Kostya's suggestion to disable the test on Mac (it's already marked with XFAIL: darwin anyway).

samsonov accepted this revision.Mar 11 2015, 5:32 PM
samsonov added a reviewer: samsonov.

LGTM

This revision is now accepted and ready to land.Mar 11 2015, 5:32 PM
samsonov added inline comments.Mar 11 2015, 5:32 PM
test/ubsan/TestCases/Misc/Linux/coverage-levels.cc
17

Remove XFAIL: darwin now.

kcc accepted this revision.Mar 11 2015, 6:25 PM
kcc added a reviewer: kcc.

LGTM

kubamracek closed this revision.Mar 12 2015, 3:47 AM

Landed in r232025.

test/ubsan/TestCases/Misc/Linux/coverage-levels.cc