netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Morris <james.l.morris@oracle.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	Paul Moore <paul@paul-moore.com>, netdev <netdev@vger.kernel.org>,
	selinux@tycho.nsa.gov
Subject: Re: [BUG] kernel stack corruption during/after Netlabel error
Date: Thu, 30 Nov 2017 10:41:29 +1100 (AEDT)	[thread overview]
Message-ID: <alpine.LFD.2.20.1711301040400.16533@localhost> (raw)
In-Reply-To: <1511995754.16595.27.camel@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 973 bytes --]

On Wed, 29 Nov 2017, Eric Dumazet wrote:

> On Wed, 2017-11-29 at 12:23 -0800, Eric Dumazet wrote:
> > 
> > I suspect this exposes an ancient bug, caused by fact that TCP moves
> > IP[6]CB in skb->cb[]
> > 
> > Basically the 2nd tcp_filter() added in commit
> > 8fac365f63c866a00015fa13932d8ffc584518b8
> > ("tcp: Add a tcp_filter hook before handle ack packet") was not
> > expecting selinux code being called a 2nd time,
> > while skb->cb[] has been mangled [1]
> > 
> > [1]
> > memmove(&TCP_SKB_CB(skb)->header.h4, IPCB(skb),
> >     sizeof(struct inet_skb_parm));
> 
> Please try this fix for IPv4 (a similar patch will be needed for IPv6)
> 
>  net/ipv4/tcp_ipv4.c |   51 ++++++++++++++++++++++++++----------------
>  1 file changed, 32 insertions(+), 19 deletions(-)

Works for me, no crashes with the testsuite running in a loop.


Tested-by: James Morris <james.l.morris@oracle.com>


-- 
James Morris
<james.l.morris@oracle.com>

  reply	other threads:[~2017-11-29 23:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29 10:26 [BUG] kernel stack corruption during/after Netlabel error James Morris
2017-11-29 12:29 ` Eric Dumazet
2017-11-29 17:31 ` Stephen Smalley
2017-11-29 17:34   ` Eric Dumazet
2017-11-29 19:29     ` Paul Moore
     [not found]     ` <CANn89iJc=tZkN41WoCm5Zy9nPfs1tfZf9nuSXYS9EB_aem+y4g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-29 19:59       ` Stephen Smalley
2017-11-29 20:23         ` Eric Dumazet
2017-11-29 22:49           ` Eric Dumazet
2017-11-29 23:41             ` James Morris [this message]
2017-11-30  0:22 ` Casey Schaufler
2017-11-30  0:31   ` James Morris
2017-11-30  3:16     ` Casey Schaufler
2017-11-30 10:50       ` Eric Dumazet
2017-11-30 12:47         ` Paul Moore
2017-11-30 16:57           ` Paul Moore
2017-11-30 14:33         ` Casey Schaufler
2017-11-30 15:11         ` Casey Schaufler
2017-11-30 15:44         ` David Ahern
2017-11-30 17:30           ` David Ahern
2017-11-30 17:57             ` Eric Dumazet
2017-11-30 18:03               ` David Ahern
2017-11-30 18:16               ` Casey Schaufler
2017-12-01  1:55         ` James Morris

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=alpine.LFD.2.20.1711301040400.16533@localhost \
    --to=james.l.morris@oracle.com \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /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).