Included is one test for passing structs by value and one test for passing C++
objects by value.
Details
- Reviewers
eugenis vitalybuka - Commits
- rG74ddba0c95bc: Add end-to-end tests for overflows of byval arguments.
rG6d8fb107b271: Add end-to-end tests for overflows of byval arguments.
rG03542db81c9a: [asan] Add end-to-end tests for overflows of byval arguments.
rCRT309424: Add end-to-end tests for overflows of byval arguments.
rCRT308677: Add end-to-end tests for overflows of byval arguments.
rCRT307343: [asan] Add end-to-end tests for overflows of byval arguments.
rL309424: Add end-to-end tests for overflows of byval arguments.
rL308677: Add end-to-end tests for overflows of byval arguments.
rL307343: [asan] Add end-to-end tests for overflows of byval arguments.
Diff Detail
- Repository
- rL LLVM
Event Timeline
test/asan/TestCases/pass-object-byval.cc | ||
---|---|---|
7 ↗ | (On Diff #104714) | But the pointer seems unused in the test. Is it possible to replace the IR check with smth like assert(a->me == &a) ? |
Probably we need test for UAR as well
A* f(A a) {
return &a;
}
viod b() {
A* a = f(A()); a-> // should likely crash with UAR and pass without it
}
test/asan/TestCases/pass-struct-byval.cc | ||
---|---|---|
1 ↗ | (On Diff #104714) | what is going to happen with -O1? |
compiler-rt/test/asan/TestCases/pass-object-byval.cc | ||
---|---|---|
4 ↗ | (On Diff #105350) |
Nice! |
compiler-rt/test/asan/TestCases/pass-struct-byval-uar.cc | ||
28 ↗ | (On Diff #105350) | Don't need that many -NOT checks. This would be enough: Also I'm not sure the NO-UAR case is necessary at all. You are effectively testing undefined behavior. |
Interesting development. It looks like on Android the IR produced doesn't use byval arguments for the pass-struct-byval-uar.cc test. As a result, foo() has no allocas to poison on return.
The byval attribute is avoided and instead the caller produces a copy of the struct and passes a pointer to it. So foo() can't do any poisoning to its argument for UAR, and instead main() would have to do it. However, ASAN currently does not handle this case. I would suspect that most of the test failures on other architectures are being caused by this same issue.
In this case I'd expect compiler creates llvm.lifetime.start/end and this detected as UAS bug
In this case I'd expect compiler creates llvm.lifetime.start/end and this detected as UAS bug
It looks like llvm.lifetime.start/end are set, but they do not encompass the proper lifetime of the copy. Thus even when compiling with -fsanitize-use-after-scope, UAS is not detected.
Change UNSUPPORTED option to REQUIRES. Test now works on x86_64 Linux and shouldn't cause the Android/ARM/Windows buildbots to fail.
@vitalybuka If this looks good, could you land this today since I don't yet have commit access?
@vitalybuka Does the latest diff look good? Just got commit access so I can land this if you approve.