Skip to content

use syscall table hook, replace some GFP_ATOMIC to GFP_KERNEL#32

Draft
5ec1cff wants to merge 16 commits intomainfrom
syscallhook
Draft

use syscall table hook, replace some GFP_ATOMIC to GFP_KERNEL#32
5ec1cff wants to merge 16 commits intomainfrom
syscallhook

Conversation

@5ec1cff
Copy link
Owner

@5ec1cff 5ec1cff commented Dec 22, 2025

No description provided.

Copy link

Copilot AI left a comment

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 replaces kprobe-based syscall hooking with direct syscall table modification for execve and read syscalls, and changes memory allocation flags from GFP_ATOMIC to GFP_KERNEL in SELinux policy functions. The change aims to improve reliability and performance by using syscall table hooks instead of kprobes.

  • Replaced kprobe hooks with direct syscall table modifications for sys_execve and sys_read
  • Changed GFP_ATOMIC to GFP_KERNEL for memory allocations in SELinux policy manipulation functions
  • Added official manager APK signature verification alongside custom signature checks

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
kernel/ksud.c Implements syscall table hooking mechanism replacing kprobe handlers; adds cache invalidation logic and removes kprobe-related work queues for execve and read hooks
kernel/selinux/sepolicy.c Changes allocation flags from GFP_ATOMIC to GFP_KERNEL for kzalloc, kcalloc, kstrdup, and kvrealloc calls
kernel/apk_sign.c Adds fallback check for official manager APK signature in addition to custom signature
kernel/Kbuild Adds build-time detection for dcache invalidation API variant and defines official APK signature constants
kernel/Makefile Adds CONFIG_KSU=m flag to module build command
.github/workflows/build-lkm.yml Disables fail-fast strategy to allow all matrix builds to complete

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

@5ec1cff 5ec1cff force-pushed the syscallhook branch 2 times, most recently from db69319 to c563f00 Compare December 22, 2025 14:04
@5ec1cff 5ec1cff force-pushed the main branch 4 times, most recently from b8623e1 to 290df4f Compare December 30, 2025 03:23
@5ec1cff 5ec1cff force-pushed the main branch 2 times, most recently from d729fef to 76ec0b9 Compare January 1, 2026 13:21
@5ec1cff 5ec1cff force-pushed the syscallhook branch 2 times, most recently from 0376f48 to 171eb6e Compare January 3, 2026 01:18
backslashxx added a commit to backslashxx/KernelSU that referenced this pull request Feb 5, 2026
since we are not on atomic context of any kind on ksud stage this can be done.
though with allocations as many as this a memory pool can be considered?

ref: 5ec1cff#32
@5ec1cff 5ec1cff force-pushed the main branch 4 times, most recently from af9284c to a93f91c Compare March 3, 2026 05:23
@5ec1cff 5ec1cff marked this pull request as draft March 6, 2026 07:21
@5ec1cff 5ec1cff force-pushed the main branch 5 times, most recently from 829fa18 to 6a312d2 Compare March 12, 2026 13:03
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.

2 participants