Re: [PATCH 0/3] keys: fix keyring assoc-array out-of-bounds read and index inconsistency
Andrew Morton <[email protected]> Mon, 13 Jul 2026 19:11:39 -0700
| Newsgroups | org.kernel.vger.keyrings,org.kernel.vger.linux-kernel,org.kernel.vger.linux-security-module |
|---|---|
| Message-ID | <[email protected]> |
On Sat, 11 Jul 2026 21:44:57 -0400 Michael Bommarito <[email protected]> wrote: > keyring_get_key_chunk() advances the description read pointer by > level * sizeof(long) past the inline prefix but only bounds-checks the > prefix, so once the associative-array walk reaches a description-level > chunk it reads past the kmemdup(desc, desc_len + 1) description > allocation. Reaching that depth needs two keys that collide through the > hash, x, type and domain_tag chunks, which an unprivileged add_key(2) > can arrange with a crafted pair of same-type keys. > > An unprivileged user can thus read up to sizeof(long) bytes past a > keyring key's description; on kernels built without init-on-alloc the > same collision, read back with KEYCTL_READ, returns uninitialized kernel > slab. > > Patch 1 is the memory-safety fix and stands alone. Patches 2 and 3 fix > two index-key consistency bugs that let the crafted keys collide into a > single malformed node in the first place, which is what enables the > KEYCTL_READ disclosure. > > The KASAN reproduction is on patch 1. Trigger is available off-list. fyi, AI review might have found things, some pre-existing: https://sashiko.dev/#/patchset/[email protected] David, you might wish to take a look at the first assoc_array.c issue.