This is an archive of the discontinued LLVM Phabricator instance.

[hwasan] Show sp in register dump.
ClosedPublic

Authored by fmayer on Jun 23 2021, 8:07 AM.

Diff Detail

Event Timeline

fmayer requested review of this revision.Jun 23 2021, 8:07 AM
fmayer created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2021, 8:07 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
fmayer updated this revision to Diff 353986.Jun 23 2021, 8:09 AM

Format test properly.

fmayer updated this revision to Diff 353989.Jun 23 2021, 8:15 AM

Require aarch64 rather than XFAIL x86.

fmayer added a subscriber: eugenis.
eugenis added inline comments.Jun 23 2021, 1:28 PM
compiler-rt/lib/hwasan/hwasan_report.cpp
657

I'd rather put it in the last line of the dump, after x30.

compiler-rt/test/hwasan/TestCases/stack-pointer-report.c
14

I'd rather copy sp into a local variable and print it right here. It is not impossible that x11 would be in use at this point. SP does not normally change within a function (unless you do alloca or other weird things), so the copy does not have to be immediately before the fault.

15

this volatile does not do anything AFAIK - you'd need "z" itself to be volatile to force the memory access. This does not really matter at -O0 but still.

eugenis added inline comments.Jun 23 2021, 1:29 PM
compiler-rt/test/hwasan/TestCases/stack-pointer-report.c
14

In fact, update register-dump-read.c test instead of adding a new one.

hctim added inline comments.Jun 23 2021, 3:08 PM
compiler-rt/test/hwasan/TestCases/stack-pointer-report.c
14

-ffixed-x11 is another option but I like Evgenii's suggestion better.

fmayer updated this revision to Diff 354179.Jun 24 2021, 2:46 AM

Change format, use existing test.

fmayer marked 5 inline comments as done.Jun 24 2021, 2:47 AM

Thanks!

compiler-rt/test/hwasan/TestCases/stack-pointer-report.c
14

I added it to register-dump-read.c, but used a register (and fixed-x11), because that is how the whole test is structured and it seemed simpler this way.

hctim accepted this revision.Jun 24 2021, 10:23 AM

LGTM w/ nit.

compiler-rt/lib/hwasan/hwasan_report.cpp
682

I think (and agree with) @eugenis meant to be on the same line as x30.

This revision is now accepted and ready to land.Jun 24 2021, 10:23 AM
fmayer updated this revision to Diff 354308.Jun 24 2021, 11:08 AM

Move sp to last line rather than its own.

fmayer marked an inline comment as done.Jun 24 2021, 11:08 AM
eugenis accepted this revision.Jun 24 2021, 2:09 PM

LGTM

This revision was automatically updated to reflect the committed changes.