From: David Miller <davem@davemloft.net>
To: jengelh@inai.de
Cc: kadlec@blackhole.kfki.hu, sploving1@gmail.com,
pablo@netfilter.org, kaber@trash.net,
netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: BUG: net/netfilter: KASAN: stack-out-of-bounds in tcp_packet
Date: Mon, 28 Mar 2016 19:52:33 -0400 (EDT) [thread overview]
Message-ID: <20160328.195233.2182703562129135393.davem@davemloft.net> (raw)
In-Reply-To: <alpine.LSU.2.20.1603282214130.16241@nerf40.vanv.qr>
From: Jan Engelhardt <jengelh@inai.de>
Date: Mon, 28 Mar 2016 22:20:39 +0200 (CEST)
>
> On Monday 2016-03-28 21:29, David Miller wrote:
>>>> > > @@ -3716,6 +3716,8 @@ void tcp_parse_options(const struct sk_buff *skb,
>>>> > > length--;
>>>> > > continue;
>>>> > > default:
>>>> > > + if (length < 2)
>>>> > > + return;
>>>> > > opsize = *ptr++;
>>>> > > if (opsize < 2) /* "silly options" */
>>>> > > return;
>>
>>I'm trying to figure out how this can even matter.
>>If we are in the loop, length is at least one.
>>That means it is legal to read the opsize byte.
>
> Is that because the skbuff is always padded to a multiple of (at
> least) two?
No, it's because length is at least one, so we can read one byte.
And then before we read more, we make sure length is at least opsize
which is at least two.
This has nothing to do with padding, and everything to do logically
with the code.
prev parent reply other threads:[~2016-03-28 23:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-27 12:35 BUG: net/netfilter: KASAN: stack-out-of-bounds in tcp_packet Baozeng Ding
2016-03-27 22:11 ` Jozsef Kadlecsik
2016-03-27 22:25 ` Jozsef Kadlecsik
[not found] ` <56F8987B.5030501@gmail.com>
2016-03-28 13:14 ` Baozeng Ding
2016-03-28 16:48 ` Jozsef Kadlecsik
2016-03-28 17:05 ` Pablo Neira Ayuso
2016-03-28 19:29 ` David Miller
2016-03-28 20:07 ` Eric Dumazet
2016-03-28 20:20 ` Jan Engelhardt
2016-03-28 20:46 ` Eric Dumazet
2016-03-28 20:51 ` Eric Dumazet
2016-03-28 23:54 ` David Miller
2016-03-29 1:17 ` Eric Dumazet
2016-03-28 21:11 ` Jozsef Kadlecsik
2016-03-28 21:29 ` Eric Dumazet
2016-03-28 23:52 ` David Miller [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=20160328.195233.2182703562129135393.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=jengelh@inai.de \
--cc=kaber@trash.net \
--cc=kadlec@blackhole.kfki.hu \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=sploving1@gmail.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;
as well as URLs for NNTP newsgroup(s).