You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fgetpriority v0.0.4 fails to load on a 5.10.209 vendor kernel - "Unknown symbol init_user_ns (err -2)" #14
Module: fgetpriority v0.0.4 (versionCode 4), installed from fgetpriority_v0.0.4.zip
Problem
The module never loads. lsmod has no fgetpriority, /sys/module/fgetpriority does not exist, and service.sh fails on every boot.
Manual reproduction:
insmod /data/adb/modules/fgetpriority/ko/fgetpriority.ko kallsyms_lookup_name_fn=0xffffffd8402acaf8
# insmod: can't insert '.../fgetpriority.ko': unknown symbol in module, or unknown parameter
dmesg:
fgetpriority: Unknown symbol init_user_ns (err -2)
What I checked
The shipped fgetpriority.ko is vermagic=5.10.252-dirty SMP preempt mod_unload modversions aarch64, i.e. built against a newer ACK than this 5.10.209 vendor kernel.
Vermagic mismatch is not the blocker: pathmask.ko and rekernel_x-...ko here also carry vermagic=5.10.252-dirty and they load fine on this kernel (lsmod shows both).
init_user_nsis in this kernel's /proc/kallsyms (ffffffd8427af6f8 D init_user_ns), but it is not exported to modules, so the loader returns -ENOENT. Looks like the build depends on init_user_ns being exported, which this older MTK vendor kernel does not do.
service.sh falls back to ksud insmod ... when insmod fails, but this is a Magisk setup with no ksud, so there is no fallback path.
Questions
Is there a build for older 5.10 vendor kernels (5.10.209, MT6895)? The release only ships a single fgetpriority_v0.0.4.zip.
If not, could the init_user_ns dependency be dropped or resolved at runtime (the module already takes kallsyms_lookup_name_fn=, so it could look the symbol up the same way) so one binary works on kernels where it is not exported?
Slightly related to Older Kernel support #13 (4.19 support), but this is a different case: same 5.10 major, different export set.
Tested the PR #15 build (android12-5.10 artifact from run 42574987602, commit 9dce879) on the same device/kernel as the original report (MT6895, 5.10.209-android12-9-00019-g4ea09a298bb4-ab12292661, Magisk 31.1).
init_user_ns is fixed — it no longer appears in the module's undefined symbol list and the loader no longer complains about it. The next blocker is symbol_get():
insmod: can't insert '.../fgetpriority.ko': unknown symbol in module
dmesg: fgetpriority: Unknown symbol __symbol_get (err -2)
main.c:213-214 calls symbol_get(register_kprobe) / symbol_get(unregister_kprobe). symbol_get() resolves through the exported symbol table, and this vendor kernel does not export __symbol_get (it exists at ffffffef970aaaa0 T, but the loader returns -ENOENT), so those two call sites fail at load time, before any init code runs — it can't be handled at runtime.
Workaround I verified on-device (binary patch of the CI artifact, to test without a rebuild):
.init.text has two R_AARCH64_CALL26 relocations against __symbol_get (r_offset 0xac and 0xc0). Set both r_info to R_AARCH64_NONE, rewrite the two bl instructions to mov x0, #0 (0xd2800000), and mark the __symbol_get symtab entry SHN_ABS so simplify_symbols() doesn't try to resolve it.
This build's __versions section is empty, so there were no modversion CRCs to fix up. With a populated CRC list this shortcut would not work.
It stays loaded, survives rmmod + reload, and comes up on a real reboot.
Suggested source fix: in bootstrap:, drop the two symbol_get() lines and goto bootstrap_scan; directly. __register_kprobe() already resolves register_kprobe lazily via kallsyms_lookup_name(), so the kprobe path — the one that actually gets armed on this kernel anyway — is unaffected. If you'd rather keep the fast path for kernels that do export it, gating it on kallsyms_lookup_name("__symbol_get") != NULL also works, but simply removing it is cleaner.
Unrelated nit in the same diff: getpriority_should_swap()'s first branch lost the uid_valid(host_kuid) guard that master has (the second branch still has it), so a failed make_kuid() now feeds (uid_t)-1 into from_kuid(). Worth restoring.
Happy to send the patched .ko or the patch script if that helps.
Just tested PR #15 head (1cdb2fc, run 42580262619, android12-5.10 artifact) unmodified on the same device/kernel (MT6895, 5.10.209-android12-9-00019-g4ea09a298bb4-ab12292661, Magisk 31.1). It loads and works now:
No undefined symbols left, no binary patching needed, and it comes up cleanly through service.sh on a cold boot as well. Thanks for the quick turnaround.
One leftover from my previous comment that's still in this diff: getpriority_should_swap()'s first branch no longer has the uid_valid(host_kuid) guard that master has (the second branch still has it), so a failed make_kuid() now feeds (uid_t)-1 into from_kuid(). Worth putting back before merging.
Tested run 44053486317 (master 9a38e02, android12-5.10 artifact, sha256 e1e9089a9798640494edfd206b46d5e7d90cfd62a66b86e286448e76e8437516) on the same device/kernel as the original report (MT6895, 5.10.209-android12-9-00019-g4ea09a298bb4-ab12292661, Magisk 31.1).
It does not load.
# insmod fgetpriority.ko kallsyms_lookup_name_fn=0xffffffebe66acaf8
insmod: can't insert '.../fgetpriority.ko': unknown symbol in module, or unknown parameter
dmesg:
fgetpriority: Unknown symbol aarch64_get_branch_offset (err -2)
No Hello World! line at all — it dies during relocation, before init runs. Reproduced twice, and lsmod stays empty.
This also hits a fresh install from the fgetpriority_v0.0.4.zip in that run: the zip's ko/android12-5.10_arm64_fgetpriority.ko is the same file (same sha256), and customize.sh resolves 5.10.209-android12-9-... to the android12-5.10 KMI.
Cause
9a38e02 ("kernel: update arm64_branch_patch") renamed kernel/arm64_branch_insn.h -> kernel/arm64_branch_patch.h and changed the guard on the local fallback:
With defined(MODULE) gone, a module build no longer carries its own __weak aarch64_get_branch_offset(), it references the kernel symbol instead. Symbol tables (old = the v0.0.4 ko installed here, new = this artifact):
aarch64_get_branch_offset
UND entries
old
FUNC WEAK, defined in .text
14
new
NOTYPE GLOBAL UND
15
Diffing the two undefined-symbol sets gives exactly one entry, aarch64_get_branch_offset; nothing else changed.
This kernel does have the symbol — ffffffebe648c98c T aarch64_get_branch_offset — but there is no __ksymtab_aarch64_get_branch_offset, so it is not exported and insmod gets -ENOENT. Same failure class as the old __symbol_get problem, except this one can't be handled at runtime: it's a direct bl relocation from arm64_branch_patch().
Why CI stayed green: the DDK android12-5.10 KDIR exports it, so modpost has nothing to report — there is no undefined! line in the job log (job 133936843727). Only vendor kernels without the export are affected, which is exactly the class of kernel this issue is about.
A module build always has MODULE defined, so this only affects module builds, and a local weak definition takes precedence if the kernel happens to export it too. Alternatively resolve it through kallsyms_lookup_name_fn the way init_user_ns is handled, but since the only user is inside arm64_branch_patch() that needs a function-pointer indirection; the guard is the smaller change.
Other notes
The uid_valid(host_kuid) issue from my earlier comments is fixed — both branches in getpriority_should_swap() are guarded now.
Device state: I rmmod'ed and reloaded the working v0.0.4 ko after the test, so it's back to
Works now. Tested run 44308157155 (3a08277, android12-5.10 artifact, sha256 4f2514d3044e7ca8533c070c8e487e0b3a0a6d61ed2b5be8a8aa9e40547e2b1c) on the same device/kernel (MT6895, 5.10.209-android12-9-00019-g4ea09a298bb4-ab12292661, Magisk 31.1).
fgetpriority: init: Hello World!
fgetpriority: kallsyms_lookup_name: 0xffffffebe66acaf8 (via module_param)
fgetpriority: arm64_branch_patch: found call site at 0xffffffebead0112c w/ .inst 0x97fffffc
fgetpriority: arm64_branch_patch: callsite 0xffffffebead0112c to hook 0xffffffebe654cf68 inside range! (delta: -75186628 bytes)
fgetpriority: arm64_branch_patch: patched callsite: 0xffffffebead0112c ret: 0
fgetpriority: patch_hook: gphook_find_user ret: 0
fgetpriority: arm64_branch_patch: found call site at 0xffffffebead01198 w/ .inst 0x97ffffd7
fgetpriority: arm64_branch_patch: callsite 0xffffffebead01198 to hook 0xffffffebe654ce20 inside range! (delta: -75187064 bytes)
fgetpriority: arm64_branch_patch: patched callsite: 0xffffffebead01198 ret: 0
fgetpriority: arm64_branch_patch: found call site at 0xffffffebe6564fb8 w/ .inst 0x97ff9fec
fgetpriority: arm64_branch_patch: callsite 0xffffffebe6564fb8 to hook 0xffffffebead015b8 inside range! (delta: 75089408 bytes)
fgetpriority: arm64_branch_patch: patched callsite: 0xffffffebe6564fb8 ret: 0
fgetpriority: arm64_branch_patch: found call site at 0xffffffebe65603d4 w/ .inst 0x97ffb2e5
fgetpriority: arm64_branch_patch: callsite 0xffffffebe65603d4 to hook 0xffffffebead015b8 inside range! (delta: 75108836 bytes)
fgetpriority: arm64_branch_patch: patched callsite: 0xffffffebe65603d4 ret: 0
fgetpriority: arm64_branch_patch: found call site at 0xffffffebe6d68f40 w/ .inst 0x97df900a
fgetpriority: arm64_branch_patch: callsite 0xffffffebe6d68f40 to hook 0xffffffebead015b8 inside range! (delta: 66684536 bytes)
fgetpriority: arm64_branch_patch: patched callsite: 0xffffffebe6d68f40 ret: 0
fgetpriority: arm64_branch_patch: found call site at 0xffffffebe6d69680 w/ .inst 0x97df8e3a
fgetpriority: arm64_branch_patch: callsite 0xffffffebe6d69680 to hook 0xffffffebead015b8 inside range! (delta: 66682680 bytes)
fgetpriority: arm64_branch_patch: patched callsite: 0xffffffebe6d69680 ret: 0
fgetpriority: getpriority_hook_init: ok!
fgetpriority: init: ret: 0
fgetpriority: init: ok!
aarch64_get_branch_offset is a local FUNC WEAK again and the undefined-symbol set is back to the 14 entries the working v0.0.4 build had, so the relocation failure is gone.
Worth noting: on this kernel the raw branch path now succeeds — 6 callsites patched, init: ret: 0, no falling back to kprobes! line. The old v0.0.4 build here always bailed out (callsite instruction not found! → falling back to kprobes!) and ran on the kprobe path, so the "patch all callsites in the window" change actually gets the fast path working on this vendor kernel. That also means v0.0.4's runtime behaviour on this device changes with this build (kprobe → raw patch), in case you want that called out in the release notes.
Reload / boot path
rmmod then insmod again: rc=0 both times, and the second load patches the identical set of 6 addresses (112c, 1198, 64fb8, 603d4, d68f40, d69680) — no drift, no double-patch artefacts.
Simulated the boot path with the zip's own service.sh: copied the module tree to a scratch MODDIR, dropped the android12-5.10 ko in as ko/fgetpriority.ko, ran the script. It resolves the kallsyms addr, insmod rc=0, init: ok!. customize.sh's KMI detection also lands on android12-5.10 for 5.10.209-android12-9-....
The ko inside fgetpriority_v0.0.4.zip (release asset updated at 12:55:08Z, 55209 bytes) is byte-identical to the standalone artifact: same sha256 4f2514d3….
Splat check
The only kernel warning around all this is the sysfs one, and it is not from this build:
WARNING: CPU: 0 PID: 31023 at fs/sysfs/group.c:281 sysfs_remove_group+0x148/0x1bc
It appears on unload only, and it appears identically when unloading the stock v0.0.4 ko, so it predates the fix (#notabug). No oops, no BUG, nothing under load.
What I have not verified: the actual hiding semantics (find_user() returning NULL for a foreign uid with seccomp on), since that needs a real app process calling getpriority() cross-uid. Only load/patch/reload/boot-path behaviour is covered above.
Device is currently running this build; happy to install the zip properly and check it after a reboot if you want that too.
Activity
backslashxx commentedon Nov 9, 2026
#15
see if this works
KANGKKKKKKK commentedon Nov 9, 2026
Tested the PR #15 build (
android12-5.10artifact from run 42574987602, commit 9dce879) on the same device/kernel as the original report (MT6895, 5.10.209-android12-9-00019-g4ea09a298bb4-ab12292661, Magisk 31.1).init_user_nsis fixed — it no longer appears in the module's undefined symbol list and the loader no longer complains about it. The next blocker issymbol_get():main.c:213-214callssymbol_get(register_kprobe)/symbol_get(unregister_kprobe).symbol_get()resolves through the exported symbol table, and this vendor kernel does not export__symbol_get(it exists atffffffef970aaaa0 T, but the loader returns -ENOENT), so those two call sites fail at load time, before any init code runs — it can't be handled at runtime.Workaround I verified on-device (binary patch of the CI artifact, to test without a rebuild):
.init.texthas twoR_AARCH64_CALL26relocations against__symbol_get(r_offset0xac and 0xc0). Set bothr_infotoR_AARCH64_NONE, rewrite the twoblinstructions tomov x0, #0(0xd2800000), and mark the__symbol_getsymtab entrySHN_ABSsosimplify_symbols()doesn't try to resolve it.__versionssection is empty, so there were no modversion CRCs to fix up. With a populated CRC list this shortcut would not work.Result on the device:
It stays loaded, survives
rmmod+ reload, and comes up on a real reboot.Suggested source fix: in
bootstrap:, drop the twosymbol_get()lines andgoto bootstrap_scan;directly.__register_kprobe()already resolvesregister_kprobelazily viakallsyms_lookup_name(), so the kprobe path — the one that actually gets armed on this kernel anyway — is unaffected. If you'd rather keep the fast path for kernels that do export it, gating it onkallsyms_lookup_name("__symbol_get") != NULLalso works, but simply removing it is cleaner.Unrelated nit in the same diff:
getpriority_should_swap()'s first branch lost theuid_valid(host_kuid)guard that master has (the second branch still has it), so a failedmake_kuid()now feeds(uid_t)-1intofrom_kuid(). Worth restoring.Happy to send the patched
.koor the patch script if that helps.backslashxx commentedon Nov 9, 2026
I will just remove symbol_get
backslashxx commentedon Nov 9, 2026
see #15 again
KANGKKKKKKK commentedon Nov 9, 2026
Just tested PR #15 head (
1cdb2fc, run 42580262619,android12-5.10artifact) unmodified on the same device/kernel (MT6895, 5.10.209-android12-9-00019-g4ea09a298bb4-ab12292661, Magisk 31.1). It loads and works now:No undefined symbols left, no binary patching needed, and it comes up cleanly through
service.shon a cold boot as well. Thanks for the quick turnaround.One leftover from my previous comment that's still in this diff:
getpriority_should_swap()'s first branch no longer has theuid_valid(host_kuid)guard that master has (the second branch still has it), so a failedmake_kuid()now feeds(uid_t)-1intofrom_kuid(). Worth putting back before merging.backslashxx commentedon Nov 9, 2026
e0aaedb
https://github.com/aerath-stuff/fgetpriority/actions/runs/42581797198
backslashxx commentedon Nov 18, 2026
@KANGKKKKKKK test this and send me log
https://github.com/aerath-stuff/fgetpriority/actions/runs/44053486317
dmesg | grep fgetpriority
KANGKKKKKKK commentedon Nov 18, 2026
Tested run 44053486317 (master
9a38e02,android12-5.10artifact, sha256e1e9089a9798640494edfd206b46d5e7d90cfd62a66b86e286448e76e8437516) on the same device/kernel as the original report (MT6895,5.10.209-android12-9-00019-g4ea09a298bb4-ab12292661, Magisk 31.1).It does not load.
dmesg:
No
Hello World!line at all — it dies during relocation, beforeinitruns. Reproduced twice, andlsmodstays empty.This also hits a fresh install from the
fgetpriority_v0.0.4.zipin that run: the zip'sko/android12-5.10_arm64_fgetpriority.kois the same file (same sha256), andcustomize.shresolves5.10.209-android12-9-...to theandroid12-5.10KMI.Cause
9a38e02("kernel: update arm64_branch_patch") renamedkernel/arm64_branch_insn.h->kernel/arm64_branch_patch.hand changed the guard on the local fallback:With
defined(MODULE)gone, a module build no longer carries its own__weak aarch64_get_branch_offset(), it references the kernel symbol instead. Symbol tables (old= the v0.0.4 ko installed here,new= this artifact):aarch64_get_branch_offsetFUNC WEAK, defined in.textNOTYPE GLOBAL UNDDiffing the two undefined-symbol sets gives exactly one entry,
aarch64_get_branch_offset; nothing else changed.This kernel does have the symbol —
ffffffebe648c98c T aarch64_get_branch_offset— but there is no__ksymtab_aarch64_get_branch_offset, so it is not exported andinsmodgets-ENOENT. Same failure class as the old__symbol_getproblem, except this one can't be handled at runtime: it's a directblrelocation fromarm64_branch_patch().Why CI stayed green: the DDK
android12-5.10KDIR exports it, so modpost has nothing to report — there is noundefined!line in the job log (job 133936843727). Only vendor kernels without the export are affected, which is exactly the class of kernel this issue is about.Suggested fix
Put the module half of the guard back:
A module build always has
MODULEdefined, so this only affects module builds, and a local weak definition takes precedence if the kernel happens to export it too. Alternatively resolve it throughkallsyms_lookup_name_fnthe wayinit_user_nsis handled, but since the only user is insidearm64_branch_patch()that needs a function-pointer indirection; the guard is the smaller change.Other notes
The
uid_valid(host_kuid)issue from my earlier comments is fixed — both branches ingetpriority_should_swap()are guarded now.Device state: I
rmmod'ed and reloaded the working v0.0.4 ko after the test, so it's back toPing me when there's a rebuild and I'll retest.
backslashxx commentedon Nov 18, 2026
oh yeah, lemme fix that
try this @KANGKKKKKKK https://github.com/aerath-stuff/fgetpriority/actions/runs/44308157155
KANGKKKKKKK commentedon Nov 18, 2026
Works now. Tested run 44308157155 (
3a08277,android12-5.10artifact, sha2564f2514d3044e7ca8533c070c8e487e0b3a0a6d61ed2b5be8a8aa9e40547e2b1c) on the same device/kernel (MT6895,5.10.209-android12-9-00019-g4ea09a298bb4-ab12292661, Magisk 31.1).Loads
dmesg, full init:
aarch64_get_branch_offsetis a localFUNC WEAKagain and the undefined-symbol set is back to the 14 entries the working v0.0.4 build had, so the relocation failure is gone.Worth noting: on this kernel the raw branch path now succeeds — 6 callsites patched,
init: ret: 0, nofalling back to kprobes!line. The old v0.0.4 build here always bailed out (callsite instruction not found!→falling back to kprobes!) and ran on the kprobe path, so the "patch all callsites in the window" change actually gets the fast path working on this vendor kernel. That also means v0.0.4's runtime behaviour on this device changes with this build (kprobe → raw patch), in case you want that called out in the release notes.Reload / boot path
rmmodtheninsmodagain: rc=0 both times, and the second load patches the identical set of 6 addresses (112c, 1198, 64fb8, 603d4, d68f40, d69680) — no drift, no double-patch artefacts.service.sh: copied the module tree to a scratch MODDIR, dropped theandroid12-5.10ko in asko/fgetpriority.ko, ran the script. It resolves the kallsyms addr,insmodrc=0,init: ok!.customize.sh's KMI detection also lands onandroid12-5.10for5.10.209-android12-9-....fgetpriority_v0.0.4.zip(release asset updated at 12:55:08Z, 55209 bytes) is byte-identical to the standalone artifact: same sha2564f2514d3….Splat check
The only kernel warning around all this is the sysfs one, and it is not from this build:
It appears on unload only, and it appears identically when unloading the stock v0.0.4 ko, so it predates the fix (
#notabug). No oops, no BUG, nothing under load.What I have not verified: the actual hiding semantics (
find_user()returning NULL for a foreign uid with seccomp on), since that needs a real app process callinggetpriority()cross-uid. Only load/patch/reload/boot-path behaviour is covered above.Device is currently running this build; happy to install the zip properly and check it after a reboot if you want that too.