This is an archive of the discontinued LLVM Phabricator instance.

Add bound violation handling for Intel(R) Memory Protection Extensions (Intel(R) MPX)
ClosedPublic

Authored by valentinagiusti on Oct 6 2016, 8:30 AM.

Details

Summary

This patch adds support for handling the SIGSEGV signal with 'si_code ==
SEGV_BNDERR', which is thrown when a bound violation is caught by the
Intel(R) MPX technology.

Signed-off-by: Valentina Giusti <valentina.giusti@intel.com>

Event Timeline

valentinagiusti retitled this revision from to Add bound violation handling for Intel(R) Memory Protection Extensions (Intel(R) MPX).
valentinagiusti updated this object.
valentinagiusti added reviewers: zturner, labath.
valentinagiusti added subscribers: emaste, lldb-commits.
labath accepted this revision.Oct 6 2016, 8:51 AM
labath edited edge metadata.

lgtm.

At one point I'd like to change this code to not transfer the "crash reason" as string, but in a more structured way (i.e., qXfer:siginfo:read packet), but that is certainly out of scope of this patch.

This revision is now accepted and ready to land.Oct 6 2016, 8:51 AM
valentinagiusti edited edge metadata.

used llvm:raw_string_ostream instead of std::stringstream

zturner added inline comments.Oct 6 2016, 9:47 AM
source/Plugins/Process/POSIX/CrashReason.cpp
38

Actually I'm not sure this is correct. Since you initialize the stream with str, as soon as you call stream.str() it will flush everything to the underlying string. Now str will contain the full formatted data. Then you will call str += str and have a second copy of it.

I think you should just write stream.flush();

Can you check whether this works?

fixed usage of llvm:raw_string_ostream

zturner accepted this revision.Oct 6 2016, 11:02 AM
zturner edited edge metadata.
This revision was automatically updated to reflect the committed changes.