public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Steve Muckle <smuckle@codeaurora.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: invalid socket structure with ip_early_demux
Date: Fri, 01 Feb 2013 18:16:10 -0800	[thread overview]
Message-ID: <1359771370.30177.50.camel@edumazet-glaptop> (raw)
In-Reply-To: <510C752F.5010102@codeaurora.org>

On Fri, 2013-02-01 at 18:08 -0800, Steve Muckle wrote:
> Recently I've struggled with crashes in the xt_qtaguid netfilter module.
> This module is written by Google and used with Android. The match
> function in xt_qtaguid eventually tries to access
> 
>   skb->sk->sk_socket->file
> 
> What I find is that the sk->sk_socket pointer is sometimes 0xAAAAAAAA,
> or PAGE_POISON. In fact everything after the first 16 bytes of the
> struct sock sk is PAGE_POISON. I've confirmed that if I change
> PAGE_POISON, the values I see in the sk structure change as well.
> 
> I was curious how this structure was being allocated/initialized and
> instrumented the sk_alloc, sk_free, and sk_clone_lock functions. When
> xt_qtaguid encounters a bad struct sock, that sock does not show up as
> ever having been allocated (or freed).
> 
> The struct sock is being assigned to the skb in tcb_v4_early_demux(). I
> modified that function immediately after the sk is assigned from
> __inet_lookup_established() to panic if the sk has a sk_socket pointer
> of PAGE_POISON. I can reproduce that condition on my target by simply
> attempting to mount an NFS volume. Initiating *and* aborting wget
> operations also reproduces the issue - simply initiating a bunch of
> wgets is not enough to trigger it.
> 
> I have not yet been able to reproduce the bad condition when disabling
> ip_early_demux via the sysctl. Any possibility this is an actual issue
> with that feature? My target is an MSM using the ks8851 ethernet module.


skb->sk might be a TIMEWAIT socket.

Therefore, you cant blindly use skb->sk->sk_socket

  reply	other threads:[~2013-02-02  2:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-02  2:08 invalid socket structure with ip_early_demux Steve Muckle
2013-02-02  2:16 ` Eric Dumazet [this message]
2013-02-02  2:25   ` Eric Dumazet
2013-02-02  2:27     ` Steve Muckle
2013-02-02  2:34       ` Eric Dumazet

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=1359771370.30177.50.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=smuckle@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox