Repository navigation
Conversation
This was deliberately not done because app cannot run custom code from isolated processes forked from webview zygote. However, hidepid=2 is broken for android again. In 2020, Jann Horn discovered that when zygote forks and specializes to app zygote, process groups are not cleaned. This makes app zygote and its child have AID_READPROC and bypass hidepid=2. This was marked as CVE-2020-0257 and fixed in 2020-08-01. However, it is ignored that isolated process can get directly forked from zygote while no app zygote fork is needed. So isolated_app context process still may have AID_READPROC, which provides a way to bypass the hidepid=2 restrictions on /proc. The impact is limited by SELinux because isolated_app does not have mlstrustedsubject. But it can still read cmdline, comm, maps, mountinfo etc of other isolated processes, mainly webview sandboxed processes. Bangcle, a famous commercial app protection service in China, started to make use of this recently. An isolated process is forked and iterates through all pids, trying to open their mountinfo. This is no doubt an exploit (almost same with CVE-2020-0257) and we have already reported it to Google. Before Google fixes it, we have no way but unmount anything for webview zygote. This is expected to break some font modules aimed at webview, but we have no choice.
|
Open for discussion. I cannot think of a better idea. |
There was a problem hiding this comment.
Pull request overview
Introduces a new kernel/userspace/Manager feature flag to unmount module mount points from the WebView zygote (and thereby prevent mountinfo leaks to isolated WebView sandbox processes), addressing a hidepid=2 bypass scenario described in the PR.
Changes:
- Add
KSU_FEATURE_WEBVIEW_ZYGOTE_UMOUNT(ID=5) to the shared UAPI and wire it through ksud feature config/CLI. - Expose a new toggle in the Android Manager (UI + repository + JNI bridge) for enabling/disabling the feature.
- Update kernel umount policy to optionally umount for
WEBVIEW_ZYGOTE_UIDbased on the new feature.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| userspace/ksud/src/feature.rs | Adds new FeatureId mapping/name/description and includes it in list/save paths. |
| userspace/ksud/src/cli.rs | Updates CLI help text to include webview_zygote_umount. |
| uapi/feature.h | Adds KSU_FEATURE_WEBVIEW_ZYGOTE_UMOUNT = 5 to the feature ID enum. |
| manager/app/src/main/res/values/strings.xml | Adds English UI strings for the new WebView zygote umount setting. |
| manager/app/src/main/res/values-zh-rCN/strings.xml | Adds Simplified Chinese UI strings for the new setting. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/SettingsViewModel.kt | Loads and toggles the new feature in settings state. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/screen/settings/SettingsUiState.kt | Adds UI state fields + action callback for the new setting. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/screen/settings/SettingsScreen.kt | Wires the new action from screen to ViewModel. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/screen/settings/SettingsMiuix.kt | Adds a switch preference for the new feature in MIUIX UI. |
| manager/app/src/main/java/me/weishu/kernelsu/ui/screen/settings/SettingsMaterial.kt | Adds a segmented switch item for the new feature in Material UI. |
| manager/app/src/main/java/me/weishu/kernelsu/Natives.kt | Adds JNI-backed native methods for getting/setting the new feature. |
| manager/app/src/main/java/me/weishu/kernelsu/data/repository/SettingsRepositoryImpl.kt | Implements status/get/set plumbing for the new feature. |
| manager/app/src/main/java/me/weishu/kernelsu/data/repository/SettingsRepository.kt | Extends repository interface with the new feature APIs. |
| manager/app/src/main/cpp/ksu.h | Declares new C++ bridge functions for the feature. |
| manager/app/src/main/cpp/ksu.cc | Implements get/set via get_feature/set_feature for the new feature ID. |
| manager/app/src/main/cpp/jni.cc | Exposes the new native methods to Kotlin via JNI. |
| kernel/policy/allowlist.c | Switches WEBVIEW_ZYGOTE_UID umount decision to be feature-controlled. |
| kernel/feature/kernel_umount.h | Declares ksu_is_webview_zygote_umount_enabled(). |
| kernel/feature/kernel_umount.c | Adds the new feature handler, state, and enables umount handling for the WebView zygote UID. |
Suppressed comments (1)
kernel/feature/kernel_umount.c:122
ksu_handle_umount()readsksu_kernel_umount_enabledwithoutREAD_ONCE(), but the flag can be updated concurrently via the feature set handler. This can trigger KCSAN data-race reports; useREAD_ONCE()here as well.
// 4. Webview zygote forked from zygote: zygote -> webview_zygote (controlled by feature policy)
// 5. Isolated process forked from app zygote: appuid -> isolated_process (already handled by 3)
// 6. Isolated process forked from webview zygote (already handled by 4)
if (!is_appuid(new_uid) && new_uid != WEBVIEW_ZYGOTE_UID && !is_isolated_process(new_uid)) {
return 0;
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This reverts commit 1430cdb. tiann#3630
This reverts commit 1430cdb. tiann#3630
This reverts commit 1430cdb. tiann#3630
This reverts commit 1430cdb. tiann#3630
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
$ git log --pretty=%s upstream/main..HEAD --reverse manager: keep api 29 support manager: QOL manager: restore api 26 support manager: fix search bar focus bug on Android 8 manager: Adjust for Android v7.1 support (backslashxx#31) manager: fixup updates workflows: debloat dummy.keystore ksud: add armeabi-v7a support workflows: scripts: workaround armv7/a triple mismatch kernel: kernel: prepare for legacy support kernel: uapi: fix portability kernel: build: migrate to unity build kernel: external: import oss libraries kernel: downstream: provide common helpers kernel: app_profile: add 32-bit KSU_NO_NEW_PRIVS tif support kernel: init lsm_hook infrastructure kernel: lsm_hook: introduce selinux_ops LSM tampering for < 4.2 kernel: lsm_hook: introduce ARM64 branch patching for 6.8+ kernel: pkg_observer: initialize for downstream kernel: setuid_hook: disable seccomp for manager and allowed uids kernel: app_profile: adapt disable_seccomp to legacy kernel: selinux/sepolicy: handle selinux policydb backports kernel: selinux/sepolicy: abstract avtab slot access for compat kernel: selinux/rules: backport handle_sepolicy to legacy policydb kernel: selinux/rules: Pin task to current CPU to avoid cross-CPU rwlock release kernel: supercall: provide sys_reboot handler kernel: supercalls: tweak sys_reboot fd install kernel: adapt "namespace support" feature to old kernels kernel: allowlist: always allow shell for su on CONFIG_KSU_DEBUG kernel: file_wrapper: handle anon_inode_getfile for old kernels kernel: supercalls: partial backport of do_manage_mark kernel: compat: screw path_umount backport, call sys_umount directly kernel: app_profile: shim escape_with_root_profile kernel: throne_tracker: fixup deadlocks on iterate_dir kernel: throne_tracker: offload to kthread (tiann#2632) kernel: allowlist: escape allowlist handling to kthread kernel: ksud/lsm_hook: migrate ksu_install_rc_hook to security_file_permission LSM kernel: ksud: read: add fallback to /init.rc kernel: ksud: handle newfstat init_rc size injection kernel: ksud: handle early newfstat module_rc size injection kernel: ksud: wire up jump_label on vfs_read controlled hooks kernel: ksud: read: move second stage apply on read hook kernel: ksud: read: grab init_session_keyring on read hook kernel: ksud: replace input hook with an input handler kernel: sucompat: squash reworked sucompat changes kernel: lsm_hook: bprm: escape init ksud call to root for 3.x kernel: lsm_hook: bprm: escape init ksud call to root for < 4.14 kernel: ksud: spit a kthread as unhook watchdog kernel: file_wrapper: handle more compat kernel: file_wrapper: handle readdir and iterate compat for UL kernel: syscall_table_hook: introduce syscall table tampering kernel: sucompat: wire up sys_call_table unhooking kernel: sucompat: wire up jump label for sucompat unhooking kernel: kp_ksud: restore kprobes for early-boot and used-once hooks kernel: branch_link_hook: introduce arm64 branch link callsite hijacking kernel: feature: sulog: adjust for downstream kernel: feature: adbroot: adjust for downstream kernel: feature: wire up a smaller selinux_hide implementation kernel: lsm_hook: wire up setprocattr lsm hack for selinux_hide kernel: supercalls: expose ksu_set_manager_appid to sys_reboot kernel: supercalls: allow userspace to pull list entries (tiann#3040) kernel: tiny_sulog: basic ringbuffer, timestamped su log kernel: supercalls: expose ksuver override kernel: supercalls: expose spoof uname function to userspace kernel: supercalls: expose ksuflags override kernel: apk_sign: migrate generic_file_llseek -> vfs_llseek kernel: throne_tracker: resolve s_magic for < 3.9 kernel: ksud: handle conditional read_iter requirement for < 3.16 kernel: throne_tracker: handle filldir_t ABI mismatch on <= 3.18 kernel: sucompat: bruteforce writeable stack from start_stack for < 3.8 kernel: compat: no ext4_unregister_sysfs, no problem kernel: compat: provide proper strscpy/_pad routines kernel: compat: d_is_reg to S_ISREG kernel: compat: handle alloc_uid for < 3.5 kernel: compat: iterate_dir -> vfs_readdir compat for < 3.11 kernel: compat: provide bin2hex compat for < 3.18 kernel: compat: file_inode compat for < 3.9 kernel: compat: provide selinux_inode/selinux_cred wrappers for < 5.1 kernel: compat: no-op groups_sort if unavailable kernel: compat: define U16_MAX if absent kernel: compat: fix sulog/adbroot compile for legacy kernel: compat: inline newer kernel_read / kernel_write for < 4.14 kernel: apk_sign, throne_tracker: heap-ify search_manager/check_block kernel: compat: handle UL compat for refactored allowlist kernel: apk_sign: add more size/hash pairs HACK: kernel: bypass tf out of uid_t/gid_t strict type checks kernel: build: sucompat: inline fns on non-manual hook methods kernel: build: restore LKM support kernel: ksu: printout quirks / backports / etc on init workflows: restore ksuinit+lkm workflow ksuinit: use mount api Reapply: "refactor(kernel): Perform umount for webview zygote (tiann#3630)" KernelSU v3.2.5+ Commits on top of upstream: 95 Warning: Managers built from this repo has a known keystore. See dummy.keystore. Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
$ git log --pretty=%s upstream/main..HEAD --reverse manager: keep api 29 support manager: QOL manager: restore api 26 support manager: fix search bar focus bug on Android 8 manager: Adjust for Android v7.1 support (#31) manager: fixup updates workflows: debloat dummy.keystore ksud: add armeabi-v7a support workflows: scripts: workaround armv7/a triple mismatch kernel: kernel: prepare for legacy support kernel: uapi: fix portability kernel: build: migrate to unity build kernel: external: import oss libraries kernel: downstream: provide common helpers kernel: app_profile: add 32-bit KSU_NO_NEW_PRIVS tif support kernel: init lsm_hook infrastructure kernel: lsm_hook: introduce selinux_ops LSM tampering for < 4.2 kernel: lsm_hook: introduce ARM64 branch patching for 6.8+ kernel: pkg_observer: initialize for downstream kernel: setuid_hook: disable seccomp for manager and allowed uids kernel: app_profile: adapt disable_seccomp to legacy kernel: selinux/sepolicy: handle selinux policydb backports kernel: selinux/sepolicy: abstract avtab slot access for compat kernel: selinux/rules: backport handle_sepolicy to legacy policydb kernel: selinux/rules: Pin task to current CPU to avoid cross-CPU rwlock release kernel: supercall: provide sys_reboot handler kernel: supercalls: tweak sys_reboot fd install kernel: adapt "namespace support" feature to old kernels kernel: allowlist: always allow shell for su on CONFIG_KSU_DEBUG kernel: file_wrapper: handle anon_inode_getfile for old kernels kernel: supercalls: partial backport of do_manage_mark kernel: compat: screw path_umount backport, call sys_umount directly kernel: app_profile: shim escape_with_root_profile kernel: throne_tracker: fixup deadlocks on iterate_dir kernel: throne_tracker: offload to kthread (tiann#2632) kernel: allowlist: escape allowlist handling to kthread kernel: ksud/lsm_hook: migrate ksu_install_rc_hook to security_file_permission LSM kernel: ksud: read: add fallback to /init.rc kernel: ksud: handle newfstat init_rc size injection kernel: ksud: handle early newfstat module_rc size injection kernel: ksud: wire up jump_label on vfs_read controlled hooks kernel: ksud: read: move second stage apply on read hook kernel: ksud: read: grab init_session_keyring on read hook kernel: ksud: replace input hook with an input handler kernel: sucompat: squash reworked sucompat changes kernel: lsm_hook: bprm: escape init ksud call to root for 3.x kernel: lsm_hook: bprm: escape init ksud call to root for < 4.14 kernel: ksud: spit a kthread as unhook watchdog kernel: file_wrapper: handle more compat kernel: file_wrapper: handle readdir and iterate compat for UL kernel: syscall_table_hook: introduce syscall table tampering kernel: sucompat: wire up sys_call_table unhooking kernel: sucompat: wire up jump label for sucompat unhooking kernel: kp_ksud: restore kprobes for early-boot and used-once hooks kernel: branch_link_hook: introduce arm64 branch link callsite hijacking kernel: feature: sulog: adjust for downstream kernel: feature: adbroot: adjust for downstream kernel: feature: wire up a smaller selinux_hide implementation kernel: lsm_hook: wire up setprocattr lsm hack for selinux_hide kernel: supercalls: expose ksu_set_manager_appid to sys_reboot kernel: supercalls: allow userspace to pull list entries (tiann#3040) kernel: tiny_sulog: basic ringbuffer, timestamped su log kernel: supercalls: expose ksuver override kernel: supercalls: expose spoof uname function to userspace kernel: supercalls: expose ksuflags override kernel: apk_sign: migrate generic_file_llseek -> vfs_llseek kernel: throne_tracker: resolve s_magic for < 3.9 kernel: ksud: handle conditional read_iter requirement for < 3.16 kernel: throne_tracker: handle filldir_t ABI mismatch on <= 3.18 kernel: sucompat: bruteforce writeable stack from start_stack for < 3.8 kernel: compat: no ext4_unregister_sysfs, no problem kernel: compat: provide proper strscpy/_pad routines kernel: compat: d_is_reg to S_ISREG kernel: compat: handle alloc_uid for < 3.5 kernel: compat: iterate_dir -> vfs_readdir compat for < 3.11 kernel: compat: provide bin2hex compat for < 3.18 kernel: compat: file_inode compat for < 3.9 kernel: compat: provide selinux_inode/selinux_cred wrappers for < 5.1 kernel: compat: no-op groups_sort if unavailable kernel: compat: define U16_MAX if absent kernel: compat: fix sulog/adbroot compile for legacy kernel: compat: inline newer kernel_read / kernel_write for < 4.14 kernel: apk_sign, throne_tracker: heap-ify search_manager/check_block kernel: compat: handle UL compat for refactored allowlist kernel: apk_sign: add more size/hash pairs HACK: kernel: bypass tf out of uid_t/gid_t strict type checks kernel: build: sucompat: inline fns on non-manual hook methods kernel: build: restore LKM support kernel: ksu: printout quirks / backports / etc on init workflows: restore ksuinit+lkm workflow ksuinit: use mount api Reapply: "refactor(kernel): Perform umount for webview zygote (tiann#3630)" KernelSU v3.2.5+ Commits on top of upstream: 95 Warning: Managers built from this repo has a known keystore. See dummy.keystore. Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
$ git log --pretty=%s upstream/main..HEAD --reverse manager: keep api 29 support manager: QOL manager: restore api 26 support manager: fix search bar focus bug on Android 8 manager: Adjust for Android v7.1 support (#31) manager: fixup updates workflows: debloat dummy.keystore ksud: add armeabi-v7a support workflows: scripts: workaround armv7/a triple mismatch kernel: kernel: prepare for legacy support kernel: uapi: fix portability kernel: build: migrate to unity build kernel: external: import oss libraries kernel: downstream: provide common helpers kernel: app_profile: add 32-bit KSU_NO_NEW_PRIVS tif support kernel: init lsm_hook infrastructure kernel: lsm_hook: introduce selinux_ops LSM tampering for < 4.2 kernel: lsm_hook: introduce ARM64 branch patching for 6.8+ kernel: pkg_observer: initialize for downstream kernel: setuid_hook: disable seccomp for manager and allowed uids kernel: app_profile: adapt disable_seccomp to legacy kernel: selinux/sepolicy: handle selinux policydb backports kernel: selinux/sepolicy: abstract avtab slot access for compat kernel: selinux/rules: backport handle_sepolicy to legacy policydb kernel: selinux/rules: Pin task to current CPU to avoid cross-CPU rwlock release kernel: supercall: provide sys_reboot handler kernel: supercalls: tweak sys_reboot fd install kernel: adapt "namespace support" feature to old kernels kernel: allowlist: always allow shell for su on CONFIG_KSU_DEBUG kernel: file_wrapper: handle anon_inode_getfile for old kernels kernel: supercalls: partial backport of do_manage_mark kernel: compat: screw path_umount backport, call sys_umount directly kernel: app_profile: shim escape_with_root_profile kernel: throne_tracker: fixup deadlocks on iterate_dir kernel: throne_tracker: offload to kthread (tiann#2632) kernel: allowlist: escape allowlist handling to kthread kernel: ksud/lsm_hook: migrate ksu_install_rc_hook to security_file_permission LSM kernel: ksud: read: add fallback to /init.rc kernel: ksud: handle newfstat init_rc size injection kernel: ksud: handle early newfstat module_rc size injection kernel: ksud: wire up jump_label on vfs_read controlled hooks kernel: ksud: read: move second stage apply on read hook kernel: ksud: read: grab init_session_keyring on read hook kernel: ksud: replace input hook with an input handler kernel: sucompat: squash reworked sucompat changes kernel: lsm_hook: bprm: escape init ksud call to root for 3.x kernel: lsm_hook: bprm: escape init ksud call to root for < 4.14 kernel: ksud: spit a kthread as unhook watchdog kernel: file_wrapper: handle more compat kernel: file_wrapper: handle readdir and iterate compat for UL kernel: syscall_table_hook: introduce syscall table tampering kernel: sucompat: wire up sys_call_table unhooking kernel: sucompat: wire up jump label for sucompat unhooking kernel: kp_ksud: restore kprobes for early-boot and used-once hooks kernel: branch_link_hook: introduce arm64 branch link callsite hijacking kernel: feature: sulog: adjust for downstream kernel: feature: adbroot: adjust for downstream kernel: feature: wire up a smaller selinux_hide implementation kernel: lsm_hook: wire up setprocattr lsm hack for selinux_hide kernel: supercalls: expose ksu_set_manager_appid to sys_reboot kernel: supercalls: allow userspace to pull list entries (tiann#3040) kernel: tiny_sulog: basic ringbuffer, timestamped su log kernel: supercalls: expose ksuver override kernel: supercalls: expose spoof uname function to userspace kernel: supercalls: expose ksuflags override kernel: apk_sign: migrate generic_file_llseek -> vfs_llseek kernel: throne_tracker: resolve s_magic for < 3.9 kernel: ksud: handle conditional read_iter requirement for < 3.16 kernel: throne_tracker: handle filldir_t ABI mismatch on <= 3.18 kernel: sucompat: bruteforce writeable stack from start_stack for < 3.8 kernel: compat: no ext4_unregister_sysfs, no problem kernel: compat: provide proper strscpy/_pad routines kernel: compat: d_is_reg to S_ISREG kernel: compat: handle alloc_uid for < 3.5 kernel: compat: iterate_dir -> vfs_readdir compat for < 3.11 kernel: compat: provide bin2hex compat for < 3.18 kernel: compat: file_inode compat for < 3.9 kernel: compat: provide selinux_inode/selinux_cred wrappers for < 5.1 kernel: compat: no-op groups_sort if unavailable kernel: compat: define U16_MAX if absent kernel: compat: fix sulog/adbroot compile for legacy kernel: compat: inline newer kernel_read / kernel_write for < 4.14 kernel: apk_sign, throne_tracker: heap-ify search_manager/check_block kernel: compat: handle UL compat for refactored allowlist kernel: apk_sign: add more size/hash pairs HACK: kernel: bypass tf out of uid_t/gid_t strict type checks kernel: build: sucompat: inline fns on non-manual hook methods kernel: build: restore LKM support kernel: ksu: printout quirks / backports / etc on init workflows: restore ksuinit+lkm workflow ksuinit: use mount api Reapply: "refactor(kernel): Perform umount for webview zygote (tiann#3630)" KernelSU v3.2.5+ Commits on top of upstream: 95 Warning: Managers built from this repo has a known keystore. See dummy.keystore. Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
$ git log --pretty=%s upstream/main..HEAD --reverse manager: keep api 29 support manager: QOL manager: restore api 26 support manager: fix search bar focus bug on Android 8 manager: Adjust for Android v7.1 support (#31) manager: fixup updates workflows: debloat dummy.keystore ksud: add armeabi-v7a support workflows: scripts: workaround armv7/a triple mismatch kernel: kernel: prepare for legacy support kernel: uapi: fix portability kernel: build: migrate to unity build kernel: external: import oss libraries kernel: downstream: provide common helpers kernel: app_profile: add 32-bit KSU_NO_NEW_PRIVS tif support kernel: init lsm_hook infrastructure kernel: lsm_hook: introduce selinux_ops LSM tampering for < 4.2 kernel: lsm_hook: introduce ARM64 branch patching for 6.8+ kernel: pkg_observer: initialize for downstream kernel: setuid_hook: disable seccomp for manager and allowed uids kernel: app_profile: adapt disable_seccomp to legacy kernel: selinux/sepolicy: handle selinux policydb backports kernel: selinux/sepolicy: abstract avtab slot access for compat kernel: selinux/rules: backport handle_sepolicy to legacy policydb kernel: selinux/rules: Pin task to current CPU to avoid cross-CPU rwlock release kernel: supercall: provide sys_reboot handler kernel: supercalls: tweak sys_reboot fd install kernel: adapt "namespace support" feature to old kernels kernel: allowlist: always allow shell for su on CONFIG_KSU_DEBUG kernel: file_wrapper: handle anon_inode_getfile for old kernels kernel: supercalls: partial backport of do_manage_mark kernel: compat: screw path_umount backport, call sys_umount directly kernel: app_profile: shim escape_with_root_profile kernel: throne_tracker: fixup deadlocks on iterate_dir kernel: throne_tracker: offload to kthread (tiann#2632) kernel: allowlist: escape allowlist handling to kthread kernel: ksud/lsm_hook: migrate ksu_install_rc_hook to security_file_permission LSM kernel: ksud: read: add fallback to /init.rc kernel: ksud: handle newfstat init_rc size injection kernel: ksud: handle early newfstat module_rc size injection kernel: ksud: wire up jump_label on vfs_read controlled hooks kernel: ksud: read: move second stage apply on read hook kernel: ksud: read: grab init_session_keyring on read hook kernel: ksud: replace input hook with an input handler kernel: sucompat: squash reworked sucompat changes kernel: lsm_hook: bprm: escape init ksud call to root for 3.x kernel: lsm_hook: bprm: escape init ksud call to root for < 4.14 kernel: ksud: spit a kthread as unhook watchdog kernel: file_wrapper: handle more compat kernel: file_wrapper: handle readdir and iterate compat for UL kernel: syscall_table_hook: introduce syscall table tampering kernel: sucompat: wire up sys_call_table unhooking kernel: sucompat: wire up jump label for sucompat unhooking kernel: kp_ksud: restore kprobes for early-boot and used-once hooks kernel: branch_link_hook: introduce arm64 branch link callsite hijacking kernel: feature: sulog: adjust for downstream kernel: feature: adbroot: adjust for downstream kernel: feature: wire up a smaller selinux_hide implementation kernel: lsm_hook: wire up setprocattr lsm hack for selinux_hide kernel: supercalls: expose ksu_set_manager_appid to sys_reboot kernel: supercalls: allow userspace to pull list entries (tiann#3040) kernel: tiny_sulog: basic ringbuffer, timestamped su log kernel: supercalls: expose ksuver override kernel: supercalls: expose spoof uname function to userspace kernel: supercalls: expose ksuflags override kernel: apk_sign: migrate generic_file_llseek -> vfs_llseek kernel: throne_tracker: resolve s_magic for < 3.9 kernel: ksud: handle conditional read_iter requirement for < 3.16 kernel: throne_tracker: handle filldir_t ABI mismatch on <= 3.18 kernel: sucompat: bruteforce writeable stack from start_stack for < 3.8 kernel: compat: no ext4_unregister_sysfs, no problem kernel: compat: provide proper strscpy/_pad routines kernel: compat: d_is_reg to S_ISREG kernel: compat: handle alloc_uid for < 3.5 kernel: compat: iterate_dir -> vfs_readdir compat for < 3.11 kernel: compat: provide bin2hex compat for < 3.18 kernel: compat: file_inode compat for < 3.9 kernel: compat: provide selinux_inode/selinux_cred wrappers for < 5.1 kernel: compat: no-op groups_sort if unavailable kernel: compat: define U16_MAX if absent kernel: compat: fix sulog/adbroot compile for legacy kernel: compat: inline newer kernel_read / kernel_write for < 4.14 kernel: apk_sign, throne_tracker: heap-ify search_manager/check_block kernel: compat: handle UL compat for refactored allowlist kernel: apk_sign: add more size/hash pairs HACK: kernel: bypass tf out of uid_t/gid_t strict type checks kernel: build: sucompat: inline fns on non-manual hook methods kernel: build: restore LKM support kernel: ksu: printout quirks / backports / etc on init workflows: restore ksuinit+lkm workflow ksuinit: use mount api Reapply: "refactor(kernel): Perform umount for webview zygote (tiann#3630)" WIP: kernel: tinyfs_sucompat: file ops based sucompat KernelSU v3.2.5+ Commits on top of upstream: 96 Warning: Managers built from this repo has a known keystore. See dummy.keystore. Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
$ git log --pretty=%s upstream/main..HEAD --reverse manager: keep api 29 support manager: QOL manager: restore api 26 support manager: fix search bar focus bug on Android 8 manager: Adjust for Android v7.1 support (#31) manager: fixup updates workflows: debloat dummy.keystore ksud: add armeabi-v7a support workflows: scripts: workaround armv7/a triple mismatch kernel: kernel: prepare for legacy support kernel: uapi: fix portability kernel: build: migrate to unity build kernel: external: import oss libraries kernel: downstream: provide common helpers kernel: app_profile: add 32-bit KSU_NO_NEW_PRIVS tif support kernel: init lsm_hook infrastructure kernel: lsm_hook: introduce selinux_ops LSM tampering for < 4.2 kernel: lsm_hook: introduce ARM64 branch patching for 6.8+ kernel: pkg_observer: initialize for downstream kernel: setuid_hook: disable seccomp for manager and allowed uids kernel: app_profile: adapt disable_seccomp to legacy kernel: selinux/sepolicy: handle selinux policydb backports kernel: selinux/sepolicy: abstract avtab slot access for compat kernel: selinux/rules: backport handle_sepolicy to legacy policydb kernel: selinux/rules: Pin task to current CPU to avoid cross-CPU rwlock release kernel: supercall: provide sys_reboot handler kernel: supercalls: tweak sys_reboot fd install kernel: adapt "namespace support" feature to old kernels kernel: allowlist: always allow shell for su on CONFIG_KSU_DEBUG kernel: file_wrapper: handle anon_inode_getfile for old kernels kernel: supercalls: partial backport of do_manage_mark kernel: compat: screw path_umount backport, call sys_umount directly kernel: app_profile: shim escape_with_root_profile kernel: throne_tracker: fixup deadlocks on iterate_dir kernel: throne_tracker: offload to kthread (tiann#2632) kernel: allowlist: escape allowlist handling to kthread kernel: ksud/lsm_hook: migrate ksu_install_rc_hook to security_file_permission LSM kernel: ksud: read: add fallback to /init.rc kernel: ksud: handle newfstat init_rc size injection kernel: ksud: handle early newfstat module_rc size injection kernel: ksud: wire up jump_label on vfs_read controlled hooks kernel: ksud: read: move second stage apply on read hook kernel: ksud: read: grab init_session_keyring on read hook kernel: ksud: replace input hook with an input handler kernel: sucompat: squash reworked sucompat changes kernel: lsm_hook: bprm: escape init ksud call to root for 3.x kernel: lsm_hook: bprm: escape init ksud call to root for < 4.14 kernel: ksud: spit a kthread as unhook watchdog kernel: file_wrapper: handle more compat kernel: file_wrapper: handle readdir and iterate compat for UL kernel: syscall_table_hook: introduce syscall table tampering kernel: sucompat: wire up sys_call_table unhooking kernel: sucompat: wire up jump label for sucompat unhooking kernel: kp_ksud: restore kprobes for early-boot and used-once hooks kernel: branch_link_hook: introduce arm64 branch link callsite hijacking kernel: feature: sulog: adjust for downstream kernel: feature: adbroot: adjust for downstream kernel: feature: wire up a smaller selinux_hide implementation kernel: lsm_hook: wire up setprocattr lsm hack for selinux_hide kernel: supercalls: expose ksu_set_manager_appid to sys_reboot kernel: supercalls: allow userspace to pull list entries (tiann#3040) kernel: tiny_sulog: basic ringbuffer, timestamped su log kernel: supercalls: expose ksuver override kernel: supercalls: expose spoof uname function to userspace kernel: supercalls: expose ksuflags override kernel: apk_sign: migrate generic_file_llseek -> vfs_llseek kernel: throne_tracker: resolve s_magic for < 3.9 kernel: ksud: handle conditional read_iter requirement for < 3.16 kernel: throne_tracker: handle filldir_t ABI mismatch on <= 3.18 kernel: sucompat: bruteforce writeable stack from start_stack for < 3.8 kernel: compat: no ext4_unregister_sysfs, no problem kernel: compat: provide proper strscpy/_pad routines kernel: compat: d_is_reg to S_ISREG kernel: compat: handle alloc_uid for < 3.5 kernel: compat: iterate_dir -> vfs_readdir compat for < 3.11 kernel: compat: provide bin2hex compat for < 3.18 kernel: compat: file_inode compat for < 3.9 kernel: compat: provide selinux_inode/selinux_cred wrappers for < 5.1 kernel: compat: no-op groups_sort if unavailable kernel: compat: define U16_MAX if absent kernel: compat: fix sulog/adbroot compile for legacy kernel: compat: inline newer kernel_read / kernel_write for < 4.14 kernel: apk_sign, throne_tracker: heap-ify search_manager/check_block kernel: compat: handle UL compat for refactored allowlist kernel: apk_sign: add more size/hash pairs HACK: kernel: bypass tf out of uid_t/gid_t strict type checks kernel: build: sucompat: inline fns on non-manual hook methods kernel: build: restore LKM support kernel: ksu: printout quirks / backports / etc on init workflows: restore ksuinit+lkm workflow ksuinit: use mount api Reapply: "refactor(kernel): Perform umount for webview zygote (tiann#3630)" WIP: kernel: tinyfs_sucompat: file ops based sucompat KernelSU v3.2.5+ Commits on top of upstream: 96 Warning: Managers built from this repo has a known keystore. See dummy.keystore. Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
$ git log --pretty=%s upstream/main..HEAD --reverse manager: keep api 29 support manager: QOL manager: restore api 26 support manager: fix search bar focus bug on Android 8 manager: Adjust for Android v7.1 support (KOWX712#31) manager: fixup updates workflows: debloat dummy.keystore ksud: add armeabi-v7a support workflows: scripts: workaround armv7/a triple mismatch kernel: kernel: prepare for legacy support kernel: uapi: fix portability kernel: build: migrate to unity build kernel: external: import oss libraries kernel: downstream: provide common helpers kernel: app_profile: add 32-bit KSU_NO_NEW_PRIVS tif support kernel: init lsm_hook infrastructure kernel: lsm_hook: introduce selinux_ops LSM tampering for < 4.2 kernel: lsm_hook: introduce ARM64 branch patching for 6.8+ kernel: pkg_observer: initialize for downstream kernel: setuid_hook: disable seccomp for manager and allowed uids kernel: app_profile: adapt disable_seccomp to legacy kernel: selinux/sepolicy: handle selinux policydb backports kernel: selinux/sepolicy: abstract avtab slot access for compat kernel: selinux/rules: backport handle_sepolicy to legacy policydb kernel: selinux/rules: Pin task to current CPU to avoid cross-CPU rwlock release kernel: supercall: provide sys_reboot handler kernel: supercalls: tweak sys_reboot fd install kernel: adapt "namespace support" feature to old kernels kernel: allowlist: always allow shell for su on CONFIG_KSU_DEBUG kernel: file_wrapper: handle anon_inode_getfile for old kernels kernel: supercalls: partial backport of do_manage_mark kernel: compat: screw path_umount backport, call sys_umount directly kernel: app_profile: shim escape_with_root_profile kernel: throne_tracker: fixup deadlocks on iterate_dir kernel: throne_tracker: offload to kthread (tiann#2632) kernel: allowlist: escape allowlist handling to kthread kernel: ksud/lsm_hook: migrate ksu_install_rc_hook to security_file_permission LSM kernel: ksud: read: add fallback to /init.rc kernel: ksud: handle newfstat init_rc size injection kernel: ksud: handle early newfstat module_rc size injection kernel: ksud: wire up jump_label on vfs_read controlled hooks kernel: ksud: read: move second stage apply on read hook kernel: ksud: read: grab init_session_keyring on read hook kernel: ksud: replace input hook with an input handler kernel: sucompat: squash reworked sucompat changes kernel: lsm_hook: bprm: escape init ksud call to root for 3.x kernel: lsm_hook: bprm: escape init ksud call to root for < 4.14 kernel: ksud: spit a kthread as unhook watchdog kernel: file_wrapper: handle more compat kernel: file_wrapper: handle readdir and iterate compat for UL kernel: syscall_table_hook: introduce syscall table tampering kernel: sucompat: wire up sys_call_table unhooking kernel: sucompat: wire up jump label for sucompat unhooking kernel: kp_ksud: restore kprobes for early-boot and used-once hooks kernel: branch_link_hook: introduce arm64 branch link callsite hijacking kernel: feature: sulog: adjust for downstream kernel: feature: adbroot: adjust for downstream kernel: feature: wire up a smaller selinux_hide implementation kernel: lsm_hook: wire up setprocattr lsm hack for selinux_hide kernel: supercalls: expose ksu_set_manager_appid to sys_reboot kernel: supercalls: allow userspace to pull list entries (tiann#3040) kernel: tiny_sulog: basic ringbuffer, timestamped su log kernel: supercalls: expose ksuver override kernel: supercalls: expose spoof uname function to userspace kernel: supercalls: expose ksuflags override kernel: apk_sign: migrate generic_file_llseek -> vfs_llseek kernel: throne_tracker: resolve s_magic for < 3.9 kernel: ksud: handle conditional read_iter requirement for < 3.16 kernel: throne_tracker: handle filldir_t ABI mismatch on <= 3.18 kernel: sucompat: bruteforce writeable stack from start_stack for < 3.8 kernel: compat: no ext4_unregister_sysfs, no problem kernel: compat: provide proper strscpy/_pad routines kernel: compat: d_is_reg to S_ISREG kernel: compat: handle alloc_uid for < 3.5 kernel: compat: iterate_dir -> vfs_readdir compat for < 3.11 kernel: compat: provide bin2hex compat for < 3.18 kernel: compat: file_inode compat for < 3.9 kernel: compat: provide selinux_inode/selinux_cred wrappers for < 5.1 kernel: compat: no-op groups_sort if unavailable kernel: compat: define U16_MAX if absent kernel: compat: fix sulog/adbroot compile for legacy kernel: compat: inline newer kernel_read / kernel_write for < 4.14 kernel: apk_sign, throne_tracker: heap-ify search_manager/check_block kernel: compat: handle UL compat for refactored allowlist kernel: apk_sign: add more size/hash pairs HACK: kernel: bypass tf out of uid_t/gid_t strict type checks kernel: build: sucompat: inline fns on non-manual hook methods kernel: build: restore LKM support kernel: ksu: printout quirks / backports / etc on init workflows: restore ksuinit+lkm workflow ksuinit: use mount api Reapply: "refactor(kernel): Perform umount for webview zygote (tiann#3630)" KernelSU v3.2.5+ Commits on top of upstream: 95 Warning: Managers built from this repo has a known keystore. See dummy.keystore. Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
https://android.googlesource.com/platform/system/core/+/master/libcutils/include/private/android_filesystem_config.h tiann#3630 Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Keep webview zygote unmounting enabled by default while allowing users to restore compatibility with modules that modify webview resources.
There was a problem hiding this comment.
🟡 Changes recommended
The new kernel feature flag is accessed across code paths without READ_ONCE/WRITE_ONCE (data-race risk), and one updated scenario comment is misleading relative to the actual control flow.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
kernel/feature/kernel_umount.c:115
- The updated scenario comment is misleading: isolated UIDs are still handled primarily via the
is_isolated_process(new_uid)path (independent of the WebView zygote feature flag). Please clarify the scenario description to match the actual control flow.
// 4. Webview zygote forked from zygote: zygote -> webview_zygote (controlled by feature policy)
// 5. Isolated process forked from app zygote: appuid -> isolated_process (already handled by 3)
// 6. Isolated process forked from webview zygote (already handled by 4)
- Files reviewed: 19/19 changed files
- Comments generated: 2
- Review effort level: Lite
|
To me, it suffice to treat the webview_zygote as a legal target for denylist. |
|
As I said in commit message, this is expected to break some font modules aimed at webview, because fonts are usually loaded in sandboxed process forked from webview zygote. Webview zygote is previously not unmounted for this exact reason, as per a user request. So I provided a toggle. If some fonts work, that is just because a few common fonts are preloaded in zygote. |
|
In this case, to address the user need, isn't propagating The underlying issue of detection was simply neglecting |
|
The issue is as long as there is one not-unmounted sandboxed isolated process running, the detection will work. So one match = all match. So I don't think it makes too much sense to make it toggable per-app. Also there is no easy way to do this without a userspace daemon, maybe need to parse cmdline in process's stack. |
|
I meant show Not a |
This was deliberately not done because app cannot run custom code from isolated processes forked from webview zygote. However, hidepid=2 is broken for android again.
In 2020, Jann Horn discovered that when zygote forks and specializes to app zygote, process groups are not cleaned. This makes app zygote and its child have AID_READPROC and bypass hidepid=2. This was marked as CVE-2020-0257 and fixed in 2020-08-01.
However, it is ignored that isolated process can get directly forked from zygote while no app zygote fork is needed. So isolated_app context process still may have AID_READPROC, which provides a way to bypass the hidepid=2 restrictions on /proc.
The impact is limited by SELinux because isolated_app does not have mlstrustedsubject. But it can still read cmdline, comm, maps, mountinfo etc of other isolated processes, mainly webview sandboxed processes.
Bangcle, a famous commercial app protection service in China, started to make use of this recently. An isolated process is forked and iterates through all pids, trying to open their mountinfo.
This is no doubt an exploit (almost same with CVE-2020-0257) and we have already reported it to Google. Before Google fixes it, we have no way but unmount anything for webview zygote. This is expected to break some font modules aimed at webview, but we have no choice.