netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: David Howells <dhowells@redhat.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: Re: [PATCH net] rxrpc: use rcu protection while reading sk->sk_user_data
Date: Wed, 16 Oct 2019 16:35:01 -0700	[thread overview]
Message-ID: <CANn89iL9t78ta1JMecG7b8A+mNytfBy4_wXXYRD2Rosz8iFpVg@mail.gmail.com> (raw)
In-Reply-To: <8142.1571268276@warthog.procyon.org.uk>

On Wed, Oct 16, 2019 at 4:24 PM David Howells <dhowells@redhat.com> wrote:
>
> Eric Dumazet <edumazet@google.com> wrote:
>
> > We need to extend the rcu_read_lock() section in rxrpc_error_report()
> > and use rcu_dereference_sk_user_data() instead of plain access
> > to sk->sk_user_data to make sure all rules are respected.
>
> Should I take it that the caller won't be guaranteed to be holding the RCU
> read lock?
>
> Looking at __udp4_lib_err(), that calls __udp4_lib_err_encap(), which calls
> __udp4_lib_err_encap_no_sk(), which should throw a warning if the RCU read
> lock is not held.
>
> Similarly, icmp_socket_deliver() and icmpv6_notify() should also throw a
> warning before calling ->err_handler().
>
> Does that mean something further up the CPU stack is going to be holding the
> RCU read lock?

Note  that before my patch, the code had a rcu_read_lock()/rcu_read_unlock(),
so I only extended it.

I am not sure that all callers already have rcu_read_lock()  held, I
prefer leaving this matter for net-next

>
> David

      reply	other threads:[~2019-10-16 23:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14 13:04 [PATCH net] rxrpc: use rcu protection while reading sk->sk_user_data Eric Dumazet
2019-10-16  3:15 ` David Miller
2019-10-16 19:21 ` David Miller
2019-10-16 23:24 ` David Howells
2019-10-16 23:35   ` Eric Dumazet [this message]

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=CANn89iL9t78ta1JMecG7b8A+mNytfBy4_wXXYRD2Rosz8iFpVg@mail.gmail.com \
    --to=edumazet@google.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=netdev@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).