summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorpcc <pcc@chromium.org>2015-08-06 17:50:36 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-07 00:52:10 +0000
commitff550411a2f2701746c93b32e9675e4047be167f (patch)
tree080929b1aa3932bfb53ccfca683ebe1eefe218d1 /base
parent3cd6a820c499c11f666b2f72fdf28a65ee87da83 (diff)
downloadchromium_src-ff550411a2f2701746c93b32e9675e4047be167f.zip
chromium_src-ff550411a2f2701746c93b32e9675e4047be167f.tar.gz
chromium_src-ff550411a2f2701746c93b32e9675e4047be167f.tar.bz2
CFI: Add diagnostic information to likely CFI violation stack traces.
If CFI enforcement is enabled and we receive a SIGILL, it is most likely that a CFI check failed. Add a reference to the CFI documentation to the stack trace to make it easier to identify and investigate CFI violations. Also add an end marker to stack traces to make it easier for automated tools to extract stack traces. BUG=464797 R=thakis@chromium.org Review URL: https://codereview.chromium.org/1267423002 Cr-Commit-Position: refs/heads/master@{#342246}
Diffstat (limited to 'base')
-rw-r--r--base/debug/stack_trace_posix.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
index 9593962..dbbec36 100644
--- a/base/debug/stack_trace_posix.cc
+++ b/base/debug/stack_trace_posix.cc
@@ -281,6 +281,16 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) {
}
PrintToStderr("\n");
+#if defined(CFI_ENFORCEMENT)
+ if (signal == SIGILL && info->si_code == ILL_ILLOPN) {
+ PrintToStderr(
+ "CFI: Most likely a control flow integrity violation; for more "
+ "information see:\n");
+ PrintToStderr(
+ "https://www.chromium.org/developers/testing/control-flow-integrity\n");
+ }
+#endif
+
debug::StackTrace().Print();
#if defined(OS_LINUX)
@@ -395,6 +405,9 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) {
write(STDERR_FILENO, buf, std::min(len, sizeof(buf) - 1));
#endif // ARCH_CPU_32_BITS
#endif // defined(OS_MACOSX)
+
+ PrintToStderr("[end of stack trace]\n");
+
_exit(1);
}