From: Alex Elder <elder@ieee.org>
To: Chandradhar Kumar <chandradhar.2003@gmail.com>
Cc: syzbot <syzbot+693652ded53d3eb9cb91@syzkaller.appspotmail.com>,
elder@kernel.org, gregkh@linuxfoundation.org,
greybus-dev@lists.linaro.org, johan@kernel.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-staging@lists.linux.dev, linux-usb@vger.kernel.org,
syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [greybus?] [usb?] KASAN: slab-out-of-bounds Read in gb_svc_request_handler
Date: Mon, 9 Nov 2026 08:28:31 -0600 [thread overview]
Message-ID: <5a2b5e08-c33b-4513-8457-b8ac21563121@ieee.org> (raw)
In-Reply-To: <au8s1_tIBa0mpTSL@TheRealOne>
On 11/7/26 8:17 AM, Chandradhar Kumar wrote:
> On Thu, Nov 05, 2026 at 08:08:01AM -0600, Alex Elder wrote:
>> Here is what I see happening at the beginning of gb_connection_recv():
>> - If the connection is disabled or offloaded, return immediately
>> - If the size of the buffer (passed in as the "size" argument) is less
>> than the size of an operation message header, return
>> - If the 16-bit size embedded in the message header is less than the
>> size of the buffer, return
>>
>> In other words, after these checks, we know:
>>
>> sizeof(header) <= buffer size (size) AND
>> buffer size (size) <= size encoded in the header (msg_size)
> No, it does not verify this, it verify:
> size encoded in the header <= size (buffer size)
You're right, I misread this.
We don't read the header unless size tells us the entire
message ("buffer size") is at least the size of the header.
And then we ensure the buffer contains the entire message
(whose msg_size is decoded from the header).
But if the size encoded in the message header is bogus
(and in particular, smaller than the header size) we
have a problem.
>> Therefore (transitive property), this is true:
>>
>> sizeof(header) <= size encoded in the header (msg_size)
> So, the transitive property is not true.
Agreed. Thanks for explaining where I was wrong.
> I have sent a patch for this bug which verify the msg_size and header
> separately, which fixes the out of bounds read.
> patch link: https://lore.kernel.org/all/20261106094303.55158-1-chandradhar.2003@gmail.com/
-Alex
> Hey please review the patch if there is something wrong or there are any
> other way to fix the bug.
>
> Thanks.
>>
>> And it's not possible after these checks for this to be true:
>>
>> header.size < sizeof(struct gb_operation_msg_hdr)
>>
>> or put another way:
>>
>> msg_size < sizeof(header) cannot hold
>>
>>
>> It surprises me this would be missed in the AI summary--and I
>> fear I'm mistaken. If I'm missing something or wrong about this,
>> please feel free to say so.
>>
>> -Alex
prev parent reply other threads:[~2026-11-09 14:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 11:09 syzbot
2026-11-05 14:08 ` Alex Elder
2026-11-07 14:17 ` Chandradhar Kumar
2026-11-09 14:28 ` Alex Elder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5a2b5e08-c33b-4513-8457-b8ac21563121@ieee.org \
--to=elder@ieee.org \
--cc=chandradhar.2003@gmail.com \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-usb@vger.kernel.org \
--cc=syzbot+693652ded53d3eb9cb91@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®