summaryrefslogtreecommitdiff
path: root/runtime/fault_handler.cc
Commit message (Collapse)AuthorAgeFilesLines
* Do a null check on the OatQuickMethodHeader.Nicolas Geoffray2020-11-271-0/+5
| | | | | | | | | | | Even if we found a method at the bottom of the stack, we may be executing something unrelated to it. That's when GetOatQuickMethodHeader will return null. So do a null check and return if we did not find any compiled code. Test: build Bug: 173753901 Change-Id: I05595d601e0523b1254581c306b157b273828c53
* Helpers and refactorings to prepare for interpreter optimizations (x64)Nicolas Geoffray2019-12-041-3/+14
| | | | | | | | | | | | - 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
* ART: Remove setjmp.h includesAndreas Gampe2018-11-211-1/+0
| | | | | | | | We are not using jmpbuf and co. Bug: 119869270 Test: m Change-Id: I85993e2ce506b059801d8d8da8b440e93ee9e3fd
* Fix mac build (hopefully)Mathieu Chartier2018-07-221-1/+1
| | | | | | | | Add a Ptr() for SafeGetDeclaringClass Test: untested Change-Id: Id949a36e081e9a7b226ae84b2693307a23c8bbc7
* ObjPtr<>-ify ArtMethod and mirror::Method.Vladimir Marko2018-07-191-1/+1
| | | | | | | | | And clean up some forgotten things after old CLs. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 31113334 Change-Id: I8af0e845c24d674d0efab21d80c29949b1cc0593
* Ensure that art_sigsegv_fault is never inlinedAlex Light2018-04-031-1/+3
| | | | | | | | | | | | | We were incorrectly inlining the art_sigsegv_fault function into FaultManager::HandleFault. This is a problem because we want native debuggers to break on this function instead of stopping on SIGSEGV, since we use those for various internal functions. By setting the art_sigsegv_fault function to be NO_INLINE we should not have this problem. Test: Manual inspection of libart.so Bug: 77528455 Change-Id: I77753cf79966011d7bfbea056bb4efc3f55d64df
* Extend VLOG(signals) to be more useful.Alex Light2018-02-021-1/+25
| | | | | | | | | -verbose:signals was pretty useless because it didn't tell you much about what the signal being examined actually was. Extend HandleFault logging to include details about the signal being handled. Test: ./test/run-test --runtime-option -verbose:signals --host --dev 983 Change-Id: I78baca685623c6b37f8148d6eeb2614c38fdfa69
* Fix misc issues with non-generated-code fault handlersAlex Light2018-01-171-7/+7
| | | | | | | | | | | | | We had a few issues preventing the use of FaultHandler with non-generated code. The first was we would only call these handlers in generated code. The second is that we would segfault if we tried to remove any of them due to an typo'd iterator name. Added a test that this all works. Test: ./test.py --host -j50 Bug: 72064989 Change-Id: I0d4d5235ac7c1c165a4a14dfbda72ef7060772f3
* Create dex subdirectoryDavid Sehr2018-01-051-1/+1
| | | | | | | | | Move all the DexFile related source to a common subdirectory dex/ of runtime. Bug: 71361973 Test: make -j 50 test-art-host Change-Id: I59e984ed660b93e0776556308be3d653722f5223
* ART: Remove base/logging from heap-inl.hAndreas Gampe2017-12-071-0/+1
| | | | | | | | Hide the single uncommon VLOG and remove the include. Fix up transitive includes. Test: m Change-Id: I917df597cb62c57040c1fb0e0079df4d95e5a658
* ART: Move kDexNoIndex to dex_file_types.hAndreas Gampe2017-09-181-1/+2
| | | | | | | | Define the constant with the types to allow lowering the dependency on DexFile. Test: m Change-Id: I3c61421db45be96d2057e01b1a7825883d8bd178
* Use HeapReference for SafeGetClassMathieu Chartier2017-08-091-2/+1
| | | | | | | | | | | Make sure to use heap refernece here so the value read isn't bogus for heap poisoning. Fixes heap poisoning tests that were broken for implicit null checks. Bug: 31023171 Test: test/testrunner/testrunner.py --interpreter --optimizing -j20 --host --verbose Change-Id: Ia67cdb304be205773d781251235f8b0b4bf7c0bd
* Don't use fences to implement volatilesHans Boehm2017-08-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mixing the fence-based implementation with acquire/release instructions on ARMv8 is not just ugly but incorrect. A volatile store; volatile load sequence implemented as a release store followed by ld; dmb does not prevent reordering. This should remove the last places we were using fences to implement volatiles. The HeapReference representation is changed to be an Atomic, thereby avoiding many casts. We no longer inherit from ObjectReference, which was documented to be a value type. HeapReference is not, since it contains an atomic. Disentangle HeapReference and ObjectReference/CompressedReference uses sufficiently to get the code to compile again. They were previously used somewhat interchangably in a few places, in spite of the different intended semantics (value-type vs. a concurrently- updateable field). Further disentanglement might be useful. Flag a strange fence use I haven't yet understood. Test: Booted AOSP. Ran default tests. Some object code inspection. Bug: 31023171 Test: Built AOSP Change-Id: I7b3c3e624f480994541c8e3a79e585071c122a3d
* ART: Introduce thread-current-inl.hAndreas Gampe2017-06-021-1/+1
| | | | | | | | | | | Factor out Thread::Current() code into its own -inl file to remove transitive includes. This requires at the same time correcting mutex.h, i.e., moving some functions into mutex-inl.h. Test: m test-art-host Change-Id: I88f888b604e0897368d9b483edce6ce4332dd9c9
* sigchain: limit use of SetHandlingSignal.Josh Gao2017-05-151-1/+15
| | | | | | | | | | | | | | | | | | | | | The native bridge and user signal handlers are able to not return to our signal handler, leaving the HandlingSignal flag set to true for the rest of the lifetime of the thread. Fix this by only using SetHandlingSignal for handlers that we know will return (i.e. the ART fault handler). This effectively reverts commit 90444558, which means sigprocmask's behavior is back to filtering out claimed signals when inside a user signal handler. Include an update to test/115-native-bridge from Zhenhua Wang, to make sure we keep handling signals when a signal handler longjmps away instead of returning. Bug: http://b/37988407 Test: m test-art-host Test: m test-art-target Change-Id: Ia7159ddfa38f1f055e5cd6089c849a208d335752
* Fix fault_handler with heap poisoning.Nicolas Geoffray2017-04-201-1/+2
| | | | | test: test-art-host Change-Id: Ifeb3d5ff4cfdcb703d5874bca90c9c1438d86f08
* fault_handler: hopefully fix darwin build.Josh Gao2017-04-191-2/+3
| | | | | Test: none Change-Id: I08adf266c6287a289d213a0b1fa854f223fec72d
* fault_handler: use SafeCopy to verify the validity of ArtMethod.Josh Gao2017-04-191-4/+79
| | | | | | | | | | Reimplement ArtMethod::GetDeclaringClassUnchecked and VerifyClassClass in terms of SafeCopy, to be able to safely verify the validity of putative ArtMethods in FaultManager::IsInGeneratedCode. Bug: http://b/30836730 Test: m test-art-host Change-Id: Ie3d5e176ea569cedcefd320e2480a1e1e496a53a
* Revert^2: "Make sigchain actually own the signal chain.""Josh Gao2017-03-231-108/+23
| | | | | | | | | This reverts commit 33dca562d5ed9f52f63ced2334c066333ca073e9. Bug: http://b/36205469 Bug: http://b/36262089 Original-Change-Id: I416b13de800d3e23424cf20688ccfd7e4e48a111 Change-Id: I1267be72c32ed73d1079a572d0b8907556526dde
* Revert "Make sigchain actually own the signal chain."Jin Qian2017-03-181-23/+108
| | | | | | This reverts commit 7600fa9234e02cf5108a3a82babf3d3ab82fcddd. Change-Id: Ia46db2a7df0c0ac07107a8db06f42ff1afd4a97e
* Make sigchain actually own the signal chain.Josh Gao2017-03-171-108/+23
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Catch signals that happen inside a fault handler.Josh Gao2017-03-081-151/+66
| | | | | | | | | | | | | | | | 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
* ART: Use libbase loggingAndreas Gampe2016-09-261-1/+1
| | | | | | | | | | | | | | | | | | | Move most of our logging infrastructure over to system/core/base. Retain VLOG. Using unified Android infrastructure has two main advantages. First, it reduces the complexity/maintenance burden in ART. Second, it allows to detach logging for the cases where we do not want or need a runtime, e.g., dexdump, the disassembler, etc. As a part of the latter, libbase is also supported for all hosts (including Windows). From a developer viewpoint, there are minor behavior changes for the LOG statements (see above), but otherwise usage is the same. Explicit severity enum items are in the android::base namespace now. Bug: 31338270 Test: m test-art-host Change-Id: I5abcb2f45f5b03d49951874c48544f72a283a91b
* ART: Convert pointer size to enumAndreas Gampe2016-08-011-1/+1
| | | | | | | | | Move away from size_t to dedicated enum (class). Bug: 30373134 Bug: 30419309 Test: m test-art-host Change-Id: Id453c330f1065012e7d4f9fc24ac477cc9bb9269
* ART: Fast-fail empty other handlers in fault handlingAndreas Gampe2016-04-181-0/+4
| | | | | | | | | | | Don't try to set up the nested handler environment if there are no other handlers installed. Stop-gap for the current setup without other handlers. There are a myriad more issues before we can safely re-enable other handlers. Bug: 28245957 Change-Id: I526aef82aa1ca2b6c4b1959858fe76231bc067d9
* Add read barrier option to UpdateEntrypointsMathieu Chartier2016-02-011-1/+1
| | | | | | | Also call this without read barrier for image relocation. Bug: 26786304 Change-Id: Ia718c1491b54cadb7283c62afc1eb9031a15b4ef
* Invoke all other registered handlers only for generated codejgu212016-01-201-36/+41
| | | | | | | | | | | 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>
* Remove ArtCode.Nicolas Geoffray2015-10-201-4/+4
| | | | | | | | | | | | | | | | | - Instead use OatQuickMethodHeader. - Various cleanups now that we don't have all those ArtMethod -> ArtCode -> OatQuickMethodHeader indirections. As a consequence of this cleanup, exception handling got a bit faster. ParserCombinators benchmark (exception intensive) on x64: (lower is better) Before: ParserCombinators(RunTime): 1062500.0 us. After: ParserCombinators(RunTime): 833000.0 us. Change-Id: Idac917b6f1b0dc254ad68fb3781cd61bccadb0f3
* Use ATTRIBUTE_UNUSED more.Roland Levillain2015-10-151-2/+1
| | | | | | Use it in lieu of UNUSED(), which had some incorrect uses. Change-Id: If247dce58b72056f6eea84968e7196f0b5bef4da
* Add an abstraction over a compiled code.Nicolas Geoffray2015-10-131-4/+6
| | | | | | | | That's just step 1, moving code-related functions of ArtMethod to another class. That class is only a wrapper on an ArtMethod, but will be changed to be a wrapper around compiled code. Change-Id: I6f35fc06d37220558dff61691e51ae20066b0dd6
* ART: Rename ArtMethod's size and alignment methods.Vladimir Marko2015-08-171-1/+1
| | | | | | | Remove the historical prefix "Object" to avoid confusion with Java objects. Change-Id: Ib36422c9a24878d8d4bd757977d99cbf66b3d567
* Use (D)CHECK_ALIGNED more.Roland Levillain2015-07-161-1/+1
| | | | Change-Id: I9d740f6a88d01e028d4ddc3e4e62b0a73ea050af
* Revert "Revert "Remove interpreter entrypoint in ArtMethod.""Nicolas Geoffray2015-07-081-2/+4
| | | | | | | | | | | The start of the interned strings in the image was not aligned properly, now that ArtMethods just need to be word aligned. This reverts commit 7070ccd8b6439477eafeea7ed3736645d78e003f. bug:22242193 Change-Id: I580c23310c33c239fe0e5d15c72f23a936f58ed1
* Revert "Remove interpreter entrypoint in ArtMethod."Nicolas Geoffray2015-07-081-4/+2
| | | | | | | | Build failures on bots. Investigating. This reverts commit fa2c054b28d4b540c1b3651401a7a091282a015f. Change-Id: Id65b2009aa66cb291fb8c39758a58e0b0d22616c
* Remove interpreter entrypoint in ArtMethod.Nicolas Geoffray2015-07-081-2/+4
| | | | | | Saves 4/8 bytes for each ArtMethod. Change-Id: I110ecdddf8516b0759a31fa157609643e6d60b15
* Fix lint error.Narayan Kamath2015-06-171-5/+1
| | | | | | Blank line at the start of a code block. Change-Id: Ifc0d78acc8b2eecbdc1a340009757f9218ce2c5c
* Set default visibility on art_sigsegv_fault.Oleksiy Vyalov2015-06-171-0/+2
| | | | | | | | | | | | | | | libart.so is built with flag -fvisibility=protected which complicates setting breakpoints on art_sigsegv_fault. According to the GCC manual "Protected visibility indicates that the symbol will be placed in the dynamic symbol table, but that references within the defining module will bind to the local symbol.". This implies that a breakpoint on a protected symbol will not be hit. Without this change gdbclient with ART debugging enabled doesn't break at art_sigsegv_fault as expected. Change-Id: Ib73344e710966eddf55a6facb29558504a511f00
* Move mirror::ArtMethod to nativeMathieu Chartier2015-05-291-13/+7
| | | | | | | | | | | | | 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
* More of the concurrent copying collector.Hiroshi Yamauchi2015-01-231-2/+2
| | | | | Bug: 12687968 Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
* Merge "Fix fault handler invoked before vm running."Christopher Ferris2014-12-021-0/+6
|\
| * Fix fault handler invoked before vm running.Christopher Ferris2014-11-201-0/+6
| | | | | | | | | | | | | | | | If the ART fault handler is invoked before the vm is running, the code derefences a NULL pointer. In this case, just invoke the next handler in the chain instead. Change-Id: I58f0493eae1825d7a92a1e052c88e80527914dba
* | Fix oatdump to use OatHeader pointer sizeMathieu Chartier2014-11-211-1/+2
|/ | | | | | | Bug: 18473190 Change-Id: If505b4f62105899f4f1257d3bccda3e6eb0dcd7c (cherry picked from commit c934e483ceabbd589422beea1fa35f5182ecfa99)
* Don't try to handle nested SIGSEGV inside fault handler.Ian Rogers2014-11-111-15/+34
| | | | | | | | | Trying to handle nested SIGSEGV in the fault handler leads to infinite signals and retrying if the cause of the SIGSEGV was a lack of stack space. This can lead to applications not chaining through to debuggerd and dying. Bug: 18330119 Change-Id: Iadcffe0fa0e55d783b84a06504bbd9d181e641e4
* Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers2014-11-031-1/+1
| | | | | | | | | | | Fix associated errors about unused paramenters and implict sign conversions. For sign conversion this was largely in the area of enums, so add ostream operators for the effected enums and fix tools/generate-operator-out.py. Tidy arena allocation code and arena allocated data types, rather than fixing new and delete operators. Remove dead code. Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
* Refactor quick entrypointsIan Rogers2014-10-201-1/+1
| | | | | | | | | | | Remove FinishCalleeSaveFrameSetup. Assembly routines write down anchor into TLS as well as placing runtime method in callee save frame. Simplify artSet64InstanceFromCode by not computing the referrer from the stack in the C++ code. Move assembly offset tests next to constant declaration and tidy arch_test. Change-Id: Iededeebc05e54a1e2bb7bb3572b8ba012cffa1c8
* Add way to ensure we are at the front of the sigaction chainMathieu Chartier2014-10-161-7/+19
| | | | | | | | | | | | | | | | | | | 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)
* ART: Fix things for valgrindAndreas Gampe2014-09-101-3/+15
| | | | | | | | | | | | | | | | | | | | | | 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
* Fix arm64 build warning (promoted to error).Dave Allison2014-09-041-10/+10
| | | | | | This refactors code that caused an warning on the arm64 build. Change-Id: I1c0ddabb7061ea289d98b03554bf764c26256078
* Make nested signal more genericDave Allison2014-09-041-74/+78
| | | | | | | | | This moves the nested signal catching code up to a slightly higher level in the fault manager. Originally it was down in the DumpJavaStack function but it needs to be up in the caller of that to allow for other handlers like the stack dumper. Change-Id: I31029f555dd9b501f4b5c0ed5c95777004873126
* Handle nested signalsDave Allison2014-08-271-12/+139
| | | | | | | | | | | | | | | | | 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