All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: David Newall <davidn@davidnewall.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Netdev <netdev@vger.kernel.org>,
	bridge@lists.linux-foundation.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [Bridge] Revert 462fb2af9788a82a534f8184abfde31574e1cfa0 (bridge : Sanitize skb before it enters the IP stack)
Date: Mon, 19 May 2014 16:01:19 +0200	[thread overview]
Message-ID: <20140519140119.GA24523@breakpoint.cc> (raw)
In-Reply-To: <5379FFFD.1050705@davidnewall.com>

David Newall <davidn@davidnewall.com> wrote:
> Having received no feedback of substance from netdev, I now address
> my previous email to a wider audience for discussion and in
> preparation for submitting a patch based closely on that below.
> 
> This email is not addressed to Bandan Das <bandan.das@stratus.com>,
> who is the author of the commit I propose reverting, as his email
> address is no longer current.  I believe I have otherwise addressed
> all appropriate recipients and will circulate a formal patch to the
> same recipients if no adverse comments are received.  (That would
> surprise me.)
> 
> -------- Original Message --------
> Subject: 	Revert 462fb2af9788a82a534f8184abfde31574e1cfa0 (bridge :
> Sanitize skb before it enters the IP stack)
> Date: 	Sat, 17 May 2014 00:03:16 +0930
> From: 	David Newall <davidn@davidnewall.com>
> To: 	Lukas Tribus <luky-37@hotmail.com>, Eric Dumazet
> <eric.dumazet@gmail.com>, Netdev <netdev@vger.kernel.org>
> CC: 	fw@strlen.de <fw@strlen.de>
> 
> 
> 
> We should revert commit 462fb2af9788a82a534f8184abfde31574e1cfa0 (bridge
> : Sanitize skb before it enters the IP stack) because it corrupts IP
> packets with RR or TS options set, only partially updating the IP header
> and leaving an incorrect checksum.
> 
> The argument for introducing the change is at lkml.org/lkml/2010/8/30/391:
> 
> The bridge layer can overwrite the IPCB using the
> BR_INPUT_SKB_CB macro. In br_nf_dev_queue_xmit,
> if we recieve a packet greater in size than the bridge
> device MTU, we call ip_fragment which in turn will lead to
> icmp_send calling ip_options_echo if the DF flag is set.
> ip_options_echo will then incorrectly try to parse the IPCB as
> IP options resulting in a buffer overflow.
> This change refills the CB area back with IP
> options before ip_fragment calls icmp_send. If we fail parsing,
> we zero out the IPCB area to guarantee that the stack does
> not get corrupted.
>
> A bridge should not fragment packets; an *ethernet* bridge should not
> need to.  Fragmenting packets is the job of higher level protocol.

Well, did you test what happens if we try to refrag a packet
containing ip options after the revert?

can happen e.g. when using netfilter conntrack on top of a bridge.

WARNING: multiple messages have this Message-ID (diff)
From: Florian Westphal <fw@strlen.de>
To: David Newall <davidn@davidnewall.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Netdev <netdev@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	bridge@lists.linux-foundation.org
Subject: Re: Revert 462fb2af9788a82a534f8184abfde31574e1cfa0 (bridge : Sanitize skb before it enters the IP stack)
Date: Mon, 19 May 2014 16:01:19 +0200	[thread overview]
Message-ID: <20140519140119.GA24523@breakpoint.cc> (raw)
In-Reply-To: <5379FFFD.1050705@davidnewall.com>

David Newall <davidn@davidnewall.com> wrote:
> Having received no feedback of substance from netdev, I now address
> my previous email to a wider audience for discussion and in
> preparation for submitting a patch based closely on that below.
> 
> This email is not addressed to Bandan Das <bandan.das@stratus.com>,
> who is the author of the commit I propose reverting, as his email
> address is no longer current.  I believe I have otherwise addressed
> all appropriate recipients and will circulate a formal patch to the
> same recipients if no adverse comments are received.  (That would
> surprise me.)
> 
> -------- Original Message --------
> Subject: 	Revert 462fb2af9788a82a534f8184abfde31574e1cfa0 (bridge :
> Sanitize skb before it enters the IP stack)
> Date: 	Sat, 17 May 2014 00:03:16 +0930
> From: 	David Newall <davidn@davidnewall.com>
> To: 	Lukas Tribus <luky-37@hotmail.com>, Eric Dumazet
> <eric.dumazet@gmail.com>, Netdev <netdev@vger.kernel.org>
> CC: 	fw@strlen.de <fw@strlen.de>
> 
> 
> 
> We should revert commit 462fb2af9788a82a534f8184abfde31574e1cfa0 (bridge
> : Sanitize skb before it enters the IP stack) because it corrupts IP
> packets with RR or TS options set, only partially updating the IP header
> and leaving an incorrect checksum.
> 
> The argument for introducing the change is at lkml.org/lkml/2010/8/30/391:
> 
> The bridge layer can overwrite the IPCB using the
> BR_INPUT_SKB_CB macro. In br_nf_dev_queue_xmit,
> if we recieve a packet greater in size than the bridge
> device MTU, we call ip_fragment which in turn will lead to
> icmp_send calling ip_options_echo if the DF flag is set.
> ip_options_echo will then incorrectly try to parse the IPCB as
> IP options resulting in a buffer overflow.
> This change refills the CB area back with IP
> options before ip_fragment calls icmp_send. If we fail parsing,
> we zero out the IPCB area to guarantee that the stack does
> not get corrupted.
>
> A bridge should not fragment packets; an *ethernet* bridge should not
> need to.  Fragmenting packets is the job of higher level protocol.

Well, did you test what happens if we try to refrag a packet
containing ip options after the revert?

can happen e.g. when using netfilter conntrack on top of a bridge.

  reply	other threads:[~2014-05-19 14:01 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-11 14:41 Bad checksum on bridge with IP options David Newall
2014-05-11 19:42 ` Lukas Tribus
2014-05-12  8:14   ` David Newall
2014-05-12 10:15     ` Lukas Tribus
2014-05-12 10:25       ` David Newall
2014-05-12 10:31         ` Lukas Tribus
2014-05-12 10:48           ` David Newall
2014-05-12 13:23 ` David Newall
2014-05-12 13:51   ` Florian Westphal
2014-05-12 14:19     ` David Newall
2014-05-12 18:54   ` Lukas Tribus
2014-05-12 23:46     ` David Newall
2014-05-14 13:08       ` David Newall
2014-05-16 14:33         ` Revert 462fb2af9788a82a534f8184abfde31574e1cfa0 (bridge : Sanitize skb before it enters the IP stack) David Newall
2014-05-16 15:19           ` Eric Dumazet
2014-05-16 15:23             ` David Newall
2014-05-16 15:24             ` David Newall
2014-05-19 12:58           ` [Bridge] " David Newall
2014-05-19 12:58             ` David Newall
2014-05-19 14:01             ` Florian Westphal [this message]
2014-05-19 14:01               ` Florian Westphal
2014-05-19 14:19               ` [Bridge] " David Newall
2014-05-19 14:19                 ` David Newall
2014-05-19 17:09                 ` [Bridge] " Florian Westphal
2014-05-19 17:09                   ` Florian Westphal
2014-05-19 20:49                   ` [Bridge] " Bart De Schuymer
2014-05-19 20:49                     ` Bart De Schuymer
2014-05-21  7:49                     ` [Bridge] " David Newall
2014-05-21  7:49                       ` David Newall
2014-05-21 18:51                       ` [Bridge] " Bart De Schuymer
2014-05-21 18:51                         ` Bart De Schuymer
2014-05-21 20:18                         ` [Bridge] " David Miller
2014-05-21 20:18                           ` David Miller
2014-05-22 18:57                           ` [Bridge] " Bart De Schuymer
2014-05-22 18:57                             ` Bart De Schuymer
2014-05-24 18:00                             ` [Bridge] " David Miller
2014-05-24 18:00                               ` David Miller
2014-05-24  5:56                           ` [Bridge] " David Newall
2014-05-24  5:56                             ` David Newall
2014-05-24 17:43                             ` [Bridge] " David Miller
2014-05-24 17:43                               ` David Miller
2014-05-25  2:32                               ` [Bridge] " David Newall
2014-05-25  2:32                                 ` David Newall
2014-05-25  3:02                                 ` [Bridge] " David Miller
2014-05-25  3:02                                   ` David Miller
2014-05-25  6:37                                   ` [Bridge] " David Newall
2014-05-25  6:37                                     ` David Newall
2014-05-27  8:55                                 ` [Bridge] " David Laight
2014-05-27  8:55                                   ` David Laight
2014-05-29 22:34                                 ` [Bridge] " David Miller
2014-05-29 22:34                                   ` David Miller
2014-05-30  9:17                                   ` [Bridge] " David Newall
2014-05-30  9:17                                     ` David Newall
2014-05-31  0:46                                     ` [Bridge] " David Miller
2014-05-31  0:46                                       ` David Miller
2014-05-31  6:13                                       ` [Bridge] " David Newall
2014-05-31  6:13                                         ` David Newall
2014-05-31  6:37                                         ` [Bridge] " David Miller
2014-05-31  6:37                                           ` David Miller
2014-05-22  3:50                         ` [Bridge] " David Newall
2014-05-22  3:50                           ` David Newall
2014-05-22 18:57                           ` [Bridge] " Bart De Schuymer
2014-05-22 18:57                             ` Bart De Schuymer
2014-05-20  3:57                   ` [Bridge] " David Newall
2014-05-20  3:57                     ` David Newall
2014-05-20  4:55                 ` [Bridge] " Valdis.Kletnieks
2014-05-20  4:55                   ` Valdis.Kletnieks
2014-05-20 16:05                   ` [Bridge] " Vlad Yasevich
2014-05-20 16:05                     ` Vlad Yasevich
2014-05-20 16:05                     ` Vlad Yasevich
2014-05-21  8:10                   ` [Bridge] " David Newall
2014-05-21  8:10                     ` David Newall
2014-05-21 20:14                     ` [Bridge] " David Miller
2014-05-21 20:14                       ` David Miller
2014-05-21 20:14                       ` David Miller
2014-05-22 20:06           ` Bandan Das

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=20140519140119.GA24523@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=bridge@lists.linux-foundation.org \
    --cc=davidn@davidnewall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.