This is an archive of the discontinued LLVM Phabricator instance.

[ASan] Improved stack overflow detection for PowerPC64
ClosedPublic

Authored by foad on Nov 13 2014, 9:20 AM.

Details

Summary

AsanOnSIGSEGV has some heuristics for detecting stack overflow, but
they don't cope with a PowerPC store-with-update instruction which
modifies sp and stores to the modified address in one instruction.

This patch adds some PowerPC-specific code to check for this case.

This fixes the last few cases of the stack-overflow test.

Diff Detail

Event Timeline

foad updated this revision to Diff 16164.Nov 13 2014, 9:20 AM
foad retitled this revision from to [ASan] Improved stack overflow detection for PowerPC64.
foad updated this object.
foad edited the test plan for this revision. (Show Details)
foad added reviewers: kcc, samsonov, eugenis.
foad added a subscriber: Unknown Object (MLST).
eugenis accepted this revision.Nov 14 2014, 6:52 AM
eugenis edited edge metadata.

stack-overflow test actually catches this? Nice.

lib/asan/asan_posix.cc
57

Please make it u32 instead of unsigned.

61

It may be helpful to list or somehow characterize instructions that match this condition (I mean, there is obviously more than 1 opcode listed here).

I assume these "xo" checks limit it to instructions operating on SP register?

This revision is now accepted and ready to land.Nov 14 2014, 6:52 AM
foad added inline comments.Nov 14 2014, 7:00 AM
lib/asan/asan_posix.cc
61

I characterized them as "store-with-update to r1" instructions, but I will be more explicit!

foad added inline comments.Nov 14 2014, 7:23 AM
lib/asan/asan_posix.cc
61

opcd is "opcode" and xo is "extended opcode". These field names are taken directly from the POWER architecture manual.

foad updated this revision to Diff 16210.Nov 14 2014, 7:29 AM
foad edited edge metadata.

Use u32 instead of unsigned. Add comments about which instructions
we match.

foad closed this revision.Nov 14 2014, 7:30 AM