mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Kubecek <mkubecek@suse.cz>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Eric Dumazet <edumazet@google.com>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	James Morris <jmorris@namei.org>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Patrick McHardy <kaber@trash.net>
Subject: Re: [PATCH net] tcp: prevent fetching dst twice in early demux code
Date: Mon, 23 Mar 2015 15:12:50 +0100	[thread overview]
Message-ID: <20150323141250.GA4673@unicorn.suse.cz> (raw)
In-Reply-To: <1427118542.25985.62.camel@edumazet-glaptop2.roam.corp.google.com>

On Mon, Mar 23, 2015 at 06:49:02AM -0700, Eric Dumazet wrote:
> On Mon, 2015-03-23 at 09:27 +0100, Michal Kubecek wrote:
> > On s390x, gcc 4.8 compiles this part of tcp_v6_early_demux()
> > 
> >         struct dst_entry *dst = sk->sk_rx_dst;
> > 
> >         if (dst)
> >                 dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie);
> > 
> > to code reading sk->sk_rx_dst twice, once for the test and once for
> > the argument of ip6_dst_check() (dst_check() is inline). This allows
> > ip6_dst_check() to be called with null first argument, causing a crash.
> 
> Good catch, (or would I say, strange compiler ? ;) )

I was also surprised when I saw the code, considering that the code
saved registers %r6 through %r13 and didn't use most of them.

> Please use READ_ONCE().  Only stable ports will need ACCESS_ONCE()

I'll send v2 with READ_ONCE() in a moment.

> Also, this probably points a problem on this arch, because its looks
> different cpu are handling TCP traffic for the same TCP flow.

Good point, this will be worth looking into.

                                                        Michal Kubecek


  reply	other threads:[~2015-03-23 14:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-23  8:27 Michal Kubecek
2015-03-23 13:49 ` Eric Dumazet
2015-03-23 14:12   ` Michal Kubecek [this message]
2015-03-23 14:14   ` [PATCH net v2] " Michal Kubecek
2015-03-23 14:39     ` Eric Dumazet
2015-03-24  2:39     ` 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=20150323141250.GA4673@unicorn.suse.cz \
    --to=mkubecek@suse.cz \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.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

all inboxes | Powered by JetHome®