diff options
Diffstat (limited to 'libc')
| -rw-r--r-- | libc/bionic/android_profiling_dynamic.cpp | 8 | ||||
| -rw-r--r-- | libc/platform/bionic/reserved_signals.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/libc/bionic/android_profiling_dynamic.cpp b/libc/bionic/android_profiling_dynamic.cpp index 54f896c706..9d92a6dfe6 100644 --- a/libc/bionic/android_profiling_dynamic.cpp +++ b/libc/bionic/android_profiling_dynamic.cpp @@ -63,6 +63,14 @@ __LIBC_HIDDEN__ void __libc_init_profiling_handlers() { action.sa_flags = SA_SIGINFO | SA_RESTART; action.sa_sigaction = HandleProfilingSignal; sigaction(BIONIC_SIGNAL_PROFILER, &action, nullptr); + + // The perfetto_hprof ART plugin installs a signal handler to handle this signal. That plugin + // does not get loaded for a) non-apps, b) non-profilable apps on user. The default signal + // disposition is to crash. We do not want the target to crash if we accidentally target a + // non-app or non-profilable process. + // + // This does *not* get run for processes that statically link libc, and those will still crash. + signal(BIONIC_SIGNAL_ART_PROFILER, SIG_IGN); } static void HandleSigsysSeccompOverride(int, siginfo_t*, void*); diff --git a/libc/platform/bionic/reserved_signals.h b/libc/platform/bionic/reserved_signals.h index 3c5bc02bf5..c90fc0698c 100644 --- a/libc/platform/bionic/reserved_signals.h +++ b/libc/platform/bionic/reserved_signals.h @@ -47,8 +47,10 @@ // If you change this, also change __ndk_legacy___libc_current_sigrtmin // in <android/legacy_signal_inlines.h> to match. +#define BIONIC_SIGNAL_POSIX_TIMERS (__SIGRTMIN + 0) #define BIONIC_SIGNAL_DEBUGGER (__SIGRTMIN + 3) #define BIONIC_SIGNAL_PROFILER (__SIGRTMIN + 4) +#define BIONIC_SIGNAL_ART_PROFILER (__SIGRTMIN + 6) #define BIONIC_SIGNAL_FDTRACK (__SIGRTMIN + 7) #define __SIGRT_RESERVED 8 |
