This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Test HWASan + LAM via QEMU.
ClosedPublic

Authored by morehouse on May 27 2021, 6:01 PM.

Details

Summary

Uses LAM-enabled full system QEMU emulation to test HWASan's LAM
support.

Depends on:
https://github.com/google/sanitizers/pull/1408
https://github.com/google/sanitizers/pull/1410

Diff Detail

Event Timeline

morehouse created this revision.May 27 2021, 6:01 PM
morehouse requested review of this revision.May 27 2021, 6:01 PM
morehouse edited the summary of this revision. (Show Details)May 27 2021, 6:07 PM

Tests pass locally.

Tested manually on a fresh Debian 10 GCE instance, and things are mostly working. The check-hwasan-lam step fails to find lld.

I'll look into the lld issue next week.

vitalybuka added inline comments.May 29 2021, 4:55 PM
zorg/buildbot/builders/sanitizers/buildbot_qemu.sh
112

I also need patched qemu now.
Please rebase and add similar revision comparison to make bot rebuild qemu if remote changed.

115

why you don't fetch submodules?

120

-e does not work in "() ||" case
so you need && or || exit

123

can we make a single function
build_qemu URL <revision> to build both?
The one above is only need --enable-linux-user, "--disable-system --static" can be removed.

Maybe later, not now we can consider to have a single repo/branch with all patches LAM and MTE?

137

need remote revison check

178

Is this available from build_stage1_clang already?
or this is about DLLVM_STATIC_LINK_CXX_STDLIB?

probably stage one can be build with DLLVM_STATIC_LINK_CXX_STDLIB

194

same with revision check
probably we need a function

202

it's going to be huge commandline in lit error reports
maybe make sure that scripts is looking for fixed default locations?

morehouse updated this revision to Diff 349330.Jun 2 2021, 11:10 AM
morehouse marked 7 inline comments as done.
morehouse edited the summary of this revision. (Show Details)
  • Ensure LLD is built prior to testing HWASan.
  • Refactor git clone functionality into a helper function.
  • Use single function for both QEMU builds.
  • Shorten emulator prefix to single env var.
morehouse added inline comments.Jun 2 2021, 11:10 AM
zorg/buildbot/builders/sanitizers/buildbot_qemu.sh
178

This step imitates the Android bot. I don't think we can get this from stage 1 clang.

IIRC we need both LLVM_BUILD_RUNTIME=OFF and LLVM_STATIC_LINK_CXX_STDLIB=ON to avoid dynamic loader errors inside QEMU.

202

Simplified this down to a single environment variable. I think we still need to specify the ROOT dir since check-hwasan-lam may run the script from a different directory than the ROOT.

Depends on https://github.com/google/sanitizers/commit/709edc4b4d5324e520963a486c2e8d19fbd16a50.

vitalybuka accepted this revision.Jun 2 2021, 12:37 PM
vitalybuka added inline comments.
zorg/buildbot/builders/sanitizers/buildbot_qemu.sh
221

would it be more convenient to have as a script argument?

This revision is now accepted and ready to land.Jun 2 2021, 12:37 PM
morehouse added inline comments.Jun 2 2021, 12:41 PM
zorg/buildbot/builders/sanitizers/buildbot_qemu.sh
221

I don't see much difference in convenience either way.

With the current setup environment variables point to prerequisites that are expected to be the same with each run, while arguments change depending on the %run line.

This revision was automatically updated to reflect the committed changes.