summaryrefslogtreecommitdiffstats
path: root/sigchainlib/sigchain.cc
Commit message (Collapse)AuthorAgeFilesLines
* ART: Add support for special handlers in sigchainlibAndreas Gampe2015-05-311-4/+49
| | | | | | | | | | | | | | Add support for a special managed handler in sigchainlib that will be called as the first user handler. Use this support for native bridge v2. Extend test 115-native-bridge to test the functionality. Bug: 20217701 (cherry picked from commit 03c2cc89428914adf52229d6a3867eef6127911a) Change-Id: I78cc01fbdabe169154ff6b94c9f3ddb95b5c7448
* Replace NULL with nullptrMathieu Chartier2015-04-221-6/+6
| | | | | | | Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
* Delegate SIG_DFL on sigaction to libc.Dmitriy Ivanov2015-04-031-2/+3
| | | | | | | | | | | | | In the case when user registers SIG_DFL hanlder sigchainlib's handler tends to go into infinite loop because the function handling signals resets signal using by calling to signchain's own implementation. This cl fixes the problem by passing sigcations with SIG_DFL to the next sigaction (usually libc's). Bug: 19594886 Change-Id: I9eecf9afd1c7e6d1fe3cd1d4fc506383ecbebe04
* Fix formattingDmitriy Ivanov2015-04-011-8/+8
| | | | Change-Id: Id64aad5de1f911ac7e747788d586bac397f34f18
* Fix sigchainlib's implementation of sigactionDmitriy Ivanov2015-01-061-3/+4
| | | | | | | | Correctly handles the case when old_action == new_action Bug: 18740478 Change-Id: I97092318439e4f6f0a2513d4336496c72f8c5599 (cherry picked from commit 797a29b334f2d311135602bf5204ae8b890f4a14)
* Add way to ensure we are at the front of the sigaction chainMathieu Chartier2014-10-161-4/+18
| | | | | | | | | | | | | | | | | | | 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)
* Remove libsigchain from LD_PRELOADSDmitriy Ivanov2014-10-071-10/+7
| | | | | | | | | | | | Link sigchain.cc statically with dalvikvm, app_process, surfaceflinger, dex2oat, patchoat and objdump. Replace libsigchain.so with dummy implementaions to avoid situations when it is used incorrectly. Bug: 15345057 Bug: 15426766 Change-Id: If0b7f59a59824e30aa0c33dad76c7a44932180de
* Don't call dlsym from signal context in signal chainDave Allison2014-09-161-21/+61
| | | | | | | | | | | | | | | | | | | | | It is dangerous to call dlsym from within a signal context since it takes a lock and can lead to a mutex reentry attempt if timing is bad. This change adds an initialization function to the signal chain that calls dlsym for sigaction and sigprocmask from outside the signal context (from Runtime::Init()). The results are cached in a static variable and used from within the signal context if necessary. However, tests don't necessarily call Runtime::Init() so we also need to deal with the case where the signal chain is not initialized and perform a lazy initialization from inside sigaction or sigprocmask. This is always outside a signal context since we have not initialized the runtime. Bug: 17498571 Change-Id: I59eebfc67cc91c6f1d781a73e5d432ca5269ee48
* Fix mac build and signal testDave Allison2014-08-291-0/+1
| | | | Change-Id: I58311285db9095ca6339ce29a9f15e841b7c822d
* Fix signal chain to allow for signal() call to be usedDave Allison2014-08-281-4/+52
| | | | | Bug: 17320614 Change-Id: Ia917307fb1b593644f524518e11e295b3c64be01
* Handle nested signalsDave Allison2014-08-271-5/+13
| | | | | | | | | | | | | | | | | 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
* Fix fault handler to unregister on shutdownDave Allison2014-08-211-2/+1
| | | | | | | | | | | 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
* Revert "Revert "Revert "Revert "Add implicit null and stack checks for x86""""Dave Allison2014-07-161-0/+20
| | | | | | | This reverts commit 0025a86411145eb7cd4971f9234fc21c7b4aced1. Bug: 16256184 Change-Id: Ie0760a0c293aa3b62e2885398a8c512b7a946a73
* Revert "Revert "Revert "Add implicit null and stack checks for x86"""Nicolas Geoffray2014-07-111-16/+0
| | | | | | | | Broke the build. This reverts commit 7fb36ded9cd5b1d254b63b3091f35c1e6471b90e. Change-Id: I9df0e7446ff0913a0e1276a558b2ccf6c8f4c949
* Revert "Revert "Add implicit null and stack checks for x86""Dave Allison2014-07-101-0/+16
| | | | | | | | | 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
* Merge "Revert "Add implicit null and stack checks for x86""Dave Allison2014-07-091-16/+0
|\
| * Revert "Add implicit null and stack checks for x86"Dave Allison2014-07-101-16/+0
| | | | | | | | | | | | | | | | It breaks cross compilation with x86_64. This reverts commit 34e826ccc80dc1cf7c4c045de6b7f8360d504ccf. Change-Id: I34ba07821fc0a022fda33a7ae21850957bbec5e7
* | Merge "Add implicit null and stack checks for x86"Dave Allison2014-07-091-0/+16
|\ \ | |/
| * Add implicit null and stack checks for x86Dave Allison2014-07-091-0/+16
| | | | | | | | | | | | | | | | | | | | | | 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
* | Remove incorrect check for sa_mask in signal chainingDave Allison2014-07-091-5/+0
|/ | | | | | | | | | | | This removes an incorrect check using the sa_mask field of the sigaction structure when chaining to a user's signal handler. The check prevented a user's handler being called when sa_mask was set. Thanks to primiano@ for the excellent bug report. Bug: 16005022 Change-Id: I0548003f4fc3b1889a6859091e603ead4a9b0607
* Make use of sigchainlib for signal chaining for implicit checksDave Allison2014-05-291-0/+183
This adds a preload library that overrides sigaction and sigprocmask to implement signal chaining. Signal chaining allows us to chain any signal so that the ART runtime receives it before any signal handler registered in native code by an application. If the ART signal handler doesn't want it, it will pass it on to the user's handler. ART uses signals for null pointer checks, stack overflow checks and suspend points. Also adds an OAT test to test this in isolation. Change-Id: I9545f9f7343774c091410eb810504d9855fd399f