lkm4ctr icon indicating copy to clipboard operation
lkm4ctr copied to clipboard

Kernel panic on OnePlus Ace 2 (PHK110, 5.10.236-android12-9, KMI android12-5.10) right after first namespace use

Open Chen9183 opened this issue 1 week ago • 1 comments

Summary

On a stock OnePlus Ace 2 (PHK110) running 5.10.236-android12-9 vendor kernel (KMI android12-5.10), the 4.0.5 module loads successfully (insmod returns 0, lsmod shows lkm4ctr), but the device panics and reboots as soon as a real container-namespace operation happens (running lkm4ctr_checker afterwards).

No panic stack was recoverable on this device (pstore/ramoops disabled, /proc/last_kmsg absent, all minidump partitions empty), but the vendor's own /proc/last_boot_reason classifies the reboot as kernel crash Minidump.

Environment

  • Device: OnePlus Ace 2 PHK110 / OP5913L1, ColorOS 16 / Android 16
  • Kernel: 5.10.236-android12-9-o-ga85e2b4db464 (aarch64, GKI-derived vendor kernel)
  • Detected KMI: android12-5.10
  • Root: KernelSU 3.3.1 (uapi 5), manager installed; SELinux Enforcing, su domain u:r:ksu:s0
  • Module used: kmi/lkm4ctr-android12-5.10-arm64.ko (14,794,048 bytes) from lkm4ctr-kernelsu-module.zip (27,300,879 bytes, release 4.0.5)
  • Installed manually with insmod only — the KernelSU ZIP was not installed into /data/adb/modules, boot autoload was never enabled.

Relevant kernel config

Present:

CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y CONFIG_MODVERSIONS=y
CONFIG_KPROBES=y CONFIG_FTRACE=y CONFIG_KALLSYMS=y CONFIG_KALLSYMS_ALL=y
CONFIG_NAMESPACES=y CONFIG_UTS_NS=y CONFIG_NET_NS=y CONFIG_TIME_NS=y CONFIG_CGROUPS=y
CONFIG_FUSE_FS=y CONFIG_OVERLAY_FS=y CONFIG_CFI_CLANG=y

Missing (the reason we wanted this module):

# CONFIG_PID_NS is not set
# CONFIG_USER_NS is not set
# CONFIG_SYSVIPC is not set
# CONFIG_POSIX_MQUEUE is not set

No CONFIG_MODULE_SIG* at all (unsigned modules are accepted).

Baseline checker (before load)

lkm4ctr_checker 4.0.5 → 19 FAIL, 0 STUB, as expected for this kernel: ns_pid, ns_user, ns_ipc, proc_ns_access/link (IPC/PID), mqueue, sysvipc, clone(CLONE_SYSVSEM), overlay2. ns_uts, ns_net, ns_mnt, ns_cgroup, pidfd_open, ptrace, wait4/waitid pass.

Static pre-checks I did before loading (all clean)

  • All 225 undefined symbols imported by the .ko are exported by this kernel (checked /proc/kallsyms for __ksymtab_* names → 0 missing).
  • vermagic of the .ko is 5.10.252-dirty SMP preempt mod_unload modversions aarch64; kernel is 5.10.236-android12-9-…. 5.10's same_magic() compares from the first space onwards when the module has a __versions section, so the version prefix is ignored — the flags (SMP preempt mod_unload modversions aarch64) match.
  • The .ko has a __versions section with size 0 → CRC checks are skipped (only the "no symbol version" warning / taint).
  • No module signature enforcement on this kernel.

What happened

  1. insmod lkm4ctr-android12-5.10-arm64.ko → exit 0, lsmod reports lkm4ctr 892928 2.
  2. Kernel log right after load looked healthy:
lkm4ctr: hotreload: loaded: this is a first load (...)
lkm4ctr: lkm4ctr: loaded unified module (vendor_kernel auto-started; mount -t lkm4ctr diag <mountpoint> to inspect it)
lkm4ctr: vendor_kernel: [DEBUG-KMI-EXIT] exit_fs hook #2 pid=6628 comm=insmod tracked_nsproxy=0 child_reaper=0
lkm4ctr: vendor_kernel: [DEBUG-KMI-EXIT] exit hook pre #2 pid=6628 comm=insmod tracked_nsproxy=0 pid_ns=init child_reaper=0
lkm4ctr: vendor_kernel: [DEBUG-KMI-EXIT] exit hook post #2 pid=6628 comm=insmod tracked_nsproxy=0 pid_ns=init child_reaper=0
({insmod,lsmod,grep,POSIX timer} all went through the exit hooks fine)
  1. Then I ran lkm4ctr_checker (which actually calls unshare(CLONE_NEWPID), unshare(CLONE_NEWUSER), SysV IPC, mqueue, and an overlay mount). The adb/shell session died mid-run; the phone rebooted on its own within ~1 minute.
  2. Vendor record after reboot:
# cat /proc/last_boot_reason
kernel crash Minidump [2026-11-22 10:35:16]

Crash data availability (why no stack)

  • /sys/fs/pstore empty, no ramoops/console pstore configured
  • /proc/last_kmsg does not exist
  • dumps in mdcompress (20 MB) and mdtp_a/mdtp_b (32 MB each) are all zero bytes

So I can only report when it crashed, not the call trace. If you tell me which diagnostic build / which instrumentation to load, or whether the lkm4ctr diagfs (mount -t lkm4ctr diag …) can be used without touching namespaces, I can reproduce and capture more (dmesg while it survives, resource counters, etc.).

Related issues (I read these before filing)

  • #4 — "Fix insmod unknown-symbol and CFI panics on a12-5.10/a13-5.15"
  • #6 — "Fix delayed CFI kernel panic on docker exec (pid namespace lookup) on stock 6.1/6.6/6.12"

Both are the same failure family: an indirect call through a shadow_hook_resolve()-resolved pointer (or a whole-object CFI strip) triggers Oops - CFI: ... → Kernel panic - not syncing. Since this box has CONFIG_CFI_CLANG=y and the crash happens only once a vendored namespace / overlayfs path is actually exercised (not at insmod), my working hypothesis is a missed __nocfi / CFI-unsafe call site on the 5.10 arm64 (CONFIG_CFI_CLANG, non-KCFI) path — or a CFI type-hash mismatch caused by the 5.10.236 vendor tree differing from the 5.10.252 tree this .ko was built from, even though every imported symbol resolves.

Question

  1. Is this 5.10.236 vendor (not pure GKI) kernel in scope? The module is built for 5.10.252-dirty, and CONFIG_CFI_CLANG=y here — could a CFI type-hash mismatch in the vendored overlayfs/ns paths be the panic cause?
  2. Which subsystem is most likely involved: vendored PID/user/IPC namespace creation, or the vendored overlayfs mount? (Both are exercised by the checker; I can split the test.)
  3. Should I try the .ko with any module parameter to keep vendor_kernel disabled at first load, so we can isolate shadow_hijack + basic hooks from the namespace code?
  4. Would a debug .ko that pr_err()s before each CFI-sensitive indirect call help? I'm willing to bisect one syscall at a time (e.g. only unshare(CLONE_NEWPID) with no checker at all) — each attempt costs one reboot, so I'd like to do it once with the right instrumentation. Note this device has no pstore/ramoops, so the kernel log from the crashing boot is lost; any capturing has to happen before the panic.

Current state

Module is not installed and not loaded; device is back to normal (no boot autoload, nothing written to /data/adb/modules). Happy to run a more controlled reproduction (e.g. only unshare(CLONE_NEWPID) with no checker, capture dmesg until crash) if you consider it useful.

Chen9183 avatar Nov 22 '26 02:11 Chen9183

see /data/persist_log/

Dere3046 avatar Nov 22 '26 12:11 Dere3046