Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp969779ybl; Mon, 2 Dec 2019 22:30:58 -0800 (PST) X-Google-Smtp-Source: APXvYqzfzhAE7ymjZyqJRpmY8xL7HPVAPmu2c2vKxY4w5mM+Kv1wzQp4h2k2NZLykEV4U6G/z6bV X-Received: by 2002:a9d:7f02:: with SMTP id j2mr2054641otq.123.1575354658358; Mon, 02 Dec 2019 22:30:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575354658; cv=none; d=google.com; s=arc-20160816; b=pDCERy0QuQ4sG7HtUzu6IC6G+Z2tLoCzAPMlt4M9qe1SxwaJGHVDczI0RorLXlYMib 1M7tsK4URAt+ethM+TV8N6EQNl2nNz3+h9bPpvzA+PPM8whLZbp5/lIHisEPlHyECVl7 QQsoAoh8Juerj7NL9oc7DAumZrO0DBwVsSwRBgnIMOvBe801LLHXmtpgey80dVt3daUI 3hjveQAPBCUwDFp53K3kfqO0yhdHigzlx9ct7OXAFYFzLIH6/wusm6x1+xLppZoD+KfM 7a3/4swCR4YbSOWS9RmvPpSuXfxJXvjYyVPM+droaulvhrTQrMxUF2ASKAn085AiOiz2 PGZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=d32jlN+apNHcfazf1yqE8dTD2w1sa01Tp1dZxYL4nhw=; b=yR/t1hpni8pwbxk+mGyhCKftu0cyUqBDM9qf4IAiiqiXfM2JBB9x4fwOLeMLlhqFlU HFWl14sCRubvN72CzZuIaIaJomqwj85ypr9nafFXZBoa6iZvXBkspe71ccb/lWbONjPM MXs0nGm7srTKihM/oHe4vERQn+UzjXZmXXKgy+mIub1VDuD6CSnOQTXPFKxpw3pup+IL q1WjVVmFUWiKrF68QvKhK42qDFbEAyJAemdtT3GRKpEaPTTXbOoM8MYRrFtuduaRRkK2 5O8QD+1KknMKbxXKFsAWVsmOfCl4Zf0ANqsOn/B8LzA5AV94KMB19Q/EdX15VOXDcy1o jM4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=D7ctaARv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i78si841658oib.1.2019.12.02.22.30.32; Mon, 02 Dec 2019 22:30:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=D7ctaARv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726991AbfLCG3g (ORCPT + 99 others); Tue, 3 Dec 2019 01:29:36 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:42871 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbfLCG3g (ORCPT ); Tue, 3 Dec 2019 01:29:36 -0500 Received: by mail-qt1-f196.google.com with SMTP id j5so2641249qtq.9 for ; Mon, 02 Dec 2019 22:29:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=d32jlN+apNHcfazf1yqE8dTD2w1sa01Tp1dZxYL4nhw=; b=D7ctaARvpQ5hJC8dpZjU0TVb8b0JFyHkQ1bNlr2Xbw5DwVTnRG1QaNctQZTM04As75 BgWv5nfJpIWme3JbPXzVjiVv4cMTBtCh5U12jzzEfy1ndKrmvn4ziCUi8MmTgVEtsOLM 5cAY9MMlvYBQ1u/nTGpdZ92d/rRLxBSIfQWpIUvQvNLVyAlsXhoJDMDnek+AfR/nOWtu p+vPVzPsS8EAxFKwq/7dmWPfrhYlTxa8UEk95FwPeur+Xu2vGblBgw/8SdFnro33rQG7 pr0XJ1NwzLtizxXe3c7K9reeyH1oXNsC6LsYTmYZ1AfbUBXro79cby6KKtlrWczSrSUY HYbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d32jlN+apNHcfazf1yqE8dTD2w1sa01Tp1dZxYL4nhw=; b=Nq6IZQPeNNG0IqkOK319Fv+RV8Qw4hRmVy/U/94Mwl+jatS7V0x0wMhqDivEYbgwMn NbyozkcgXU0Lx5sb+I4/RCR07xjVo1cLhxC9KcBiYcD4rX5BlxgOeUb8dd7gTuoglyD4 k4j6NHeCk/qIxi2lfUBct1PdBT71e8mAH/xtMDqs2HLT+Lqrh7c7uug6ZEY89MJ26gtv ay+zdA32sLOckaqyU4YqOsqmFStyIboKnyULD2K4b6SlmoMXwO6stYvTS1y/4SPWAeBh ZN4GTDiFj9PDKhi++AOBlrltZVFVHEx4VK/hYPYIs5gmksWdsQ0jDBshOZjcGeKjqN69 hoNw== X-Gm-Message-State: APjAAAWz8PmWerzAxwKw59RWhwlDVTUAOSUfYeWnfq6U181ME4gasAQH To1NqEkxNN3kJixbG2Jfpzlo5NyeUTJVndjgo52QkA== X-Received: by 2002:ac8:ccf:: with SMTP id o15mr3645673qti.380.1575354574136; Mon, 02 Dec 2019 22:29:34 -0800 (PST) MIME-Version: 1.0 References: <0000000000000e4f720598bb95f8@google.com> <09ad00de-c082-3c69-5b81-ceae5e9cd3c9@hartkopp.net> In-Reply-To: <09ad00de-c082-3c69-5b81-ceae5e9cd3c9@hartkopp.net> From: Dmitry Vyukov Date: Tue, 3 Dec 2019 07:29:23 +0100 Message-ID: Subject: Re: KASAN: use-after-free Read in slcan_open To: Oliver Hartkopp Cc: syzbot , David Miller , linux-can@vger.kernel.org, LKML , Marc Kleine-Budde , netdev , syzkaller-bugs , wg@grandegger.com, Jouni Hogander Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 2, 2019 at 10:28 PM Oliver Hartkopp wrote: > > This issue has already been addressed by Jouni Hogander here: > > https://marc.info/?l=linux-can&m=157483684128186 > > The patch is waiting for upstream via linux-can tree. #syz fix: slcan: Fix use-after-free Read in slcan_open > Regards, > Oliver > > On 02/12/2019 18.05, syzbot wrote: > > Hello, > > > > syzbot found the following crash on: > > > > HEAD commit: 32ef9553 Merge tag 'fsnotify_for_v5.5-rc1' of > > git://git.ke.. > > git tree: upstream > > console output: https://syzkaller.appspot.com/x/log.txt?x=12a48e9ce00000 > > kernel config: https://syzkaller.appspot.com/x/.config?x=ff560c3de405258c > > dashboard link: > > https://syzkaller.appspot.com/bug?extid=b5ec6fd05ab552a78532 > > compiler: gcc (GCC) 9.0.0 20181231 (experimental) > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12943882e00000 > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10562f86e00000 > > > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > > Reported-by: syzbot+b5ec6fd05ab552a78532@syzkaller.appspotmail.com > > > > ================================================================== > > BUG: KASAN: use-after-free in slc_sync drivers/net/can/slcan.c:504 [inline] > > BUG: KASAN: use-after-free in slcan_open+0x8a1/0x9e0 > > drivers/net/can/slcan.c:579 > > Read of size 8 at addr ffff88809a6e0b88 by task syz-executor961/9030 > > > > CPU: 1 PID: 9030 Comm: syz-executor961 Not tainted 5.4.0-syzkaller #0 > > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS > > Google 01/01/2011 > > Call Trace: > > __dump_stack lib/dump_stack.c:77 [inline] > > dump_stack+0x197/0x210 lib/dump_stack.c:118 > > print_address_description.constprop.0.cold+0xd4/0x30b > > mm/kasan/report.c:374 > > __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506 > > kasan_report+0x12/0x20 mm/kasan/common.c:634 > > __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132 > > slc_sync drivers/net/can/slcan.c:504 [inline] > > slcan_open+0x8a1/0x9e0 drivers/net/can/slcan.c:579 > > tty_ldisc_open.isra.0+0xa3/0x110 drivers/tty/tty_ldisc.c:469 > > tty_set_ldisc+0x30e/0x6b0 drivers/tty/tty_ldisc.c:596 > > tiocsetd drivers/tty/tty_io.c:2334 [inline] > > tty_ioctl+0xe8d/0x14f0 drivers/tty/tty_io.c:2594 > > vfs_ioctl fs/ioctl.c:46 [inline] > > file_ioctl fs/ioctl.c:509 [inline] > > do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:696 > > ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 > > __do_sys_ioctl fs/ioctl.c:720 [inline] > > __se_sys_ioctl fs/ioctl.c:718 [inline] > > __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 > > do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 > > entry_SYSCALL_64_after_hwframe+0x49/0xbe > > RIP: 0033:0x4429e9 > > Code: e8 dc 02 03 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 > > f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 > > f0 ff ff 0f 83 1b 0a fc ff c3 66 2e 0f 1f 84 00 00 00 00 > > RSP: 002b:00007ffc7db87168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 > > RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004429e9 > > RDX: 00000000200000c0 RSI: 0000000000005423 RDI: 0000000000000003 > > RBP: 0000000000000000 R08: 0000000000000002 R09: 0000000000003031 > > R10: 0000000000000000 R11: 0000000000000246 R12: ffffffffffffffff > > R13: 0000000000000004 R14: 00007ffc7db871dc R15: 0000000000000000 > > > > Allocated by task 9029: > > save_stack+0x23/0x90 mm/kasan/common.c:69 > > set_track mm/kasan/common.c:77 [inline] > > __kasan_kmalloc mm/kasan/common.c:510 [inline] > > __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:483 > > kasan_kmalloc+0x9/0x10 mm/kasan/common.c:524 > > __do_kmalloc_node mm/slab.c:3615 [inline] > > __kmalloc_node+0x4e/0x70 mm/slab.c:3622 > > kmalloc_node include/linux/slab.h:599 [inline] > > kvmalloc_node+0xbd/0x100 mm/util.c:564 > > kvmalloc include/linux/mm.h:670 [inline] > > kvzalloc include/linux/mm.h:678 [inline] > > alloc_netdev_mqs+0x98/0xde0 net/core/dev.c:9730 > > slc_alloc drivers/net/can/slcan.c:533 [inline] > > slcan_open+0x32d/0x9e0 drivers/net/can/slcan.c:590 > > tty_ldisc_open.isra.0+0xa3/0x110 drivers/tty/tty_ldisc.c:469 > > tty_set_ldisc+0x30e/0x6b0 drivers/tty/tty_ldisc.c:596 > > tiocsetd drivers/tty/tty_io.c:2334 [inline] > > tty_ioctl+0xe8d/0x14f0 drivers/tty/tty_io.c:2594 > > vfs_ioctl fs/ioctl.c:46 [inline] > > file_ioctl fs/ioctl.c:509 [inline] > > do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:696 > > ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 > > __do_sys_ioctl fs/ioctl.c:720 [inline] > > __se_sys_ioctl fs/ioctl.c:718 [inline] > > __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 > > do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 > > entry_SYSCALL_64_after_hwframe+0x49/0xbe > > > > Freed by task 9029: > > save_stack+0x23/0x90 mm/kasan/common.c:69 > > set_track mm/kasan/common.c:77 [inline] > > kasan_set_free_info mm/kasan/common.c:332 [inline] > > __kasan_slab_free+0x102/0x150 mm/kasan/common.c:471 > > kasan_slab_free+0xe/0x10 mm/kasan/common.c:480 > > __cache_free mm/slab.c:3425 [inline] > > kfree+0x10a/0x2c0 mm/slab.c:3756 > > kvfree+0x61/0x70 mm/util.c:593 > > netdev_freemem net/core/dev.c:9684 [inline] > > free_netdev+0x3c0/0x470 net/core/dev.c:9839 > > slcan_open+0x848/0x9e0 drivers/net/can/slcan.c:620 > > tty_ldisc_open.isra.0+0xa3/0x110 drivers/tty/tty_ldisc.c:469 > > tty_set_ldisc+0x30e/0x6b0 drivers/tty/tty_ldisc.c:596 > > tiocsetd drivers/tty/tty_io.c:2334 [inline] > > tty_ioctl+0xe8d/0x14f0 drivers/tty/tty_io.c:2594 > > vfs_ioctl fs/ioctl.c:46 [inline] > > file_ioctl fs/ioctl.c:509 [inline] > > do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:696 > > ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 > > __do_sys_ioctl fs/ioctl.c:720 [inline] > > __se_sys_ioctl fs/ioctl.c:718 [inline] > > __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 > > do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 > > entry_SYSCALL_64_after_hwframe+0x49/0xbe > > > > The buggy address belongs to the object at ffff88809a6e0000 > > which belongs to the cache kmalloc-32k of size 32768 > > The buggy address is located 2952 bytes inside of > > 32768-byte region [ffff88809a6e0000, ffff88809a6e8000) > > The buggy address belongs to the page: > > page:ffffea000269b800 refcount:1 mapcount:0 mapping:ffff8880aa402540 > > index:0x0 compound_mapcount: 0 > > raw: 00fffe0000010200 ffffea000244d008 ffff8880aa401d48 ffff8880aa402540 > > raw: 0000000000000000 ffff88809a6e0000 0000000100000001 0000000000000000 > > page dumped because: kasan: bad access detected > > > > Memory state around the buggy address: > > ffff88809a6e0a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb > > ffff88809a6e0b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb > >> ffff88809a6e0b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb > > ^ > > ffff88809a6e0c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb > > ffff88809a6e0c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb > > ================================================================== > > > > > > --- > > This bug is generated by a bot. It may contain errors. > > See https://goo.gl/tpsmEJ for more information about syzbot. > > syzbot engineers can be reached at syzkaller@googlegroups.com. > > > > syzbot will keep track of this bug report. See: > > https://goo.gl/tpsmEJ#status for how to communicate with syzbot. > > syzbot can test patches for this bug, for details see: > > https://goo.gl/tpsmEJ#testing-patches > > -- > You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group. > To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/09ad00de-c082-3c69-5b81-ceae5e9cd3c9%40hartkopp.net.