Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c3505bf authored by Ryan Savitski's avatar Ryan Savitski
Browse files

mediaextractor: ignore platform's profiler assist signal

Due to security constraints, platform profilers that do remote stack
unwinding need the target process' cooperation. This is implemented via
a bionic signal handler.

On debug builds, media extractor can end up being targeted by such
system-wide profiling, which can crash the process due to
seccomp/minijail (specifically, due to sendmsg that is used for sending
file descriptors over a unix socket).

Tested: synced updated binary to crosshatch-userdebug, confirmed that
        sending signal 36 with si_val 1 doesn't crash mediaextractor.
Bug: 149328505
Change-Id: Idf34e08edf99a82c72146aebeb5e46e5cf5af2f3
parent 74773d73
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@ cc_binary {
        "liblog",
        "libavservices_minijail",
    ],
    header_libs: [
        "bionic_libc_platform_headers",
    ],
    target: {
        android: {
            product_variables: {
+6 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
#include <android-base/properties.h>
#include <utils/misc.h>

#include <bionic/reserved_signals.h>

// from LOCAL_C_INCLUDES
#include "MediaExtractorService.h"
#include "MediaUtils.h"
@@ -49,6 +51,10 @@ int main(int argc __unused, char** argv)

    signal(SIGPIPE, SIG_IGN);

    // Do not assist platform profilers (relevant only on debug builds).
    // Otherwise, the signal handler can violate the seccomp policy.
    signal(BIONIC_SIGNAL_PROFILER, SIG_IGN);

    //b/62255959: this forces libutis.so to dlopen vendor version of libutils.so
    //before minijail is on. This is dirty but required since some syscalls such
    //as pread64 are used by linker but aren't allowed in the minijail. By