Skip to content

WIP: PatchNest Core dual-backend ABI and KPM loader hardening - #16

Draft
Zhanfg wants to merge 35 commits into
mainfrom
refactor/dual-backend-runtime
Draft

Zhanfg wants to merge 35 commits into
mainfrom
refactor/dual-backend-runtime

Conversation

@Zhanfg

@Zhanfg Zhanfg commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Objective

One PatchNest runtime with two deployment backends:

  1. Kernel Integrated / AK3: native Kbuild port (currently only status ioctl, NOT KPM loading).
  2. Image Patched / standalone module: existing kpimg/kptools foundation (unified patched ABI adapter pending).

Implemented

  • Shared, versioned ABI v1 header and a read-only native /dev/patchnest status ioctl; capability mask remains 0, NOT_READY by design.
  • Native Kconfig/Makefile development port, not yet integrated into actual device source tree.
  • Read-only patchnest-status CLI that verifies native ABI rather than guessing from root.
  • KPM loader refactoring: serialized load publication; kernel spinlock-guarded module registry; callback lifetime pins; return -EBUSY when control/event callback is still active; bounded event snapshot; per-call ctl0 arguments.
  • Bounded ELF header, section, memory budget, symbol strings and relocation index/offset validation, plus missing callback guards.
  • GCC/Clang host ABI test and concurrent pthread lifetime tests; current ARM64 kpimg/kptools build CI.
  • Companion manager PatchNest PR #12: read-only dual-backend detection and WebUI label with Vitest tests.

Hard blockers — draft / do not flash

This is not a completed KPM runtime and cannot be shipped as AK3 or a reliable patched ZIP.

See docs/PATCHNEST_DUAL_BACKEND.md for the exact acceptance gates.

2026-10-14 continuation: native integration workflow

  • Added ports/linux-native/integrate.sh: defaults to dry-run; explicit opt-in to stage Kconfig/Makefile/driver into an existing kernel tree; repeatable without duplicate stanzas; refuses conflicting driver or ABI rather than overwriting.
  • Added host integration smoke tests and CI checks for dry-run, conflict rejection, and idempotence.
  • This is still status-only. A functioning KPM runtime has not been linked into an actual OnePlus kernel, and no AK3 has been built or device-tested from this PR. Do not merge until true kernel and boot gates pass.

Zhanfg added 25 commits October 14, 2026 02:59
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