Skip to content

FolkPatch v5.0 KP-0.13.5

Choose a tag to compare

@matsuzaka-yuki matsuzaka-yuki released this 17 Aug 13:11
· 21 commits to main since this release

Version: 115021 (versionCode)
KernelPatch: 0.13.5
Released: pending

This release syncs security fixes, UI fixes and the PatchesViewModel refactor from
APatch upstream (bmax121/APatch), and bumps the embedded KernelPatch to 0.13.5.

All FolkPatch customizations are preserved: me.yuki.folk package name,
verifyAppSignature self-check, folkpatch_* kernel modules, and the dual
SuperUser UI (M3E list default / legacy list optional).


1. Kernel — KernelPatch 0.13.4 → 0.13.5

1.1 Hotpatch backend

Change Impact
Added a hotpatch fallback for older 4.x kernels: below 4.6, patching uses the kernel's own aarch64_insn_patch_text (legacy path) Fixes kernels that previously could not be hotpatched or failed to boot
4.6 and above now use the unified alias_pte direct-write path (aarch64_insn_patch_text_nosync with alias-mapping fallback) Avoids kernel crashes on 4.10+ where aarch64_insn_patch_text semantics changed

1.2 Security hardening

Change Impact
APK signature verification rewritten with bounds-checked parsing + task_ext fast path Eliminates out-of-bounds reads that could crash the kernel
Manager APK trust list narrowed to FolkPatch official signature only (me.yuki.folk); upstream APatch / demo package entries removed Prevents an installed APatch from shadowing FolkPatch and hijacking manager authority
userd signature verification hardened: only a lone, valid v2 signature grants trust; v1/v3/v3.1 parsing kept for diagnostics only Closes the weakest link in the manager-trust chain

1.3 Init hook

Change Impact
Init hook mount delayed to post-fs-data stage Avoids racing system_server during early boot

1.4 Other fixes

Change Impact
selinux_hide / selinux_sepolicy / taskob / accctl compatibility and correctness fixes Stable behavior on more ROMs
6.6 kernel jailbreak stability patch Fixes jailbreak instability on 6.6
6.6+ insmod error fix Kernel modules now load on 6.6+

2. Manager App

2.1 Patch workflow refactor (upstream 5b4ffd48 / 5095599e)

Change Impact
All patchDir consumers now funnel through a single ensurePrepared() precondition + workMutex Initialization is a precondition of the operation itself; ordering no longer depends on coroutine lock races
prepared is set only on success; failed init is retried A one-off init failure no longer wedges the manager
running/patching reset in finally on every path A stray exception can no longer leave the working state stuck
doPatch / doUnpatch / setCustomKPImg join the same lock Patching cannot start while scripts are still being extracted
Preserved: selectedKPImg / selectedBootImage custom images, KPM auto-backup, lazy shell creation Fork customizations intact

2.2 Patch workflow fixes

Change Impact
Fixed ori.img migration for manual-flash (PATCH_ONLY) installs The migration path was hardcoded to me.bmax.apatch while the actual package is me.yuki.folkthe migration never ran; now restored at boot with the correct path, and /data/adb/ap is auto-created

2.3 Shizuku log screen — M3E redesign

Change Impact
Top bar actions collapsed from 4 icon buttons to a single overflow menu (Refresh / Copy / Export / Clear) Matches the manager's minimal top-bar style
Source switch, level filters and search grouped into one spliced card; log lines inside a rounded surfaceContainer container Consistent visual language with the rest of the manager

2.4 Settings language fixes (PR #198)

Change Impact
Settings row now shows the app's own language name (e.g. 简体中文) instead of the system-language name (e.g. "Chinese") Clear, consistent naming; falls back to a bare language-code match (e.g. id for id-ID)
Language picker highlights the tapped entry instantly setApplicationLocales() is async; previously the UI only refreshed after activity recreation

2.5 apd security / correctness fixes (11 items from upstream)

Change Impact
su accepts -cn / -z as SELinux context options (Magisk compat) Legacy root apps calling su -cn <context> no longer error out
waitpid retry logic corrected Old logic was inverted (continued on success) — the daemon never waited for children; exit codes now decoded properly (signal-killed → 128+signal)
getpwnam now receives a NUL-terminated CString String::as_ptr() is not NUL-terminated (UB) — every username lookup silently failed; unknown users now fail closed instead of falling back to uid 0
Module id validated against a whitelist at install Blocks path traversal at the trust boundary
Config parsing bounds: entry count / key / value length limits A corrupt config can no longer claim huge lengths and OOM the boot-time daemon
magica failure mid-run disables adb root locally No unauthenticated root adb port left behind
adb-root teardown hardened for limited-root + shell errors Property files restored correctly even under limited root; permissions re-applied even if a property write fails
Boot logcat capture: dropped stray & Logcat actually runs synchronously now
Safe mode keeps the first disable_all_modules Earlier ?-failing steps can otherwise skip it and bootloop
report_kernel is best-effort A failed report no longer aborts post-fs-data

2.6 Build / version

Change Impact
kpimg / libkptools version markers synced to 0.13.5 Clean builds skip redundant re-downloads
versionCode bumped to 115021

3. Known issues

  • None known at this time.

4. Installation

  • Existing users: install the update over the current version; no uninstall needed.
  • After upgrading, confirm the kernel version shows 0.13.5 in Settings.