Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	syzbot+1939f24bdb783e9e43d9@syzkaller.appspotmail.com
Subject: Re: [PATCH net] net: avoid potential UAF in default_operstate()
Date: Wed, 4 Dec 2024 16:34:23 +0200	[thread overview]
Message-ID: <20241204143423.eewibpbgnuoqyyzn@skbuf> (raw)
In-Reply-To: <CANn89iL+2NeV59p57bN+hc+vWB61DWWjRKAoit-=QHXC0C=RBg@mail.gmail.com>

On Wed, Dec 04, 2024 at 02:38:14PM +0100, Eric Dumazet wrote:
> On Wed, Dec 4, 2024 at 1:57 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> >
> > On Wed, Dec 04, 2024 at 12:46:11PM +0100, Eric Dumazet wrote:
> > > On Wed, Dec 4, 2024 at 12:41 PM Vladimir Oltean <vladimir.oltean@nxp.com> wrote:
> > > >
> > > > I meant: linkwatch runs periodically, via linkwatch_event(). Isn't there
> > > > a chance that linkwatch_event() can run once, immediately after
> > > > __rtnl_unlock() in netdev_run_todo(), while the netdev is in the
> > > > NETREG_UNREGISTERING state? Won't that create problems for __dev_get_by_index()
> > > > too? I guess it depends on when the netns is torn down, which I couldn't find.
> > >
> > > I think lweventlist_lock and dev->link_watch_list are supposed to
> > > synchronize things.
> > >
> > > linkwatch_sync_dev() only calls linkwatch_do_dev() if the device was
> > > atomically unlinked from lweventlist
> >
> > No, I don't mean calls from linkwatch_sync_dev(). I mean other call
> > paths towards linkwatch_do_dev(), like for example linkwatch_fire_event() -
> > carrier down, whatever. Can't these be pending on an unregistering
> > net_device at the time we run __rtnl_unlock() in netdev_run_todo?
> > Otherwise, why would netdev_wait_allrefs_any() have a linkwatch_run_queue()
> > call just later?
> 
> I do not know, this predates git history.
> 
> All these questions seem orthogonal.
> My patch fixes an issue added recently. not something added 10 years ago.
> I suggest we fix proven issues first, step by step.
> If you want to take over and send a series, just say so.
> 
> Thank you.

My understanding is certainly fuzzy, but I am not talking about some
behavior from 10 years ago. If I made default_operstate() require
rtnl_mutex last year, I did so for all call paths, not just for the
direct linkwatch_sync_dev() call that you point out. I agree we can take
them step by step if the UNREGISTERING state also proves problematic
(I don't have enough data now), but I disagree that the problem is
orthogonal.

  reply	other threads:[~2024-12-04 14:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 17:09 [PATCH net] net: avoid potential UAF in default_operstate() Eric Dumazet
2024-12-03 17:37 ` Vladimir Oltean
2024-12-03 17:56   ` Eric Dumazet
2024-12-04 11:41     ` Vladimir Oltean
2024-12-04 11:46       ` Eric Dumazet
2024-12-04 12:57         ` Vladimir Oltean
2024-12-04 13:38           ` Eric Dumazet
2024-12-04 14:34             ` Vladimir Oltean [this message]
2024-12-04 14:35 ` Vladimir Oltean
2024-12-05 11:00 ` patchwork-bot+netdevbpf

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=20241204143423.eewibpbgnuoqyyzn@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+1939f24bdb783e9e43d9@syzkaller.appspotmail.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