From 926f753e201d24f103947c1c9fa91eda5ea0060a Mon Sep 17 00:00:00 2001 From: Ray Essick Date: Fri, 18 Mar 2022 20:19:45 -0700 Subject: [PATCH] Symbolic constants for older minijails Inline definitions of a few constants that don't appear on Q/R devices, so that this works for us in mainline modules that are loaded on those older devices. Bug: 225406881 Test: boot on Q, watch logcat Test: boot on R, watch logcat Change-Id: Ic5781976d4c1e2d16e230c015fc49d9fde74e289 --- debuggerd/seccomp_policy/crash_dump.arm64.policy | 2 +- debuggerd/seccomp_policy/crash_dump.policy.def | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/debuggerd/seccomp_policy/crash_dump.arm64.policy b/debuggerd/seccomp_policy/crash_dump.arm64.policy index 4e8fdf9fb..8241f0ee4 100644 --- a/debuggerd/seccomp_policy/crash_dump.arm64.policy +++ b/debuggerd/seccomp_policy/crash_dump.arm64.policy @@ -25,7 +25,7 @@ tgkill: 1 rt_sigprocmask: 1 rt_sigaction: 1 rt_tgsigqueueinfo: 1 -prctl: arg0 == PR_GET_NO_NEW_PRIVS || arg0 == 0x53564d41 || arg0 == PR_PAC_RESET_KEYS || arg0 == PR_GET_TAGGED_ADDR_CTRL || arg0 == PR_PAC_GET_ENABLED_KEYS +prctl: arg0 == PR_GET_NO_NEW_PRIVS || arg0 == 0x53564d41 || arg0 == PR_PAC_RESET_KEYS || arg0 == 56 || arg0 == 61 madvise: 1 mprotect: arg2 in 0x1|0x2 munmap: 1 diff --git a/debuggerd/seccomp_policy/crash_dump.policy.def b/debuggerd/seccomp_policy/crash_dump.policy.def index 4eb996eb2..0cb8e081d 100644 --- a/debuggerd/seccomp_policy/crash_dump.policy.def +++ b/debuggerd/seccomp_policy/crash_dump.policy.def @@ -34,7 +34,15 @@ rt_sigprocmask: 1 rt_sigaction: 1 rt_tgsigqueueinfo: 1 +// this is referenced from mainline modules running on Q devices, where not all +// of the constants used here are defined in headers, so minijail rejects them. +// we define them here to avoid those errors. + // constants introduced in R #define PR_SET_VMA 0x53564d41 +#define PR_GET_TAGGED_ADDR_CTRL 56 + // constants introduced in S +#define PR_PAC_GET_ENABLED_KEYS 61 + #if defined(__aarch64__) // PR_PAC_RESET_KEYS happens on aarch64 in pthread_create path. prctl: arg0 == PR_GET_NO_NEW_PRIVS || arg0 == PR_SET_VMA || arg0 == PR_PAC_RESET_KEYS || arg0 == PR_GET_TAGGED_ADDR_CTRL || arg0 == PR_PAC_GET_ENABLED_KEYS