netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: roy.qing.li@gmail.com, netdev@vger.kernel.org, ghorbel@pivasoftware.com
Subject: Re: [PATCH] ipv6: fix a potential use after free in sit.c
Date: Sat, 18 Oct 2014 13:07:20 -0400 (EDT)	[thread overview]
Message-ID: <20141018.130720.448065424567018228.davem@davemloft.net> (raw)
In-Reply-To: <1413647540.27176.36.camel@edumazet-glaptop2.roam.corp.google.com>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 18 Oct 2014 08:52:20 -0700

> On Sat, 2014-10-18 at 17:33 +0800, roy.qing.li@gmail.com wrote:
>> From: Li RongQing <roy.qing.li@gmail.com>
>> 
>> pskb_may_pull() maybe change skb->data and make iph pointer oboslete,
>> fix it by geting ip header length directly.
>> 
>> Fixes: ca15a078 (sit: generate icmpv6 error when receiving icmpv4 error)
>> Cc: Oussama Ghorbel <ghorbel@pivasoftware.com>
>> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
>> ---
>>  net/ipv6/sit.c |    6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> Acked-by: Eric Dumazet <edumazet@google.com>
> 
> Thanks for doing all these checks !

Indeed, I wish we could somehow automate this.

Yes, I'm sure we could construct some sparse et al. rules but
I mean at run time.  For example, having a special pointer type
that you can't dereference directly.  At the time of assignment
the pointer gets some kind of state, and pskb_may_pull() et al.
calls invalidate that "state".

It probably could just be a 2-bit counter which is incremented
every time skb->data is reallocated.

The captured 2-bit generation count could be stored in the low
bits of the pointer.

Anyways, just throwing out ideas...

  reply	other threads:[~2014-10-18 17:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-18  9:33 [PATCH] ipv6: fix a potential use after free in sit.c roy.qing.li
2014-10-18 15:52 ` Eric Dumazet
2014-10-18 17:07   ` David Miller [this message]
2014-10-18 17:22     ` Dave Taht
2014-10-18 17:36       ` David Miller

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=20141018.130720.448065424567018228.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=ghorbel@pivasoftware.com \
    --cc=netdev@vger.kernel.org \
    --cc=roy.qing.li@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).