In LAM model X86_64 will use bits 57-62 (of 0-63) as HWASAN tag.
So here we make sure the tag shift position and tag mask is correct for x86-64.
And support the HWASAN for setjmp longjmp in compiler-rt
Paths
| Differential D102472
[HWASAN] Update the tag info for X86_64 Needs ReviewPublic Authored by xiangzhangllvm on May 14 2021, 1:05 AM.
Details Summary In LAM model X86_64 will use bits 57-62 (of 0-63) as HWASAN tag. And support the HWASAN for setjmp longjmp in compiler-rt
Diff Detail
Event Timeline
This revision is now accepted and ready to land.May 19 2021, 7:34 PM This revision was landed with ongoing or failed builds.May 19 2021, 8:22 PM Closed by commit rG81c18ce03cd8: [HWASAN] Update the tag info for X86_64. (authored by xiangzhangllvm). · Explain Why This revision was automatically updated to reflect the committed changes. Comment Actions It doesn't look like this was reviewed by anyone. Could you revert this please until it gets reviewed? This revision is now accepted and ready to land.May 19 2021, 8:58 PM This revision now requires changes to proceed.May 19 2021, 8:59 PM xiangzhangllvm added a reverting change: rG02f2d739e074: Revert "[HWASAN] Update the tag info for X86_64.".May 19 2021, 10:13 PM Comment Actions
Done, Could you help review it ? Comment Actions Hello @eugenis @vitalybuka @morehouse I see you change the related code at compiler-rt, Could you help review this patch? This patch just limited the tag for x86_64. Comment Actions Hi Xiang, thanks for the patch. I haven't looked too close yet, but a couple questions:
Comment Actions Hello @morehouse, thanks for your work too: 2 In fact, We can divide it into two steps, Step 1 is "Tag correctness checking", Step 2 is "Hardware supporting point with tag". The option "ClUntagPointer" can help us first testing the Step 1. For example: we write 7 in to int *p, for HWASAN, we do 2 things: Step1: Checking tag of p : call void @__hwasan_store4 (p_tagged) // Checking tag is correct or not Step2: Write 7 into mem: *p_tagged = 7 // Need Hardware supporting. But if we use "ClUntagPointer" change "*p_tagged = 7" --> "*p = 7", we can run the program, and test Step 1 for HWASAN. For HWASAN, Most code in compiler and compiler-rt is doing work for Step 1. So we can use "ClUntagPointer" first test it. After we make sure Step 1 is OK, when the Hardware/OS is ready, we just need to totally/really enable HWASAN by just, I think, updating the system call in InitPrctl. Comment Actions Hello, @morehouse, I first spilt the change of compiler to https://reviews.llvm.org/D102901 Comment Actions
I recently removed a bunch of untagging stuff from our tests, and I'd like to avoid adding it back. This is why I'm working on a buildbot to run tests in QEMU with LAM enabled. I've also been testing locally with LAM in QEMU. Comment Actions Hello @morehouse , I saw the change of compiler for X86 ( https://reviews.llvm.org/D102901 ) has been merged. Comment Actions
Eventually. The existing tests at the time passed without it, so I haven't done anything with this patch. Comment Actions
Does the "existing tests" just means LIT tests about HWASAN in compiler-rt ? thanks.
Revision Contents
Diff 346624 llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/test/Instrumentation/HWAddressSanitizer/X86/stack.ll
|
I add back untag point, (disable it in default), it is useful to test some simple test with HWASAN.