This is an archive of the discontinued LLVM Phabricator instance.

[hwasan] remove requirment for PIE
ClosedPublic

Authored by Enna1 on Mar 29 2023, 12:58 AM.

Details

Summary

The requirement for PIE of hwasan was introduced in https://reviews.llvm.org/D44745, this patch removes requirement for PIE.

Diff Detail

Event Timeline

Enna1 created this revision.Mar 29 2023, 12:58 AM
Enna1 edited the summary of this revision. (Show Details)Mar 29 2023, 3:50 AM
Enna1 added a comment.Mar 29 2023, 4:17 AM

Under my test on aarch64 linux, all hwasan tests passed without PIE.
IIUC, only global variables in hwasan are affected by PIE.
Without PIE, a special instruction sequence assembly will be to emitted to add the tag to the global variable address, see https://reviews.llvm.org/D120305 .
I'm not sure if hwasan linux x86-64 is different from linux aarch64 and have a special requirment for PIE.

Also note that since https://reviews.llvm.org/D120305, CLANG_DEFAULT_PIE_ON_LINUX was default on.

Enna1 published this revision for review.Mar 29 2023, 4:19 AM
Enna1 added reviewers: eugenis, alekseyshl, pcc, vitalybuka.
Enna1 added a subscriber: MTC.
Herald added a project: Restricted Project. · View Herald TranscriptMar 29 2023, 4:20 AM
MaskRay accepted this revision.Mar 30 2023, 7:51 PM
This revision is now accepted and ready to land.Mar 30 2023, 7:51 PM
vitalybuka accepted this revision.Mar 31 2023, 4:54 PM
vitalybuka removed a reviewer: alekseyshl. vitalybuka added 1 blocking reviewer(s): eugenis.

I don't know why HWASAN may required pie, but @eugenis seems confident on D44745. Lets give him a chance to take a look.

This revision now requires review to proceed.Mar 31 2023, 4:54 PM
Enna1 added a comment.Apr 9 2023, 10:57 PM

gentle ping, @eugenis PTAL, thanks!

Sorry, I do not remember why this requirement is there. Must be related to shadow / allocator placement and kernel mapping conflicts, but hwasan is using dynamic shadow so that should not be an issue... LGTM as long as it works.

vitalybuka removed 1 blocking reviewer(s): eugenis.Apr 12 2023, 1:12 PM

Feel free to land. It works on my arm linux setup.

This revision is now accepted and ready to land.Apr 12 2023, 1:12 PM
This revision was automatically updated to reflect the committed changes.