linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: syzbot <syzbot+71d74a5406d02057d559@syzkaller.appspotmail.com>
Cc: alexander.deucher@amd.com,
	Andrey Konovalov <andreyknvl@google.com>,
	Anoob Soman <anoob.soman@citrix.com>,
	chris@chris-wilson.co.uk, David Miller <davem@davemloft.net>,
	elena.reshetova@intel.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kees Cook <keescook@chromium.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Mike Maloney <maloney@google.com>,
	mchehab@kernel.org, netdev <netdev@vger.kernel.org>,
	rami.rosen@intel.com,
	Sowmini Varadhan <sowmini.varadhan@oracle.com>,
	syzkaller-bugs@googlegroups.com,
	Willem de Bruijn <willemb@google.com>
Subject: Re: KASAN: use-after-free Read in __dev_queue_xmit
Date: Wed, 3 Jan 2018 21:13:25 -0800	[thread overview]
Message-ID: <CANn89iLEt2e0X-zj0f_05R-oN7sX7fKUWbNz_DJSeKXJMSwUBQ@mail.gmail.com> (raw)
In-Reply-To: <94eb2c0ce3aa27cfa40561ec2dc3@google.com>

On Wed, Jan 3, 2018 at 8:58 PM, syzbot
<syzbot+71d74a5406d02057d559@syzkaller.appspotmail.com> wrote:
> Hello,
>
> syzkaller hit the following crash on
> 37759fa6d0fa9e4d6036d19ac12f555bfc0aeafd
> git://git.cmpxchg.org/linux-mmots.git/master
> compiler: gcc (GCC) 7.1.1 20170620
> .config is attached
> Raw console output is attached.
> C reproducer is attached
> syzkaller reproducer is attached. See https://goo.gl/kgGztJ
> for information about syzkaller reproducers
>
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+71d74a5406d02057d559@syzkaller.appspotmail.com
> It will help syzbot understand when the bug is fixed. See footer for
> details.
> If you forward the report, please keep this part and the footer.
>
> ==================================================================
> BUG: KASAN: use-after-free in __tcp_hdrlen include/linux/tcp.h:35 [inline]
> BUG: KASAN: use-after-free in tcp_hdrlen include/linux/tcp.h:40 [inline]
> BUG: KASAN: use-after-free in qdisc_pkt_len_init net/core/dev.c:3160
> [inline]
> BUG: KASAN: use-after-free in __dev_queue_xmit+0x20d3/0x2200
> net/core/dev.c:3465
> Read of size 2 at addr ffff8801cb360d38 by task syzkaller769484/3147
>
> CPU: 0 PID: 3147 Comm: syzkaller769484 Not tainted 4.15.0-rc4-mm1+ #49
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x194/0x257 lib/dump_stack.c:53
>  print_address_description+0x73/0x250 mm/kasan/report.c:256
>  kasan_report_error mm/kasan/report.c:355 [inline]
>  kasan_report+0x23b/0x360 mm/kasan/report.c:413
>  __asan_report_load2_noabort+0x14/0x20 mm/kasan/report.c:432
>  __tcp_hdrlen include/linux/tcp.h:35 [inline]
>  tcp_hdrlen include/linux/tcp.h:40 [inline]
>  qdisc_pkt_len_init net/core/dev.c:3160 [inline]
>  __dev_queue_xmit+0x20d3/0x2200 net/core/dev.c:3465
>  dev_queue_xmit+0x17/0x20 net/core/dev.c:3554
>  packet_snd net/packet/af_packet.c:2943 [inline]
>  packet_sendmsg+0x3ad5/0x60a0 net/packet/af_packet.c:2968
>  sock_sendmsg_nosec net/socket.c:628 [inline]
>  sock_sendmsg+0xca/0x110 net/socket.c:638
>  sock_write_iter+0x31a/0x5d0 net/socket.c:907
>  call_write_iter include/linux/fs.h:1776 [inline]
>  new_sync_write fs/read_write.c:469 [inline]
>  __vfs_write+0x684/0x970 fs/read_write.c:482
>  vfs_write+0x189/0x510 fs/read_write.c:544
>  SYSC_write fs/read_write.c:589 [inline]
>  SyS_write+0xef/0x220 fs/read_write.c:581
>  entry_SYSCALL_64_fastpath+0x1f/0x96
> RIP: 0033:0x444b89
> RSP: 002b:00000000007eff78 EFLAGS: 00000293 ORIG_RAX: 0000000000000001
> RAX: ffffffffffffffda RBX: 00007fff91d02bb0 RCX: 0000000000444b89
> RDX: 000000000000005d RSI: 0000000020384000 RDI: 0000000000000005
> RBP: 0000000000000000 R08: 0000000120080522 R09: 0000000120080522
> R10: 0000000120080522 R11: 0000000000000293 R12: 0000000000402780
> R13: 0000000000402810 R14: 0000000000000000 R15: 0000000000000000
>
> Allocated by task 1643:
>  save_stack+0x43/0xd0 mm/kasan/kasan.c:447
>  set_track mm/kasan/kasan.c:459 [inline]
>  kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
>  kmem_cache_alloc_trace+0x136/0x750 mm/slab.c:3607
>  kmalloc include/linux/slab.h:516 [inline]
>  kzalloc include/linux/slab.h:705 [inline]
>  kernfs_fop_open+0x357/0xeb0 fs/kernfs/file.c:648
>  do_dentry_open+0x667/0xd40 fs/open.c:752
>  vfs_open+0x107/0x220 fs/open.c:866
>  do_last fs/namei.c:3397 [inline]
>  path_openat+0x1151/0x3530 fs/namei.c:3537
>  do_filp_open+0x25b/0x3b0 fs/namei.c:3572
>  do_sys_open+0x502/0x6d0 fs/open.c:1059
>  SYSC_open fs/open.c:1077 [inline]
>  SyS_open+0x2d/0x40 fs/open.c:1072
>  entry_SYSCALL_64_fastpath+0x1f/0x96
>
> Freed by task 1643:
>  save_stack+0x43/0xd0 mm/kasan/kasan.c:447
>  set_track mm/kasan/kasan.c:459 [inline]
>  kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
>  __cache_free mm/slab.c:3485 [inline]
>  kfree+0xd6/0x260 mm/slab.c:3800
>  kernfs_fop_release+0x13f/0x180 fs/kernfs/file.c:783
>  __fput+0x327/0x7e0 fs/file_table.c:209
>  ____fput+0x15/0x20 fs/file_table.c:243
>  task_work_run+0x199/0x270 kernel/task_work.c:113
>  tracehook_notify_resume include/linux/tracehook.h:191 [inline]
>  exit_to_usermode_loop+0x275/0x2f0 arch/x86/entry/common.c:165
>  prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline]
>  syscall_return_slowpath+0x490/0x550 arch/x86/entry/common.c:264
>  entry_SYSCALL_64_fastpath+0x94/0x96
>
> The buggy address belongs to the object at ffff8801cb360cc0
>  which belongs to the cache kmalloc-512 of size 512
> The buggy address is located 120 bytes inside of
>  512-byte region [ffff8801cb360cc0, ffff8801cb360ec0)
> The buggy address belongs to the page:
> page:ffffea00072cd800 count:1 mapcount:0 mapping:ffff8801cb360040 index:0x0
> flags: 0x2fffc0000000100(slab)
> raw: 02fffc0000000100 ffff8801cb360040 0000000000000000 0000000100000006
> raw: ffffea00072bb6a0 ffffea00072bf720 ffff8801dac00940 0000000000000000
> page dumped because: kasan: bad access detected
>
> Memory state around the buggy address:
>  ffff8801cb360c00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>  ffff8801cb360c80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>>
>> ffff8801cb360d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>
>                                         ^
>  ffff8801cb360d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>  ffff8801cb360e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ==================================================================
>
>
> ---
> This bug is generated by a dumb bot. It may contain errors.
> See https://goo.gl/tpsmEJ for details.
> Direct all questions to syzkaller@googlegroups.com.
>
> syzbot will keep track of this bug report.
> If you forgot to add the Reported-by tag, once the fix for this bug is
> merged
> into any tree, please reply to this email with:
> #syz fix: exact-commit-title
> If you want to test a patch for this bug, please reply with:
> #syz test: git://repo/address.git branch
> and provide the patch inline or as an attachment.
> To mark this as a duplicate of another syzbot report, please reply with:
> #syz dup: exact-subject-of-another-report
> If it's a one-off invalid bug report, please reply with:
> #syz invalid
> Note: if the crash happens again, it will cause creation of a new bug
> report.
> Note: all commands must start from beginning of the line in the email body.

I guess skb_probe_transport_header() should be hardened to reject malicious
packets given by user space, instead of being gentle.

  reply	other threads:[~2018-01-04  5:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04  4:58 KASAN: use-after-free Read in __dev_queue_xmit syzbot
2018-01-04  5:13 ` Eric Dumazet [this message]
2018-01-04  6:53   ` Eric Dumazet
2018-05-09  7:37     ` Eric Biggers
2018-05-09 16:11       ` Willem de Bruijn
2018-05-09 16:38         ` Willem de Bruijn
2018-05-09 19:21           ` Willem de Bruijn
2018-05-09 19:36             ` Eric Dumazet
2018-05-09 21:05               ` Willem de Bruijn
2018-05-10 21:49                 ` Willem de Bruijn

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=CANn89iLEt2e0X-zj0f_05R-oN7sX7fKUWbNz_DJSeKXJMSwUBQ@mail.gmail.com \
    --to=edumazet@google.com \
    --cc=alexander.deucher@amd.com \
    --cc=andreyknvl@google.com \
    --cc=anoob.soman@citrix.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=davem@davemloft.net \
    --cc=elena.reshetova@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maloney@google.com \
    --cc=mchehab@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rami.rosen@intel.com \
    --cc=sowmini.varadhan@oracle.com \
    --cc=syzbot+71d74a5406d02057d559@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=willemb@google.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).