This is the reference for the profiles under app/src/main/assets/kernel_profiles/:
field meanings, routes, validation, and how configuration flows between Kotlin
and native.
To add a kernel, follow README.md. For execution-tuning defaults, see defaults.md.
Two version names, not one sequence:
- Profile schema version: the HOCON profile generation, carried by
schema_version(section 2).- Binary wire version: the PRIV1 transport version after magic
0x0D000721. The writer emits wire version2(object sections, section 9). Kotlin and native are bound to the same version.Sections 0 to 10 describe the current v2 configuration. The legacy v1 JSON import path is Kotlin-side only and is collected in section 11.
Built-in profiles, index.conf, shared files, and imported offset files all
parse as HOCON:
- JSON is a subset of HOCON.
#and//comments, trailing commas, and${var}substitution (optional${?var}) are supported. include "file.conf"is supported (relative to the same directory, nestable, loop-safe).AssetConfigLoaderexpands includes when reading assets. Imports prefer a file selected alongside the profile and otherwise look in the bundled shared files, failing loudly when missing so you can reselect.- Kotlin parses the text (
HoconSupport) and sends the typed binary struct to native (section 9). The app stores and exports HOCON. lsprivilege-extract --format confemits a flattened, self-contained profile (credential/KernelSnitch constants inlined, noincludelines) that imports through the normal path.- Extractor output is a candidate source: it writes every field of the
selected route and the shared geometry, using explicit
nullfor unavailable values and never borrowing a neighbouring kernel family's guesses. The app's field validation fillsinvalidPathsand blocks execution, so a successful generation never means the device is supported.
assets/kernel_profiles/<release>.conf built-in profile (HOCON)
assets/kernel_profiles/execution-tuning.conf general execution tuning preset (all kernels)
assets/kernel_profiles/execution-<route>.conf per-route execution tuning preset (loaded by the resolver)
assets/kernel_profiles/credential-6x.conf 6.x credential template
assets/kernel_profiles/kernelsnitch-6x.conf 6.x KernelSnitch values
assets/kernel_profiles/<major.minor>-template.conf reference templates (registered in
index; loadable from the debug page,
never matched automatically)
filesDir/offsets.conf parsed/imported offsets (imported, HOCON)
internal overrides (sparse HOCON text) written by the advanced override page
│
▼ ProfileConfigController.resolve (Kotlin)
resolved profile (one object, every field merged)
│
├──▶ runtime: typed binary (direct and Shizuku both write it to native's stdin)
│ native parses it and uses the geometry; it validates nothing
├──▶ snapshot: filesDir/<release>.conf (HOCON; the source for exports)
└──▶ UI: override page / advanced override tree
Merge priority (low to high): execution-tuning (plus the per-route
execution-<route>.conf) → built-in profile + imported offsets → advanced
overrides. Finally execution.selected_cpus is forced in (from the manual
selection or an explicit imported/override value).
# LSPrivilege kernel profile (HOCON; JSON stays valid)
release = "6.6.77-android15-8-gca30f3b4bef6-abogki440974771-4k"
schema_version = 1
kernel_major = 6
route {
select_stack { waiter_shift = -2 }
}
fallback { to = "none" }
kernelsnitch { collisions = 4, mm_struct_sz = 4096 }
task_struct { prio = 132, cred = 2080, pi_lock = 2316 }
cred { copy_size = 136, caps_offset = 48, caps_count = 5 }
offset { init_task = 34464384, init_cred = 34538824 }
# execution tuning is provided by the resolver from the preset files; write only differences| Field | Type | Meaning |
|---|---|---|
release |
string | Must match the device's uname -r exactly (case and suffix). Template files never participate in matching |
schema_version |
int | Always 1 |
kernel_major |
int | 5 or 6; used for address resolution and sanity checks, not route selection |
route |
object | Explicit route parent with exactly one branch; see section 3 |
fallback |
object | Fallback declaration (to plus an optional route branch); see section 3 |
| geometry | object/int | Grouped by namespace: task_struct / cred / offset / kernelsnitch. Include every field of the active route and the shared geometry; use explicit null for unavailable values, never 0 as a placeholder. Omit unused route branches except a declared fallback |
execution |
object | Advisory tuning. General values come from execution-tuning.conf, per-route values from execution-<route>.conf; the resolver loads both as presets, device profiles don't include them. Write only differences |
The profile declares the route explicitly. Native rejects a missing or unknown
route instead of inferring one. route is a parent with exactly one
branch:
route { tcp_zerocopy { compact_waiter = 1 } }
route { select_stack { waiter_shift = -2 } }
route { multicast_waiter { waiter_off = 96, buffer_size = 264 } }- Each route needs only its own branch. Write no other branch and never leave two branches side by side (one config, one path).
fallbackdeclares a fallback:"to"is"none"or a route name. When you declare a target, also provide the"route"branch holding the fields the fallback needs:The implementation supports falling back fromfallback { to = "select_stack" route { select_stack { waiter_shift = 1 } } }
tcp_zerocopytoselect_stack. Write"to": "none"to disable it.- Native's
RouteKindenum maps one-to-one to the Kotlin values (profile.h/ProfileConfig.Routes).
| Field group | tcp_zerocopy | select_stack | multicast_waiter |
|---|---|---|---|
offset.init_task / offset.init_cred / offset.root_task_group / offset.selinux_enforcing |
required | required | required |
task_struct.prio / task_struct.pi_lock / task_struct.pi_waiters / task_struct.pi_blocked_on / task_struct.cred / task_struct.seccomp |
required | required | required |
kernel_major ∈ {5,6}, cred.copy_size, cred.caps_count, and the credential-template bounds |
required | required | required |
route.tcp_zerocopy.compact_waiter / route.multicast_waiter.compact_waiter |
required | required | |
route.select_stack.waiter_shift |
required (0 is valid) | ||
route.multicast_waiter.waiter_off (>0), route.multicast_waiter.buffer_size, route.multicast_waiter.task_offset, route.multicast_waiter.lock_offset, offset.empty_zero_page, kernelsnitch.mm_struct_sz, cred.ref_count (>0) |
required |
Credential-template bounds (general): cred.usage_offset + 4 ≤ cred.copy_size;
cred.caps_offset + cred.caps_count × 8 ≤ cred.copy_size; cred.ref_count ≤ 4;
each cred.refN_image must be non-zero and
cred.refN_offset + 8 ≤ cred.copy_size. multicast_waiter additionally requires
cred.copy_size ≥ 0xa0 and
route.multicast_waiter.waiter_off + route.multicast_waiter.lock_offset + 8 ≤ route.multicast_waiter.buffer_size.
Configuration field names are the kernel struct member names (offsets inside
the struct). The offset namespace holds kernel-image symbol offsets
(init_task, init_cred, empty_zero_page, …); offset.slide_* are the
KASLR slide anchors. Together with kernel_phys_load they turn symbol
addresses into runtime addresses.
| Field | Meaning |
|---|---|
task_struct.prio / task_struct.normal_prio |
Task priority / normal priority (PI boost check) |
task_struct.sched_task_group |
sched_task_group offset |
task_struct.pi_lock / task_struct.pi_waiters / task_struct.pi_top_task / task_struct.pi_blocked_on |
pi_lock, pi_waiters, pi_top_task, pi_blocked_on |
task_struct.pid / task_struct.tgid |
PID / TGID |
task_struct.atomic_flags |
atomic_flags (used to decide whether state was cleaned up) |
task_struct.real_cred / task_struct.cred |
real cred / cred pointers |
task_struct.comm / task_struct.tasks / task_struct.seccomp |
comm, task list, seccomp |
| Field | Meaning |
|---|---|
cred.copy_size |
Total bytes copied from the credential struct |
cred.usage_offset / cred.usage_value |
Refcount field offset / target value |
cred.caps_offset / cred.caps_count / cred.caps_value |
Capability set offset / count / fill value |
cred.ref_count |
Number of reference fields to repair (≤4) |
cred.refN_offset / cred.refN_image (N=0..3) |
Offset of each reference field / image value to restore |
| Field | Meaning |
|---|---|
offset.init_task / offset.init_cred |
init_task / init_cred offsets relative to the kernel image base |
offset.root_task_group |
root_task_group offset |
offset.selinux_enforcing |
selinux_state.enforcing offset (W1 writes 0) |
offset.selinux_blob_sizes / offset.security_hook_heads |
SELinux / security-hook offsets |
offset.slide_nfulnl_logger / offset.slide_boot_id / offset.slide_loggers_0_1 |
KASLR slide anchors |
kernel_phys_load |
Kernel physical load address (0 falls back to the SoC formula) |
kernel_phys_offset |
DRAM base / linear-map PHYS_OFFSET used for image→direct-map translation (default: compiled P0_PHYS_OFFSET = 0x80000000). Set it for devices whose DRAM base differs (e.g. MTK 0x40000000). A boot.img alone cannot supply it; take it from /proc/iomem (the extractor accepts --iomem, or a MediaTek vendor_boot.img) |
recommend_shizuku |
Whether this kernel recommends the Shizuku path (0/1, default 0 when omitted; advisory only). It is not shown in any editor: for recommended kernels the app turns the home-screen "Run via Shizuku" switch on at every start. You can turn it off for the session, and once off the app stops requiring Shizuku for that session |
| Field | Meaning |
|---|---|
route.select_stack.waiter_shift |
Relative shift of the select-route waiter on the stack (0 is valid); under a fallback declaration this is fallback.route.select_stack.waiter_shift |
route.tcp_zerocopy.compact_waiter |
Compact-waiter layout flag for the tcp route; the multicast branch needs it too (route.multicast_waiter.compact_waiter) |
| Field | Meaning |
|---|---|
route.multicast_waiter.waiter_off |
Offset of the waiter in the multicast buffer (must be > 0) |
route.multicast_waiter.buffer_size |
Forged buffer size |
route.multicast_waiter.task_offset / route.multicast_waiter.lock_offset |
Task / lock field offsets in the buffer |
offset.empty_zero_page |
empty_zero_page offset |
Shared by every route (KernelSnitch drives the mm_struct leak search):
| Field | Meaning |
|---|---|
kernelsnitch.collisions |
Number of futex collisions needed |
kernelsnitch.mm_struct_sz |
SLUB size of mm_struct (falls back to the built-in default when omitted) |
Every execution value is advisory. The app merges them into the profile and
passes the result to native; see defaults.md for semantics and
defaults. The common groups come from execution-tuning.conf. The app resolver
(and the Gradle exporter) loads the route presets directly, so device profiles
don't include them:
recommended_cpus/selected_cpus: suggested and locally selected cores (selected_cpusis maintained by the general parameter override page or the home-screen CPU picker)heap: KernelSnitch search attempt counts and timeoutsrace: route race wait / settle / poll intervalsstages: W1/W2/W3 attempt counts and settle timesroutes.tcp_zerocopy/routes.select_stack: retry and wait parameters inexecution-tcp-zerocopy.conf/execution-select-stack.conf. Themulticast_waiterroute carries geometry only, so it has no execution preset and noroutes.multicast_waitergroup. When composing the native document, Kotlin fills in missing route groups with the defaults, so native always receives a completeroutesobjecthandoff: root handoff and KernelSU load polling
Validation happens in Kotlin (AndroidProfileConfigController.validateProfileFields):
- It checks the common fields and the selected route against the matrix in
section 3. Missing (
null) or zero required fields and out-of-range combinations (credential / multicast bounds) are recorded inProfileConfig.invalidPaths. - On the override pages, invalid entries are shown with a red label (unfilled counts as invalid); overridden and valid entries are yellow.
fallback.tomust be"none"or a valid route name. When a fallback is declared, the target branch's required fields are validated as well (for example, aselect_stackfallback needsfallback.route.select_stack.waiter_shift; 0 is valid).- The home-screen Run button is disabled while
invalidPathsis non-empty; tapping it asks you to fix the red entries. Even if you bypass that,runExploitblocks before starting native and writes to the log. - Native validates no geometry. It parses the v2 binary and executes the component selection and fields it was given.
| Layer | Source | Location | Written by |
|---|---|---|---|
| shared | shared values; the resolver/exporter load the tuning presets, device profiles include the core ones |
execution-tuning.conf / execution-<route>.conf / credential-6x.conf / kernelsnitch-6x.conf |
shipped with the app |
| builtin | exact uname -r match; no match means unsupported |
assets/kernel_profiles/*.conf |
shipped with the app |
| imported | parsed/imported offsets (same release entry) | filesDir/offsets.conf |
Parse OTA / import config |
| general override | execution.* |
the release entry in filesDir/offsets.conf |
override page "general parameter override / reset" |
| route override | route / fallback.to |
the release entry in filesDir/offsets.conf |
advanced override page "route / fallback" |
| advanced override | any numeric path (sparse HOCON text) | internal debug_profile_overrides |
advanced override (auto-saved) |
| snapshot | the fully merged HOCON | filesDir/<release>.conf |
after any override is saved, before export |
| manual built-in source | another real release (dangerous) | internal debug_builtin_release |
parameter page "load another built-in (dangerous)"; overrides stay bound to the device release |
Export writes the merged snapshot for that release (one HOCON file, includes already merged, tuning trimmed to the selected routes) into a folder you pick via SAF.
- One per kernel family:
5.15-template/6.1-template/6.6-template/6.12-template, registered inindex.conf, for development and debugging reference only. - Every geometry/offset field is
null(unfilled) androute/fallbackshow the full branch structure; each field has a Chinese comment you can copy from. - The built-in picker's "templates (reference, unfilled)" section can load them to inspect the field structure. Templates never participate in device matching and never auto-fall-back: a device with no exact match and no imported offsets is treated as unsupported.
- A template carries only core fields (plus the core
includes); execution tuning is provided by the resolver fromexecution-*.conf, so copying a template needs no tuninginclude. Synchronized copies live indocs/kernel_profiles/templates/; the originals under assets can be viewed with adb.
Runtime configuration crosses as a typed binary struct (v2, object sections), not JSON text. v2 is the only version: Kotlin and native are version-bound and there is no legacy decode.
- Kotlin serializes it from
NativeProfileDocumentviatoBinary(): a 16-byte little-endian headeru32 magic(0x0D000721) + u16 version(2) + u16 frontend + u16 backend + u16 middleware + u16 release_len + u16 reserved, then thereleasetext, thenu16 section_count, then per sectionu8 name_len + name + u32 entry_count, then per entryu8 key_len + key + u64 value. Presence is carried by key occurrence (an omitted field differs from a provided 0), values are raw u64 bit patterns (signed values use two's complement) and are never clamped, only the active route'sroute.*section is written or accepted, unknown sections/keys are ignored and duplicate keys are last-wins.middlewarecarries the route. The authoritative section/key tables areprofile/binary.cpp(kSections); the Kotlin object sections inNativeProfile.ktmust follow them exactly. - App invocation: direct and Shizuku both pass the profile on stdin with
--lsprivilege-app-call. The app does not writeactive-profile.bin. For CLI runs,--load-prebuilt-profile <bin>reads an exported PRIV1 file. - Native has exactly one decode path:
profile/entry.cpphands the stdin (or file) bytes toprofile/binary.cpp::parse. It detects no format other than the magic and has no JSON fallback. - Internal storage and "export config" are HOCON (human-readable). The legacy
v1
offsets.jsonis converted to v2 only on the Kotlin side; see section 11. - Runtime route and capability decisions (
TargetProfile::route(),TargetProfile::supports(),route_capability) all use the decoded route.
- Every profile carries every field of its active route plus the shared
geometry, and each such field must be present. A value the image or device
cannot supply is written as an explicit
null(never0as a placeholder, unless 0 is the real value). Fields of routes other than the active one (and its declared fallback) are omitted.lsprivilege-extract --format confemits this complete skeleton;nullkeeps the field visible and editable in the app instead of silently absent. routehas exactly one branch, and that branch must carry the route's required fields. Whenfallback.tonames a target, fill thefallback.routebranch the same way. Pull shared core values in withincludeinstead of copying:credential-6x.conf(6.x credential template) andkernelsnitch-6x.conf(6.x collisions). Execution tuning (execution-tuning.conf/execution-<route>.conf) is loaded by the resolver as a preset; don'tincludeit in a device profile.- Change
executiononly with device measurements; otherwise keep the defaults. - Verify locally:
make -C src native-host-tests(profile decode/validation vectors) and./gradlew :app:assembleDebug. - When renaming or regrouping fields, update
FieldLabels.kt+values*/strings.xmland, when relevant,docs/kernel_profiles/defaults*.md.
This section collects the v1 JSON compatibility layer. Native reads v2 exclusively (section 9); the v1 path is Kotlin-side and self-contained.
-
v1 is the old JSON format: the
offsets.jsonof the remote/main era, an extractor report (symbols/struct_fields, four top-level scalars, and metadata such askimage_text_base/btf_size/kallsyms).lsprivilege-extract --format jsonstill emits this shape for external tools. -
LegacyProfileConverternormalizes a v1 document to v2 on load, idempotently:v1 content Conversion result symbolsobject (off_*keys)offset.*namespacestruct_fieldsobject (task_*keys)task_struct.*namespace; a few fields (rt_mutex_waiter,cred_uid,seccomp_*, …) stay in place and take no part in validation/comparisontop-level pselect_waiter_shiftroute.select_stack.waiter_shift(asfallback.route.select_stack.waiter_shiftfor a tcp profile)top-level compact_waiter/mm_struct_szroute.tcp_zerocopy.compact_waiter/kernelsnitch.mm_struct_szkimage_text_base/btf_size/kallsymsdropped no routefieldinferred from 6.x geometry: compact_waiter→ tcp, otherwise selectno cred template seeds the bundled 6.x constants ( credential-6x.conf/kernelsnitch-6x.conf); 5.x credential fields stay author-supplied -
Old flat keys (
kernelsnitch_collisions/mm_struct_sz/task_*/cred_*/off_*/mcast_*) are folded into the matching namespaces when importing an oldoffsets.json, parsing extractor output, or reading advanced overrides. -
The same route inference applies to an old config with no
route:kernel_major == 5 && mcast.waiter_off > 0→multicast_waiter; otherwisecompact_waiter != 0→tcp_zerocopy; otherwiseselect_stack. A v1 document can never select the 5.x branch (multicast_waiteris retained only as a guarded inference). -
Old JSON caches are not migrated and are discarded at startup. Internal storage, snapshots, and exports are always HOCON.
-
Native has no v1 parser: the native
legacy/JSON decoder was removed; a v1 document is converted to v2 on the Kotlin side before transport.