Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	 syzbot <syzbot+c2775460db0e1c70018e@syzkaller.appspotmail.com>,
	 netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com,
	davem@davemloft.net,  linux-kernel@vger.kernel.org,
	pabeni@redhat.com, wireguard@lists.zx2c4.com,  jann@thejh.net
Subject: Re: [syzbot] [wireguard?] KASAN: slab-use-after-free Write in enqueue_timer
Date: Tue, 23 May 2023 19:07:05 +0200	[thread overview]
Message-ID: <CANn89iKEjb-g1ed2M+VS5avSs=M0gNgH9QWXtOQRM_uDTMCwPw@mail.gmail.com> (raw)
In-Reply-To: <CANn89iLrP7-NbE1yU_okruVKqbuUc3gxPABq4-vQ4SKrUhEdtA@mail.gmail.com>

On Tue, May 23, 2023 at 7:05 PM Eric Dumazet <edumazet@google.com> wrote:
>
> On Tue, May 23, 2023 at 7:01 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
> >
> > On Tue, May 23, 2023 at 09:47:36AM -0700, Jakub Kicinski wrote:
> > > On Tue, 23 May 2023 18:42:53 +0200 Jason A. Donenfeld wrote:
> > > > > It should, no idea why it isn't. Looking thru the code now I don't see
> > > > > any obvious gaps where timer object is on a list but not active :S
> > > > > There's no way to get a vmcore from syzbot, right? :)
> > > > >
> > > > > Also I thought the shutdown leads to a warning when someone tries to
> > > > > schedule the dead timer but in fact add_timer() just exits cleanly.
> > > > > So the shutdown won't help us find the culprit :(
> > > >
> > > > Worth noting that it could also be caused by adding to a dead timer
> > > > anywhere in priv_data of another netdev, not just the sole timer_list
> > > > in net_device.
> > >
> > > Oh, I thought you zero'ed in on the watchdog based on offsets.
> > > Still, object debug should track all timers in the slab and complain
> > > on the free path.
> >
> > No, I mentioned watchdog because it's the only timer_list in struct
> > net_device.
> >
> > Offset analysis is an interesting idea though. Look at this:
> >
> > > The buggy address belongs to the object at ffff88801ecc0000
> > >  which belongs to the cache kmalloc-cg-8k of size 8192
> > > The buggy address is located 5376 bytes inside of
> > >  freed 8192-byte region [ffff88801ecc0000, ffff88801ecc2000)
> >
> > IDA says that for syzkaller's vmlinux, net_device has a size of 0xc80
> > and wg_device has a size of 0x880. 0xc80+0x880=5376. Coincidence that
> > the address offset is just after what wg uses?
>
>
> Note that the syzkaller report mentioned:
>
> alloc_netdev_mqs+0x89/0xf30 net/core/dev.c:10626
>  usbnet_probe+0x196/0x2770 drivers/net/usb/usbnet.c:1698
>  usb_probe_interface+0x5c4/0xb00 drivers/usb/core/driver.c:396
>  really_probe+0x294/0xc30 drivers/base/dd.c:658
>  __driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:800
>  driver_probe_device+0x50/0x420 drivers/base/dd.c:830
>  __device_attach_driver+0x2d3/0x520 drivers/base/dd.c:958
>
> So maybe an usbnet driver has a timer_list in its priv_data.

struct usbnet {
...
struct timer_list   delay;

  reply	other threads:[~2023-05-23 17:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-30 18:01 syzbot
2023-05-23 15:46 ` Jason A. Donenfeld
2023-05-23 16:05   ` Jakub Kicinski
2023-05-23 16:12     ` Eric Dumazet
2023-05-23 16:41       ` Jakub Kicinski
2023-05-23 16:42         ` Jason A. Donenfeld
2023-05-23 16:47           ` Jakub Kicinski
2023-05-23 17:01             ` Jason A. Donenfeld
2023-05-23 17:05               ` Eric Dumazet
2023-05-23 17:07                 ` Eric Dumazet [this message]
2023-05-24  8:24                   ` Dmitry Vyukov
2023-05-24 15:33                     ` Jakub Kicinski
2023-05-24 15:39                       ` Jakub Kicinski
2023-05-23 16:14     ` Jason A. Donenfeld
2023-05-23 16:46       ` Jakub Kicinski
2023-05-23 16:47         ` Jason A. Donenfeld
2023-05-23 17:16           ` Jason A. Donenfeld
2023-05-23 17:28             ` Jason A. Donenfeld

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='CANn89iKEjb-g1ed2M+VS5avSs=M0gNgH9QWXtOQRM_uDTMCwPw@mail.gmail.com' \
    --to=edumazet@google.com \
    --cc=Jason@zx2c4.com \
    --cc=davem@davemloft.net \
    --cc=jann@thejh.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+c2775460db0e1c70018e@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=wireguard@lists.zx2c4.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;
as well as URLs for NNTP newsgroup(s).