mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: Eric Dumazet <edumazet@google.com>
Cc: Denis Kirjanov <dkirjanov@suse.de>,
	syzbot <syzbot+5fe14f2ff4ccbace9a26@syzkaller.appspotmail.com>,
	linux-kernel@vger.kernel.org,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	Boqun Feng <boqun.feng@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [net?] KASAN: slab-use-after-free Read in __ethtool_get_link_ksettings
Date: Sat, 28 Sep 2024 20:21:12 +0800	[thread overview]
Message-ID: <20240928122112.1412-1-hdanton@sina.com> (raw)
In-Reply-To: <CANn89iKbygQsCLcb0STk7DVnseNQ6rkSxeJ1cFGDaufDo5eSgg@mail.gmail.com>

On Mon, 25 Mar 2024 14:08:36 +0100 Eric Dumazet <edumazet@google.com>
> On Mon, Mar 25, 2024 at 1:10 PM Denis Kirjanov <dkirjanov@suse.de> wrote:
> > On 3/22/24 23:10, syzbot wrote:
> > > Hello,
> > >
> > > syzbot found the following issue on:
> > >
> > > HEAD commit:    61387b8dcf1d Merge tag 'for-6.9/dm-vdo' of git://git.kerne..
> > > git tree:       upstream
> > > console output: https://syzkaller.appspot.com/x/log.txt?x=11effbd1180000
> > > kernel config:  https://syzkaller.appspot.com/x/.config?x=c6aea81bc9ff5e99
> > > dashboard link: https://syzkaller.appspot.com/bug?extid=5fe14f2ff4ccbace9a26
> > > compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> > >
> > > Unfortunately, I don't have any reproducer for this issue yet.
> > >
> > > Downloadable assets:
> > > disk image: https://storage.googleapis.com/syzbot-assets/b972a52930fa/disk-61387b8d.raw.xz
> > > vmlinux: https://storage.googleapis.com/syzbot-assets/caa2592898b6/vmlinux-61387b8d.xz
> > > kernel image: https://storage.googleapis.com/syzbot-assets/4187257afcc5/bzImage-61387b8d.xz
> > >
> > > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > > Reported-by: syzbot+5fe14f2ff4ccbace9a26@syzkaller.appspotmail.com
> > >
> > > ==================================================================
> > > BUG: KASAN: slab-use-after-free in __ethtool_get_link_ksettings+0x186/0x190 net/ethtool/ioctl.c:441
> > > Read of size 8 at addr ffff888021f46308 by task kworker/0:4/5169
> > >
> > > CPU: 0 PID: 5169 Comm: kworker/0:4 Not tainted 6.8.0-syzkaller-05562-g61387b8dcf1d #0
> > > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
> > > Workqueue: infiniband ib_cache_event_task
> > > Call Trace:
> > >  <TASK>
> > >  __dump_stack lib/dump_stack.c:88 [inline]
> > >  dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
> > >  print_address_description mm/kasan/report.c:377 [inline]
> > >  print_report+0xc3/0x620 mm/kasan/report.c:488
> > >  kasan_report+0xd9/0x110 mm/kasan/report.c:601
> > >  __ethtool_get_link_ksettings+0x186/0x190 net/ethtool/ioctl.c:441
> > >  __ethtool_get_link_ksettings+0xf5/0x190 net/ethtool/ioctl.c:445
> >
> > Hmm, report says that we have a net_device freed even that we have a dev_hold()
> > before __ethtool_get_link_ksettings()
> 
>  dev_hold(dev) might be done too late, the device is already being dismantled.
> 
> ib_device_get_netdev() should probably be done under RTNL locking,
> otherwise the final part is racy :
> 
> if (res && res->reg_state != NETREG_REGISTERED) {
>      dev_put(res);
>      return NULL;
> }

Given paranoia in netdev_run_todo(),

		/* paranoia */
		BUG_ON(netdev_refcnt_read(dev) != 1);

the claim that dev_hold(dev) might be done too late could not explain
the success of checking NETREG_REGISTERED, because of checking 
NETREG_UNREGISTERING after rcu barrier.

	/* Wait for rcu callbacks to finish before next phase */
	if (!list_empty(&list))
		rcu_barrier();

	list_for_each_entry_safe(dev, tmp, &list, todo_list) {
		if (unlikely(dev->reg_state != NETREG_UNREGISTERING)) {
			netdev_WARN(dev, "run_todo but not unregistering\n");
			list_del(&dev->todo_list);
			continue;
		}

  reply	other threads:[~2024-09-28 12:21 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 20:10 syzbot
2024-03-25 12:09 ` Denis Kirjanov
2024-03-25 13:08   ` Eric Dumazet
2024-09-28 12:21     ` Hillf Danton [this message]
2024-09-29 11:46       ` Hillf Danton
2024-09-30  8:32         ` Eric Dumazet
2024-09-30 12:27           ` Hillf Danton
2024-09-27 18:26 ` syzbot
2024-09-28  8:22 ` Hillf Danton
2024-09-28  9:08   ` syzbot
2024-09-29 10:38 ` Hillf Danton
2024-09-29 11:17   ` syzbot
2024-10-08  1:44 ` syzbot
2024-10-08 11:44 ` [syzbot] " syzbot
2024-10-08 11:51 ` syzbot
2024-10-10  8:25 ` syzbot
2024-10-10  9:12 ` syzbot
2024-10-10 13:27 ` syzbot
2024-10-10 13:46 ` syzbot
2024-10-13 10:54 ` syzbot
2024-10-13 11:44 ` syzbot
2024-10-13 15:45 ` syzbot
2024-10-16 12:24 ` syzbot
2024-10-16 20:28 ` syzbot
2024-10-19 17:04 ` syzbot
2024-10-20  6:49 ` syzbot
2024-10-20  6:54 ` syzbot
2024-10-21 10:09 ` syzbot
     [not found] <20241008114406.GD25819@unreal>
2024-10-08 12:02 ` syzbot
     [not found] <20241008115126.GE25819@unreal>
2024-10-08 12:24 ` syzbot
     [not found] <53e285ce-2977-467a-ae0e-8d54f6835c09@nvidia.com>
2024-10-10 13:30 ` syzbot
     [not found] <45071abc-d5fd-4c24-9e36-e8164eca3867@nvidia.com>
2024-10-10 13:30 ` syzbot
     [not found] <397b6a20-036f-404b-bdd1-82cc07d05296@nvidia.com>
2024-10-10 14:02 ` syzbot
     [not found] <181d9e88-ae98-4b4c-bd99-1e0e99da8588@nvidia.com>
2024-10-10 14:26 ` syzbot
     [not found] <68d66e2d-78f8-4a7c-890e-ca81af38984a@nvidia.com>
2024-10-13 11:29 ` syzbot
     [not found] <170d194b-686e-482d-a2f0-151a12887545@nvidia.com>
2024-10-13 12:05 ` syzbot
     [not found] <d21ac7f8-ab23-4b37-80f6-43836bbdbf12@nvidia.com>
2024-10-13 16:08 ` syzbot
     [not found] <53cfa80b-e1f9-4784-b725-e4e7b5c0cb4c@nvidia.com>
2024-10-16 20:02 ` syzbot
     [not found] <db9cbaed-a5a6-419b-8a46-0a9ce4ed4a5f@nvidia.com>
2024-10-16 20:57 ` syzbot
     [not found] <2deb0631-ce6c-4b18-8c34-9401198c9d39@nvidia.com>
2024-10-19 18:55 ` syzbot
     [not found] <605a7a92-5e06-42b6-a44c-6529cfa86d47@nvidia.com>
2024-10-20  8:33 ` syzbot
     [not found] <27386470-ef9f-49dc-a3d6-6c7f428737ad@nvidia.com>
2024-10-20  8:54 ` syzbot
     [not found] <a9414b93-0179-4d20-b619-3ef736f223f0@nvidia.com>
2024-10-21 13:32 ` syzbot

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=20240928122112.1412-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=boqun.feng@gmail.com \
    --cc=dkirjanov@suse.de \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=syzbot+5fe14f2ff4ccbace9a26@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=torvalds@linux-foundation.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®