From: Florian Westphal <fw@strlen.de>
To: KOVACS Krisztian <hidden@balabit.hu>
Cc: Patrick McHardy <kaber@trash.net>,
netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
Balazs Scheidler <bazsi@balabit.hu>
Subject: Re: [PATCH 1/1] tproxy: do not assign timewait sockets to skb->sk
Date: Wed, 16 Feb 2011 12:30:40 +0100 [thread overview]
Message-ID: <20110216113040.GE8821@Chamillionaire.breakpoint.cc> (raw)
In-Reply-To: <4D5B90C7.5040603@balabit.hu>
KOVACS Krisztian <hidden@balabit.hu> wrote:
> On 02/14/2011 04:51 PM, Patrick McHardy wrote:
> >Am 14.02.2011 12:44, schrieb Florian Westphal:
> >>Assigning a socket in timewait state to skb->sk can trigger
> >>kernel oops, e.g. in nfnetlink_log, which does:
> >>
> >>if (skb->sk) {
> >> read_lock_bh(&skb->sk->sk_callback_lock);
> >> if (skb->sk->sk_socket&& skb->sk->sk_socket->file) ...
> >>
> >>in the timewait case, accessing sk->sk_callback_lock and sk->sk_socket
> >>is invalid.
> >>
> >>Either all of these spots will need to add a test for sk->sk_state != TCP_TIME_WAIT,
> >>or xt_TPROXY must not assign a timewait socket to skb->sk.
> >>
> >>This does the latter.
> >>
> >>If a TW socket is found, assign the tproxy nfmark, but skip the skb->sk assignment,
> >>thus mimicking behaviour of a '-m socket .. -j MARK/ACCEPT' re-routing rule.
> >>
> >>The 'SYN to TW socket' case is left unchanged -- we try to redirect to the
> >>listener socket.
> >>
> >>Cc: Balazs Scheidler<bazsi@balabit.hu>
> >>Cc: KOVACS Krisztian<hidden@balabit.hu>
> >>Signed-off-by: Florian Westphal<fwestphal@astaro.com>
> >
> >Looks fine to me. Balazs. Krisztian, any objections?
>
> Seems to be OK, as far as I can see.
>
> Florian, did you make sure the tests still run after applying this patch?
>
> http://git.balabit.hu/?p=bazsi/tproxy-test.git;a=summary
Thanks for the hint, I cloned this and ran it on my test setup:
./tproxy-test.py
[..]
PASS: ('192.168.10.8', 50080), we got a connection as we deserved
PASS: everything is fine
next prev parent reply other threads:[~2011-02-16 11:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-14 11:44 [PATCH 1/1] tproxy: do not assign timewait sockets to skb->sk Florian Westphal
2011-02-14 15:51 ` Patrick McHardy
2011-02-16 8:54 ` KOVACS Krisztian
2011-02-16 11:30 ` Florian Westphal [this message]
2011-02-17 10:40 ` Patrick McHardy
[not found] ` <1297972902.2253.51.camel@Nokia-N900-51-1>
2011-02-17 20:52 ` Florian Westphal
[not found] ` <1297976642.3789.5.camel@Nokia-N900-51-1>
2011-02-17 21:27 ` Florian Westphal
2011-02-18 16:19 ` Patrick McHardy
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=20110216113040.GE8821@Chamillionaire.breakpoint.cc \
--to=fw@strlen.de \
--cc=bazsi@balabit.hu \
--cc=hidden@balabit.hu \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).