diff options
| author | Daehyeon Ko <4ncienth@gmail.com> | 2026-09-25 17:05:48 +0900 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-10-08 23:04:45 -0700 |
| commit | 61192bf3db8a58ba9af50589be61304835e10380 (patch) | |
| tree | aa5a2da22baa142d7e3fcedc4fa7f4d722b3b26b /tools/lib/python/kdoc/parse_data_structs.py | |
| parent | 17b3661d2c63c4b522d15fdaaa235d5d1266fa31 (diff) | |
| download | linux-next-61192bf3db8a58ba9af50589be61304835e10380.tar.gz linux-next-61192bf3db8a58ba9af50589be61304835e10380.zip | |
assoc_array: discard shortcut when collapsing a leaf-only node
assoc_array_delete() can collapse a subtree into a node that contains only
leaves while retaining the shortcut that led to it. If that node later
fills, all_leaves_cluster_together replaces it with another shortcut. The
first shortcut then points directly to the second one.
assoc_array_apply_edit() publishes this topology and propagates branch
counts from the new child node. It skips the inner shortcut, encounters
the outer shortcut where it requires a node and triggers the BUG_ON().
Linux v7.2 and v6.12.105 are affected. The same root remains at the
base-commit below and in every supported stable branch checked down to
5.10. It requires CONFIG_KEYS, but no capability, user namespace or race.
A UID/GID 1000 process produced:
CONTROL_BEGIN mode=exact uid=1000 gid=1000
CONTROL_CapEff: 0000000000000000
kernel BUG at lib/assoc_array.c:1388!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 0 UID: 1000 PID: 154 Comm: exploit
RIP: assoc_array_apply_edit+0x4aa/0x690
Call Trace:
__key_link
__key_instantiate_and_link
__key_create_or_update
__do_sys_add_key
Kernel panic - not syncing: Fatal exception
When deletion produces a leaf-only node, bypass its preceding shortcut as
garbage collection already does. Retire the shortcut and old node
together after an RCU grace period; reused leaves keep their references
and the deleted leaf is still freed separately.
The exact trigger reached the BUG in 3/3 unmodified v7.2 KASAN boots and
completed cleanly in 3/3 fixed boots. Fixed v6.12.105 also passed 3/3. A
source reproducer is available privately on request.
Link: https://lore.kernel.org/20260925080548.2505640-1-4ncienth@gmail.com
Fixes: 3cb989501c26 ("Add a generic associative array implementation.")
Signed-off-by: Daehyeon Ko <4ncienth@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Assisted-by: LLM
Cc: David Howells <dhowells@redhat.com>
Cc: <stable@vger.kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/parse_data_structs.py')
0 files changed, 0 insertions, 0 deletions
