Skip to content

kernel: merge TIF_KSU_DISABLE_KSU into TIF_KSU_DISABLE_ESCAPE_WITH_ROOT - #10

Merged
superturtlee merged 1 commit into
mainfrom
kernel/merge-disable-tif
Sep 7, 2026
Merged

kernel: merge TIF_KSU_DISABLE_KSU into TIF_KSU_DISABLE_ESCAPE_WITH_ROOT#10
superturtlee merged 1 commit into
mainfrom
kernel/merge-disable-tif

Conversation

@superturtlee

Copy link
Copy Markdown
Collaborator

DISABLE_KSU (ioctl 22) had no userspace callers anywhere, while DISABLE_ESCAPE_TO_ROOT (ioctl 21) is already wired up: ksud calls it for --ksu-no-new-privs, and container runtimes (Droidspaces) call it in the container init before applying their seccomp filter. Merge the two thread flags so ioctl 21 becomes the single full kill switch: once set (fork-inherited via thread_info.flags, irreversible), escape_with_ root_profile() aborts, is_manager()/is_allow_uid() are always false, every supercall ioctl returns -EPERM, the reboot magic fd-install is skipped, and setresuid no longer installs/caches anything.

This closes the container setresuid fd-injection path for process trees that already declared "disable escape": they can no longer receive the [ksu_driver] fd via the manager-uid setresuid injection, nor get __NR_reboot punched into their seccomp allow-cache by that hook.

KSU_IOCTL_DISABLE_KSU (cmd 22), do_disable_ksu() and the TIF_KSU_DISABLE_KSU bit assignments (61/29) are removed. No userspace code referenced them.

DISABLE_KSU (ioctl 22) had no userspace callers anywhere, while
DISABLE_ESCAPE_TO_ROOT (ioctl 21) is already wired up: ksud calls it for
--ksu-no-new-privs, and container runtimes (Droidspaces) call it in the
container init before applying their seccomp filter. Merge the two thread
flags so ioctl 21 becomes the single full kill switch: once set
(fork-inherited via thread_info.flags, irreversible), escape_with_
root_profile() aborts, is_manager()/is_allow_uid() are always false,
every supercall ioctl returns -EPERM, the reboot magic fd-install is
skipped, and setresuid no longer installs/caches anything.

This closes the container setresuid fd-injection path for process trees
that already declared "disable escape": they can no longer receive the
[ksu_driver] fd via the manager-uid setresuid injection, nor get
__NR_reboot punched into their seccomp allow-cache by that hook.

KSU_IOCTL_DISABLE_KSU (cmd 22), do_disable_ksu() and the TIF_KSU_DISABLE_KSU
bit assignments (61/29) are removed. No userspace code referenced them.

Co-Authored-By: Claude <noreply@anthropic.com>
@superturtlee superturtlee reopened this Sep 7, 2026
@superturtlee
superturtlee merged commit 566a0f0 into main Sep 7, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant