Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Andrew Stellman
Sat, 28 Nov 2026 14:08
[PATCH net] tipc: reject bundles too short for an inner header
Author: Andrew Stellman
Date: Sat, 28 Nov 2026 14:08
Date: Sat, 28 Nov 2026 14:08
48 lines
13072 bytes
13072 bytes
From: Andrew Stellman <astellman@stellman-greene.com>
tipc_msg_extract() checks *pos against msg_data_sz(hdr) - MIN_H_SIZE.
msg_data_sz() is unsigned, so for a header-only MSG_BUNDLER, which
tipc_msg_validate() accepts, the subtraction wraps and the check
passes. The following msg_size(ihdr) then reads four bytes past the
end of the bundle. Check that the data can hold an inner header
before subtracting.
Tested on mainline (7cd8495c0f16) in arm64 QEMU with KASAN. A test-only
debugfs hook, not part of this patch, built a header-only bundle in the
kernel, passed it to tipc_msg_validate() and tipc_msg_extract(), and
poisoned 8 bytes of tailroom after it as a redzone so KASAN would flag
the read. No live TIPC link was used, and the bundle didn't come from a
peer. Without this patch KASAN reported a 4 byte read in
tipc_msg_extract() in both of two runs; with it, none in one run. A
bundle holding one valid 24 byte message was extracted the same way in
all three runs. No selftests were run.
Fixes: ef9be755697f ("tipc: eliminate buffer cloning in function tipc_msg_extract()")
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
The issue was found by Claude Opus 5.5 running Quality Playbook, an
LLM-driven code review tool:
https://github.com/andrewstellman/quality-playbook
The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with
Claude Opus 5.5, and both were reviewed by me.
A reproducer is available on request.
net/tipc/msg.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/tipc/msg.c b/net/tipc/msg.c
index 39dfd33c8eecc8..657c0709a0f7a1 100644
--- a/net/tipc/msg.c
+++ b/net/tipc/msg.c
@@ -600,7 +600,8 @@ bool tipc_msg_extract(struct sk_buff *skb, struct sk_buff **iskb, int *pos)
goto none;
hdr = buf_msg(skb);
- if (unlikely(*pos > (msg_data_sz(hdr) - MIN_H_SIZE)))
+ if (unlikely(msg_data_sz(hdr) < MIN_H_SIZE ||
+ *pos > (msg_data_sz(hdr) - MIN_H_SIZE)))
goto none;
ihdr = (struct tipc_msg *)(msg_data(hdr) + *pos);
RE: [PATCH net] tipc: reject bundles too short for an inner header
Author: Tung Quang Nguyen
Date: Mon, 30 Nov 2026 04:08
Date: Mon, 30 Nov 2026 04:08
34 lines
18239 bytes
18239 bytes
>Subject: [PATCH net] tipc: reject bundles too short for an inner header > >From: Andrew Stellman <astellman@stellman-greene.com> > >tipc_msg_extract() checks *pos against msg_data_sz(hdr) - MIN_H_SIZE. >msg_data_sz() is unsigned, so for a header-only MSG_BUNDLER, which There is no such "header-only MSG_BUNDLER" sent by a correctly-configured TIPC node. >tipc_msg_validate() accepts, the subtraction wraps and the check passes. The >following msg_size(ihdr) then reads four bytes past the end of the bundle. >Check that the data can hold an inner header before subtracting. > >Tested on mainline (7cd8495c0f16) in arm64 QEMU with KASAN. A test-only >debugfs hook, not part of this patch, built a header-only bundle in the kernel, >passed it to tipc_msg_validate() and tipc_msg_extract(), and poisoned 8 bytes >of tailroom after it as a redzone so KASAN would flag the read. No live TIPC link >was used, and the bundle didn't come from a peer This is a wrong usage of TIPC because TIPC does not accept "Man-in-the-middle tampering" messages. Those kind of messages must be prevented from entering TIPC stack (by using IPsec or TIPC encryption feature). It is obvious that checking/validating a tampered message cannot return a reliable result. --- pw-bot: rejected
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