All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Gartrell <agartrell@fb.com>
To: Simon Horman <horms@verge.net.au>
Cc: wensong@linux-vs.org, ja@ssi.bg, lvs-devel@vger.kernel.org,
	kernel-team@fb.com
Subject: Re: [PATCH net-next,v2] ipvs: orphan skb on LOCAL_IN path
Date: Thu, 29 Jan 2015 17:24:27 -0800	[thread overview]
Message-ID: <54CADD4B.9080408@fb.com> (raw)
In-Reply-To: <20150130010219.GD11897@verge.net.au>

Hey Simon

On 01/29/2015 05:02 PM, Simon Horman wrote:
> Hi Alex,
>
> when you say "blow" what exactly happens? Does the kernel panic?
> Assuming this is a bug fix could you provide some information
> on when the problem was introduced? The reason is to facilitate
> backporting to stable.
>

The kernel panics upon a garbage value dereference.  ip6_skb_dst_mtu 
features the following code:

static inline int ip6_skb_dst_mtu(struct sk_buff *skb)
{
         struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;

         return (np && np->pmtudisc >= IPV6_PMTUDISC_PROBE) ?
                skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb));
}

inet6_sk(skb->sk) expands to
inet_sk(skb->sk)->pinet6 which expands to
((struct inet_sock*)skb->sk)->pinet6

Because skb->sk is not actually an inet_sock, dereferencing at such is 
nonsense and gives you a bunch of fields as a pointer, which is totally 
bogus.  The dereference into the structure to retrieve pmtudisc causes a 
kernel panic after that.

We found this with our 3.10 porting effort (from 3.2).  This failure was 
introduced with early_demux in c7109986d "ipv6: Early TCP socket demux" 
(2012-07-26) and has been present since.  The underlying problem has 
existed forever, but it wasn't possible to trigger it (AFAICT) prior to 
that.

In terms of stable kernels, I believe 3.10 needs to be patched but 3.4 
does not.

Thanks,
-- 
Alex Gartrell <agartrell@fb.com>

  reply	other threads:[~2015-01-30  1:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-29 21:25 [PATCH net-next,v2] ipvs: orphan skb on LOCAL_IN path Alex Gartrell
2015-01-30  1:02 ` Simon Horman
2015-01-30  1:24   ` Alex Gartrell [this message]
2015-01-30  8:18 ` Julian Anastasov

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=54CADD4B.9080408@fb.com \
    --to=agartrell@fb.com \
    --cc=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=kernel-team@fb.com \
    --cc=lvs-devel@vger.kernel.org \
    --cc=wensong@linux-vs.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.