Skip to content

A05 cfi fix - #12

Open
Evolution1X wants to merge 3 commits into
diabl0w:mainfrom
Evolution1X:a05-cfi-fix
Open

Evolution1X wants to merge 3 commits into
diabl0w:mainfrom
Evolution1X:a05-cfi-fix

Conversation

@Evolution1X

Copy link
Copy Markdown

No description provided.

DFRoot local build added 3 commits November 27, 2026 22:49
…Samsung 6.6

ksu_handle_stat_sucompat, ksu_handle_faccessat_sucompat and
ksu_handle_execve_sucompat_common call ksu_syscall_table[orig_nr](regs).
The entries they reach are our own __nocfi hooks, so the KCFI type check
generated at those call sites has no matching hash to compare and traps:

  Internal error: BRK handler: 00000000f2008228
  pc: ksu_handle_stat_sucompat+0x68/0x17c [kernelsu]
  x16: 000000009431df7f  x17: 00000000b02b34d9

Mark the callers __nocfi, matching the existing convention in
kernel/hook/syscall_event_bridge.c. Hit on SM-A055F (6.6.127-android15-8).
The LKM is compiled against DDK/GKI trees, which enable CFI, so every
indirect call in kernelsu.ko carries a kCFI type check. Kernels can ship
the opposite configuration (Samsung/MTK android15-6.6 on SM-A055F reports
"# CONFIG_CFI_CLANG is not set"), and then neither their kernel functions
nor our own __nocfi helpers carry a type hash: any indirect call out of a
CFI-enabled module function traps with

  Internal error: BRK handler: 00000000f2008228
  pc: ksu_handle_stat_sucompat+0x68/0x17c [kernelsu]

Default stays CFI-enabled to match GKI; kernels without KCFI opt out with
KSU_MODULE_CFI=0 instead of patching call sites one by one.
Kernels built with CONFIG_CFI_CLANG=n (Samsung/MTK android15-6.6 on
SM-A055F) have no kCFI hashes, so a module compiled with checks traps on
its first indirect call. Pass the toggle through to make; set
module_cfi: '1' in the caller for GKI targets.
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