From b41a3f7b5b97400a10b7c7ab1a85ff8b7efb0dea Mon Sep 17 00:00:00 2001 From: Robert Kirkman Date: Sat, 1 Aug 2026 01:15:20 -0500 Subject: [PATCH] Added(UnixSeLinuxUtils): Add defines for `PROCESS_CONTEXT_PREFIX__RUNAS_APP` and `PROCESS_CONTEXT__KERNEL_SU` --- .../v1/unix/os/selinux/UnixSeLinuxUtils.h | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/termux-core_nos_c/tre/include/termux/termux_core__nos__c/v1/unix/os/selinux/UnixSeLinuxUtils.h b/lib/termux-core_nos_c/tre/include/termux/termux_core__nos__c/v1/unix/os/selinux/UnixSeLinuxUtils.h index d1e3382..b155745 100644 --- a/lib/termux-core_nos_c/tre/include/termux/termux_core__nos__c/v1/unix/os/selinux/UnixSeLinuxUtils.h +++ b/lib/termux-core_nos_c/tre/include/termux/termux_core__nos__c/v1/unix/os/selinux/UnixSeLinuxUtils.h @@ -82,6 +82,16 @@ extern "C" { */ #define PROCESS_CONTEXT_PREFIX__UNTRUSTED_APP_27 "u:r:untrusted_app_27:" +/** + * The process context prefix assigned to app processes + * running inside the `run-as` command from ADB or root shell. + * + * - https://cs.android.com/android/platform/superproject/+/android-13.0.0_r18:system/sepolicy/private/seapp_contexts;l=177 + * - https://cs.android.com/android/platform/superproject/+/android-13.0.0_r18:system/sepolicy/public/runas_app.te;l=1 + * - https://cs.android.com/android/platform/superproject/+/android-13.0.0_r18:system/sepolicy/private/runas_app.te + */ +#define PROCESS_CONTEXT_PREFIX__RUNAS_APP "u:r:runas_app:" + /** * The process context assigned to `root` (`0`) user processes by * AOSP, like for `adb root`. The process context always equals @@ -93,6 +103,17 @@ extern "C" { */ #define PROCESS_CONTEXT__AOSP_SU "u:r:su:s0" +/** + * The process context assigned to `root` (`0`) user processes by + * KernelSU, like for `su` commands. The process context always equals + * `u:r:ksu:s0` without any categories. + * + * - https://github.com/tiann/KernelSU + * - https://github.com/tiann/KernelSU/blob/v3.2.5/manager/app/src/main/java/me/weishu/kernelsu/Natives.kt#L29 + * - https://github.com/tiann/KernelSU/blob/v3.2.5/website/docs/guide/app-profile.md#selinux + */ +#define PROCESS_CONTEXT__KERNEL_SU "u:r:ksu:s0" + /** * The process context type assigned to `root` (`0`) user processes by * Magisk, like for `su` commands. The process context always equals