This is an archive of the discontinued LLVM Phabricator instance.

[asan] [SystemZ] Add slop for stack address detection.
ClosedPublic

Authored by koriakin on Apr 14 2016, 6:26 AM.

Details

Summary

On s390, siginfo reports the faulting address with page granularity -
we need to mask off the low bits of sp before comparison.

Diff Detail

Repository
rL LLVM

Event Timeline

koriakin retitled this revision from to [asan] [SystemZ] Add slop for stack address detection..
koriakin updated this object.
koriakin set the repository for this revision to rL LLVM.
koriakin added a project: Restricted Project.
koriakin added a subscriber: llvm-commits.
eugenis accepted this revision.Apr 14 2016, 12:18 PM
eugenis edited edge metadata.

LGTM w/ a nit

lib/asan/asan_posix.cc
49

Do you mean that sig.addr is rounded down to the nearest page boundary?
Do you need some extra space below sp (same as +512 in the common case below)? I.e. is it possible that the true fault address is below sp and falls into a different page, and then sig.addr would be ((sig.sp & 0xFFF) - 0x1000) ?

This revision is now accepted and ready to land.Apr 14 2016, 12:18 PM
koriakin added inline comments.Apr 14 2016, 2:06 PM
lib/asan/asan_posix.cc
49

sig.addr is rounded down to nearest page bounduary (because s390 gives you only the page index on a fault, not the full address). However, there is no redzone - accesses below sp are verboten. I'll try to think of a better wording for the comment before commiting.

koriakin edited edge metadata.

Changed the wording in the comment. Does it sound clearer now?

Yes, looks great.

This revision was automatically updated to reflect the committed changes.