🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
3 messages
3 total messages Started by Lin Ma Mon, 23 Nov 2026 01:13
[PATCH net] rxrpc: Fix overread of short key descriptions
#20629
Author: Lin Ma
Date: Mon, 23 Nov 2026 01:13
33 lines
9672 bytes
rxrpc_read() checks whether the key description starts with "afs@" by
calling memcmp() with a length of 4.  The description is an arbitrary
NUL-terminated string supplied when the key is created and is only
required to be non-empty, so it can be as short as one character.  In
that case memcmp() reads up to two bytes past the end of the
kmemdup()'d description (which is strlen(description) + 1 bytes long).

The result of the comparison is not affected because the NUL terminator
is reached within the first four bytes, and the overread is normally
confined to the slab object, but it is still an out-of-bounds read.

Use str_has_prefix(), which stops at the NUL terminator.

Fixes: ed6dd18b5aceb ("RxRPC: Allow RxRPC keys to be read")
Signed-off-by: Lin Ma <linma@zju.edu.cn>
---
 net/rxrpc/key.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c
index cbd26da44951..019e512aeb1f 100644
--- a/net/rxrpc/key.c
+++ b/net/rxrpc/key.c
@@ -746,7 +746,7 @@ static long rxrpc_read(const struct key *key,
 	_enter("");
 
 	/* we don't know what form we should return non-AFS keys in */
-	if (memcmp(key->description, "afs@", 4) != 0)
+	if (!str_has_prefix(key->description, "afs@"))
 		return -EOPNOTSUPP;
 	cnlen = strlen(key->description + 4);
 
Re: [PATCH net] rxrpc: Fix overread of short key descriptions
#20632
Author: netdev-bot+sinfo
Date: Mon, 23 Nov 2026 01:18
23 lines
8539 bytes
Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - How the issue was discovered, e.g. hit in production, hit during
   development, syzbot report, manual code inspection, LLM or static
   analysis tool scan.

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
Re: [PATCH net] rxrpc: Fix overread of short key descriptions
#20652
Author: Lin Ma
Date: Mon, 23 Nov 2026 02:12
16 lines
9134 bytes
Hi,

Found by code inspection/static analysis while auditing rxrpc key
handling.  I did exercise the path at runtime: add_key("rxrpc", "a",
NULL, 0, ...) followed by keyctl_read() reaches the
memcmp(key->description, "afs@", 4) and returns -EOPNOTSUPP.

It is only a C-level overread: kmalloc rounds the 2-byte description up
to an 8-byte object, the inlined 4-byte load is not KASAN-instrumented,
and the extra bytes are slab padding.  There is no crash, no KASAN
report and no user-visible effect, so this is a small correctness/UB
fix rather than a runtime-triggered bug.

Thanks,
Lin Ma
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads