Skip to content

kernel: use our cred to unmount, remove sepolicy of zygote#3032

Merged
aviraxp merged 1 commit into
mainfrom
ksucred
Dec 3, 2025
Merged

kernel: use our cred to unmount, remove sepolicy of zygote#3032
aviraxp merged 1 commit into
mainfrom
ksucred

Conversation

@5ec1cff

@5ec1cff 5ec1cff commented Dec 3, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors credential management for unmounting operations by introducing a globally shared ksu_cred credential instead of using per-task credentials. The change eliminates the need for zygote processes to have special SELinux permissions for unmounting modules.

Key changes:

  • Introduced a global ksu_cred credential initialized during module init and configured with the KernelSU SELinux context during init's second stage
  • Refactored transive_to_domain() to accept a credential parameter instead of always using the current task's credential
  • Simplified umount_tw_func() to use the shared ksu_cred instead of storing and managing per-task credentials

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
kernel/ksu.h Declares the global ksu_cred variable for external access
kernel/ksu.c Initializes ksu_cred in module init and properly releases it in module exit
kernel/selinux/selinux.h Adds declaration for setup_ksu_cred() function
kernel/selinux/selinux.c Refactors transive_to_domain() to accept credential parameter and adds setup_ksu_cred() to configure the global credential's SELinux context
kernel/ksud.c Calls setup_ksu_cred() during init second stage to properly configure the credential
kernel/kernel_umount.c Simplifies unmount credential handling by using the shared ksu_cred instead of managing per-task credentials
kernel/selinux/rules.c Removes zygote SELinux rule that is no longer needed since unmounting no longer happens in zygote context

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread kernel/ksu.c
Comment thread kernel/selinux/selinux.c Outdated
Comment thread kernel/kernel_umount.c
Comment thread kernel/selinux/selinux.c Outdated
@5ec1cff 5ec1cff changed the title kernel: use our cred to unmount kernel: use our cred to unmount, remove sepolicy of zygote Dec 3, 2025
@5ec1cff 5ec1cff requested a review from aviraxp December 3, 2025 12:38
@aviraxp aviraxp marked this pull request as draft December 3, 2025 13:25
@aviraxp aviraxp marked this pull request as ready for review December 3, 2025 13:25
@aviraxp aviraxp marked this pull request as draft December 3, 2025 13:28
@aviraxp aviraxp marked this pull request as ready for review December 3, 2025 13:43
@aviraxp aviraxp merged commit fb3fc2f into main Dec 3, 2025
15 checks passed
@aviraxp aviraxp deleted the ksucred branch December 3, 2025 13:43
KOWX712 pushed a commit to KOWX712/KernelSU that referenced this pull request Dec 3, 2025
larpedd pushed a commit to larpedd/KernelSU that referenced this pull request Dec 20, 2025
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 5, 2026
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 8, 2026
u9521 pushed a commit to u9521/KernelSU that referenced this pull request Jan 13, 2026
RapliVx pushed a commit to RapliVx/KernelSU that referenced this pull request Jan 26, 2026
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Feb 23, 2026
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.

4 participants