Repository navigation
Conversation
ksu_stub_next only ever grew: when a branch site was removed the site table was compacted but its stub slot was never returned. Each selinux_hide enable/disable cycle therefore leaked ~5 stubs, so after roughly 50 toggles in one boot ksu_rkp_branch_patch() failed with "stub page full" until reboot. Add a small free list of returned indices, reused before growing ksu_stub_next. A slot is allocated per live site and freed when the site is removed, so at most KSU_MAX_BRANCH_SITES slots are ever outstanding and ksu_stub_next stays bounded by that. The early capacity check is folded into ksu_stub_alloc(), and the two install rollback paths and the removal path now return the slot instead of blindly decrementing the counter. ksu_rkp_branch_exit() resets the free list alongside the page. No behavioural change when hooks are installed once and left in place.
|
tested on s22 ultra. before: after: |
ksu_stub_next only ever grew: when a branch site was removed the site table was compacted but its stub slot was never returned. Each selinux_hide enable/disable cycle therefore leaked ~5 stubs, so after roughly 50 toggles in one boot ksu_rkp_branch_patch() failed with "stub page full" until reboot.
Add a small free list of returned indices, reused before growing ksu_stub_next. A slot is allocated per live site and freed when the site is removed, so at most KSU_MAX_BRANCH_SITES slots are ever outstanding and ksu_stub_next stays bounded by that. The early capacity check is folded into ksu_stub_alloc(), and the two install rollback paths and the removal path now return the slot instead of blindly decrementing the counter. ksu_rkp_branch_exit() resets the free list alongside the page.
No behavioural change when hooks are installed once and left in place.