summaryrefslogtreecommitdiff
path: root/runtime/fault_handler.h
AgeCommit message (Collapse)Author
2024-01-08Add visibility attributes in runtime/arch/{arm,arm64,riscv64,x86,x86_64} Dmitrii Ishcheikin
Include files that belong to fault_handler unit: * runtime/fault_handler.cc * runtime/fault_handler.h Include files that belong to thread unit: * runtime/thread-inl.h * runtime/thread.cc * runtime/thread.h * runtime/thread_android.cc * runtime/thread_linux.cc Update generate_operator_out to support symbol visibility attributes in classes and enums. Bug: 260881207 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: Icadc031d7c4455816a4799825dfcf8f2ef13f6a6
2023-08-14Detect bug 294339122 and crash with debugging output. Vladimir Marko
Test: run-gtests.sh Test: testrunner.py --target --64 --optimizing Bug: 294339122 Change-Id: I418783b7e80f7fb2ef54cab5d52717ab3bf039c8
2023-03-11Use userfaultfd's SIGBUS feature for concurrent compaction Lokesh Gidra
With the threading-based implementation the mutator threads and userfaultfd worker threads have to be alternatively scheduled when a missing page is accessed by the former. OTOH, with SIGBUS feature the mutator gets a SIGBUS signal on accessing a missing page. For response time the latter is expected to be significantly better than the former. With a microbenchmark on host SIGBUS feature is up to 10x better than the alternative. Bug: 160737021 Test: art/test/testrunner/testrunner.py --host Change-Id: I6f8d05690e23b70f9517e9e1929af3006b9960bb
2023-01-09Improve memory locality for generated code ranges list. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 38383823 Change-Id: Ia9094eb44034ee48168ae6117be05fba50bcd7fc
2022-12-15Reland^2 "ART: Rewrite compiled code check in FaultHandler." Vladimír Marko
This reverts commit 0110e952e488bc41429f6f33f36e8884f41a26d8. Reason for revert: Reland with a fix: Release the mutator lock before requesting an empty checkpoint. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 38383823 Change-Id: Idf82d3b77465453b8e70b40e32af193f266b357b
2022-11-30Revert "Reland "ART: Rewrite compiled code check in FaultHandler."" Vladimír Marko
This reverts commit 64fdbedd880bda36215e6e680d23bc2c361d2bfb. Reason for revert: Buildbot breakages: `Check failed: !bad_mutexes_held`. Bug: 38383823 Change-Id: I33d41c764c130cef05171de1eed82b778740704f
2022-11-30Reland "ART: Rewrite compiled code check in FaultHandler." Vladimír Marko
This reverts commit 263883a3d710c6cb3d683defb5c5da340ee5f88d. Reason for revert: Reland with a fix for semi-space GC which holds the mutator lock exclusively when calling `ClassLinker::CleanupClassLoaders()`. Change-Id: I262f4d317f42250b7a4c0594e45c4b496747a91f Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 38383823
2022-11-28Revert "ART: Rewrite compiled code check in FaultHandler." Vladimír Marko
This reverts commit f65a0d10771ddd70cc2421c33f2071510cb5a4f2. Reason for revert: Broke semi-space GC which holds the mutator lock exclusively during `CleanupClassLoaders()`. Bug: 38383823 Change-Id: I70afe1fd30eae29f3f28851b55c00b4eae588dad
2022-11-28ART: Rewrite compiled code check in FaultHandler. Vladimir Marko
Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --jit Test: run-gtests.sh Test: testrunner.py --target --optimizing Bug: 38383823 Change-Id: I215cb1f710863224a9c75f454044fed414aca997
2019-12-04Helpers and refactorings to prepare for interpreter optimizations (x64) Nicolas Geoffray
- Add data structure offsets that will be used in assembly code. - Be explicit about a stack overflow in a fault handler. - Move assembly helper code in asm_support so interpreter can use it. - Support putting literals in InterpreterCache. - Fix artHandleFillArrayDataFromCode for x64. Bug: 119800099 Test: test.py Change-Id: I2729f87fe5d09c04ae2e7081636f0cd89ac14c21
2019-01-09ART: Introduce runtime_globals Andreas Gampe
Split libartbase's globals.h into actual globals, and runtime- dependent globals which should live in runtime. Blanket-convert all runtime/ inclusions. In future CLs, the number of global constants should be reduced. For example, GC types are only relevant to GC/alloc functionality. Bug: 119869270 Test: mmma art Change-Id: I2d8cd32e0e7ab4084d2f2e96864b5338a78da94e
2018-12-06ART: Move to using locks.h instead of mutex.h Andreas Gampe
When only annotating lock requirements, use locks.h. Bug: 119869270 Test: mmma art Change-Id: I1608b03254712feff0072ebad012c3af0cc3dda4
2018-11-21ART: Remove setjmp.h includes Andreas Gampe
We are not using jmpbuf and co. Bug: 119869270 Test: m Change-Id: I85993e2ce506b059801d8d8da8b440e93ee9e3fd
2018-08-28Use 'final' and 'override' specifiers directly in ART. Roland Levillain
Remove all uses of macros 'FINAL' and 'OVERRIDE' and replace them with 'final' and 'override' specifiers. Remove all definitions of these macros as well, which were located in these files: - libartbase/base/macros.h - test/913-heaps/heaps.cc - test/ti-agent/ti_macros.h ART is now using C++14; the 'final' and 'override' specifiers have been introduced in C++11. Test: mmma art Change-Id: I256c7758155a71a2940ef2574925a44076feeebf
2017-07-24ART: Include cleanup Andreas Gampe
Let clang-format reorder the header includes. Derived with: * .clang-format: BasedOnStyle: Google IncludeIsMainRegex: '(_test|-inl)?$' * Steps: find . -name '*.cc' -o -name '*.h' | xargs sed -i.bak -e 's/^#include/ #include/' ; git commit -a -m 'ART: Include cleanup' git-clang-format -style=file HEAD^ manual inspection git commit -a --amend Test: mmma art Change-Id: Ia963a8ce3ce5f96b5e78acd587e26908c7a70d02
2017-03-23Revert^2: "Make sigchain actually own the signal chain."" Josh Gao
This reverts commit 33dca562d5ed9f52f63ced2334c066333ca073e9. Bug: http://b/36205469 Bug: http://b/36262089 Original-Change-Id: I416b13de800d3e23424cf20688ccfd7e4e48a111 Change-Id: I1267be72c32ed73d1079a572d0b8907556526dde
2017-03-18Revert "Make sigchain actually own the signal chain." Jin Qian
This reverts commit 7600fa9234e02cf5108a3a82babf3d3ab82fcddd. Change-Id: Ia46db2a7df0c0ac07107a8db06f42ff1afd4a97e
2017-03-17Make sigchain actually own the signal chain. Josh Gao
sigchain exists to make sure that art's signal handler is at the front, but it currently does this by putting the fault manager in the actual signal handler slot and having that handler call into sigchain when it doesn't want to handle a signal. sigchain also has a "special signal handler" (used for native bridge) that runs before user handlers, but after ART's. Move maintenance of the signal chain into sigchain itself, and use the same mechanism to handle the ART handler and the native bridge handler. Also, clean up some bugs: - InvokeUserSignalHandler was using the wrapper sigprocmask instead of the actual one. - Use SIG_SETMASK instead of SIG_BLOCK between calling handlers, in case one of the handlers changes the signal mask. - Correctly handle sigaction without SA_SIGINFO. Bug: http://b/36205469 Bug: http://b/36262089 Test: NPE with dalvikvm with/without TEST_NESTED_SIGNAL defined (arm/aarch64) Change-Id: I416b13de800d3e23424cf20688ccfd7e4e48a111
2017-03-08Catch signals that happen inside a fault handler. Josh Gao
Unblock some signals (SIGABRT, SIGBUS, SIGSEGV) that could happen inside of the ART internal fault handlers, to report crashes inside of the signal handler. Because we can't use sigaction to change the handler when this happens, because it modifies global state, add a new member variable in Thread to track whether a call to the fault handler is reentrant or not. Remove the old nested signal implementation that attempted to do this. Bug: http://b/35853436 Test: changed the #if 0 to #if 1, ran a dummy process that threw a NullPointerException, inspected logcat Change-Id: I04bb4a09433c6817933d64ec681ec433b528f2a5
2016-06-29Do checks on the fault address when we think it's an NPE. Nicolas Geoffray
bug:29321958 Change-Id: I28f4da56eb3e0b48721d3ac41114858bc80daadb
2016-01-20Invoke all other registered handlers only for generated code jgu21
To get more information for unhandled signals, the nested handler might be registered to kernel. This will expose an issue in some scenarios, for example mulit-thread case, because the art default handler will be replaced in kernel. To solve it, other handlers are only invoked for generated code. Change-Id: Ifa9cf4dfdd6a0ef18f88c2e2313b545d26ed826d Signed-off-by: jgu21 <jinghui.gu@intel.com>
2015-05-29Move mirror::ArtMethod to native Mathieu Chartier
Optimizing + quick tests are passing, devices boot. TODO: Test and fix bugs in mips64. Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS. Some of the savings are from removal of virtual methods and direct methods object arrays. Bug: 19264997 Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
2014-10-16Add way to ensure we are at the front of the sigaction chain Mathieu Chartier
Calling this after jni_on_load fixes the unity apps. This is not exactly correct since we may already have the following chain. Start up: Us -> debuggerd After app goes in front: App -> us -> debuggerd After we put ourself back at the front: Us -> app -> us -> app -> .... stack overflow. Bug: 17620677 Change-Id: I9183997e3d5ebd51c320b5d51425be5142e938f3 (cherry picked from commit 1f24296c7c8a6501ee2388c0d20b48f471b48660)
2014-09-10ART: Fix things for valgrind Andreas Gampe
Wire up valgrind gtests. Add valgrind-test-art-host, currently only depending on valgrind-test-art-host-gtest32. Fix an Alloc setting to allow running valgrind. Refactor the fault handler to manage (and correctly release) the handlers. Fix minor failure-case leaks exposed by tests. Failing tests: The optimizing compiler is leaking non-arena-ed structures (e.g., assembler buffers), as code generators are not destroyed. The solution has been moved to a follow-up CL. Note: All 64b tests are failing as we cannot allocate a heap. Change-Id: I7f854cfd098d9f68107ce492363e7dba9a82b9fa
2014-08-27Handle nested signals Dave Allison
This allows for signals to be raised inside the ART signal handler. This can occur when the JavaStackTraceHandler attempts to generate a stack trace and something goes wrong. It also fixes an issue where the fault manager was not being correctly shut down inside the signal chaining code. In this case the signal handler was not restored to the original. Bug: 17006816 Bug: 17133266 (cherry picked from commit fabe91e0d558936ac26b98d2b4ee1af08f58831d) Change-Id: I10730ef52d5d8d34610a5293253b3be6caf4829e
2014-08-21Fix fault handler to unregister on shutdown Dave Allison
This fixes a problem with the fault handler where it wasn't unregistering itself during shutdown of the runtime. Bug: 17133266 (cherry picked from commit e8b9afcd0cd86b8808af29a97332038aab70c604) Change-Id: I1a4ec4292ec049046dda30769265680201729efb
2014-08-07Add implicit checks for x86_64 architecture. Dave Allison
This combines the x86 and x86_64 fault handlers into one. It also merges in the change to the entrypoints for X86_64. Replaces generic instruction length calculator with one that only works with the specific instructions we use. Bug: 16256184 Change-Id: I1e8ab5ad43f46060de9597615b423c89a836035c Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
2014-07-16Revert "Revert "Revert "Revert "Add implicit null and stack checks for x86"""" Dave Allison
This reverts commit 0025a86411145eb7cd4971f9234fc21c7b4aced1. Bug: 16256184 Change-Id: Ie0760a0c293aa3b62e2885398a8c512b7a946a73
2014-07-11Revert "Revert "Revert "Add implicit null and stack checks for x86""" Nicolas Geoffray
Broke the build. This reverts commit 7fb36ded9cd5b1d254b63b3091f35c1e6471b90e. Change-Id: I9df0e7446ff0913a0e1276a558b2ccf6c8f4c949
2014-07-10Revert "Revert "Add implicit null and stack checks for x86"" Dave Allison
Fixes x86_64 cross compile issue. Removes command line options and property to set implicit checks - this is hard coded now. This reverts commit 3d14eb620716e92c21c4d2c2d11a95be53319791. Change-Id: I5404473b5aaf1a9c68b7181f5952cb174d93a90d
2014-07-10Revert "Add implicit null and stack checks for x86" Dave Allison
It breaks cross compilation with x86_64. This reverts commit 34e826ccc80dc1cf7c4c045de6b7f8360d504ccf. Change-Id: I34ba07821fc0a022fda33a7ae21850957bbec5e7
2014-07-09Add implicit null and stack checks for x86 Dave Allison
This adds compiler and runtime changes for x86 implicit checks. 32 bit only. Both host and target are supported. By default, on the host, the implicit checks are null pointer and stack overflow. Suspend is implemented but not switched on. Change-Id: I88a609e98d6bf32f283eaa4e6ec8bbf8dc1df78a
2014-06-06Reduce header files including header files. Ian Rogers
Main focus is getting heap.h out of runtime.h. Change-Id: I8d13dce8512816db2820a27b24f5866cc871a04b
2014-05-13Add Handle/HandleScope and delete SirtRef. Mathieu Chartier
Delete SirtRef and replaced it with Handle. Handles are value types which wrap around StackReference*. Renamed StackIndirectReferenceTable to HandleScope. Added a scoped handle wrapper which wraps around an Object** and restores it in its destructor. Renamed Handle::get -> Get. Bug: 8473721 Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
2014-04-01Add handler for printing java stack traces for compiled code SIGSEGV. Mathieu Chartier
Added a new FaultHandler which attempts to print a java stack trace when a SIGSEGV occurse in generated code. This should help debugging compiler and GC related heap corruption. Bug: 13725693 Bug: 12934910 Change-Id: Id54d83ea180c222eb86d449c61926e83f0b026ad
2014-03-13Implicit null/suspend checks (oat version bump) Dave Allison
This adds the ability to use SEGV signals to throw NullPointerException exceptions from Java code rather than having the compiler generate explicit comparisons and branches. It does this by using sigaction to trap SIGSEGV and when triggered makes sure it's in compiled code and if so, sets the return address to the entry point to throw the exception. It also uses this signal mechanism to determine whether to check for thread suspension. Instead of the compiler generating calls to a function to check for threads being suspended, the compiler will now load indirect via an address in the TLS area. To trigger a suspend, the contents of this address are changed from something valid to 0. A SIGSEGV will occur and the handler will check for a valid instruction pattern before invoking the thread suspension check code. If a user program taps SIGSEGV it will prevent our signal handler working. This will cause a failure in the runtime. There are two signal handlers at present. You can control them individually using the flags -implicit-checks: on the runtime command line. This takes a string parameter, a comma separated set of strings. Each can be one of: none switch off null null pointer checks suspend suspend checks all all checks So to switch only suspend checks on, pass: -implicit-checks:suspend There is also -explicit-checks to provide the reverse once we change the default. For dalvikvm, pass --runtime-arg -implicit-checks:foo,bar The default is -implicit-checks:none There is also a property 'dalvik.vm.implicit_checks' whose value is the same string as the command option. The default is 'none'. For example to switch on null checks using the option: setprop dalvik.vm.implicit_checks null It only works for ARM right now. Bumps OAT version number due to change to Thread offsets. Bug: 13121132 Change-Id: If743849138162f3c7c44a523247e413785677370