arm64: handle inlined kCFI failure reporting - #311
Open
xeropresence wants to merge 1 commit into
Open
xeropresence wants to merge 1 commit into
xeropresence wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extend KernelPatch's existing KP/KPM-only CFI exception policy to the arm64
cfi_handlerentry point. This covers kernels where LTO inlinesreport_cfi_failure, bypassing the existing hook on that function.Problem
On the stock Pixel 8 (
shiba) GrapheneOS2026081300kernel, disassembly ofcfi_handlershows inlined failure reporting instead of a call to the separately emittedreport_cfi_failuresymbol. Hooking the latter therefore does not intercept the actual trap path.Kernel-to-KernelPatch callbacks can still fault under kCFI. Observed paths include directory iteration, RCU reclamation, and
stop_machineduring runtime hook removal. Adding separate typed trampolines at each call site works around the missed interception point but is unnecessary when the existing compatibility policy is applied at the trap handler.Changes
cfi_handlerandarm64_skip_faulting_instructionand install an arm64-only before-hook when both exist.should_cfi_pass()address-range check.DBG_HOOK_HANDLED.report_cfi_failureand legacy__cfi_slowpathhooks, and the currentcfi_bypasscompletion flag.This does not make CFI globally permissive. It retains the existing scoped exception for KernelPatch text, hook memory, and KPM executable memory. No callback allocator, syscall-hook changes, task-observer changes, or persistent preset-layout changes are introduced.
Verification
Built the Android ARM64 payload and
kptoolson this branch.Device testing used all three fixes on KernelPatch
0.13.8, with a Pixel 8 running GrapheneOS2026081300: