diff options
author | rmcilroy@chromium.org <rmcilroy@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2014-07-02 10:27:39 +0000 |
---|---|---|
committer | rmcilroy@chromium.org <rmcilroy@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2014-07-02 10:27:39 +0000 |
commit | 501673c86b9fca3bf8e9d8f97cbc5a9d30100faf (patch) | |
tree | 43ca6420dc426634905747ea4d37484f8ef2cbe7 /src/client | |
parent | Cleanup: hide undefined behavior from the compiler better. (diff) | |
download | breakpad-501673c86b9fca3bf8e9d8f97cbc5a9d30100faf.tar.xz |
Make crash_handler volatile to prevent compiler optimizing it away.
This bug manifests itself on Android x64 (in ExceptionHandlerTest::ExternalDumper), but is possible on any platform.
The compiler is unaware of the code which runs in the signal handler which reads this variable. Without volatile the compiler is free to optimise away writes to this variable which it believes are never read.
BUG=381142, 346626
R=thestig@chromium.org
Review URL: https://breakpad.appspot.com/8664002
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1343 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/linux/handler/exception_handler.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/linux/handler/exception_handler.h b/src/client/linux/handler/exception_handler.h index 1de38616..bb88b950 100644 --- a/src/client/linux/handler/exception_handler.h +++ b/src/client/linux/handler/exception_handler.h @@ -252,7 +252,11 @@ class ExceptionHandler { MinidumpDescriptor minidump_descriptor_; - HandlerCallback crash_handler_; + // Must be volatile. The compiler is unaware of the code which runs in + // the signal handler which reads this variable. Without volatile the + // compiler is free to optimise away writes to this variable which it + // believes are never read. + volatile HandlerCallback crash_handler_; // The global exception handler stack. This is need becuase there may exist // multiple ExceptionHandler instances in a process. Each will have itself |