[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4Y+bUNt85prdbZYN9xdDp++cMa8zon6_d-GVhAezyjsHJPw@mail.gmail.com>
Date: Mon, 15 Jan 2018 16:07:44 +0100
From: Dmitry Vyukov <dvyukov@...gle.com>
To: syzbot <syzbot+a2215ab5e92b3bb1c95f@...kaller.appspotmail.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
LKML <linux-kernel@...r.kernel.org>,
netdev <netdev@...r.kernel.org>, syzkaller-bugs@...glegroups.com
Subject: Re: KASAN: use-after-free Write in array_map_update_elem
On Mon, Jan 15, 2018 at 3:58 PM, syzbot
<syzbot+a2215ab5e92b3bb1c95f@...kaller.appspotmail.com> wrote:
> Hello,
>
> syzkaller hit the following crash on
> 8418f88764046d0e8ca6a3c04a69a0e57189aa1e
> git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.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+a2215ab5e92b3bb1c95f@...kaller.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.
>
> audit: type=1400 audit(1515680378.393:8): avc: denied { sys_admin } for
> pid=3508 comm="syzkaller203412" capability=21
> scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
> tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=cap_userns
> permissive=1
> audit: type=1400 audit(1515680378.446:9): avc: denied { sys_chroot } for
> pid=3509 comm="syzkaller203412" capability=18
> scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
> tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=cap_userns
> permissive=1
> ==================================================================
> BUG: KASAN: use-after-free in memcpy include/linux/string.h:344 [inline]
> BUG: KASAN: use-after-free in array_map_update_elem+0x197/0x240
> kernel/bpf/arraymap.c:249
> Write of size 1 at addr ffff8801cb125bc0 by task syzkaller203412/3509
>
> CPU: 1 PID: 3509 Comm: syzkaller203412 Not tainted 4.15.0-rc7-next-20180111+
> #94
> 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:354 [inline]
> kasan_report+0x23b/0x360 mm/kasan/report.c:412
> check_memory_region_inline mm/kasan/kasan.c:260 [inline]
> check_memory_region+0x137/0x190 mm/kasan/kasan.c:267
> memcpy+0x37/0x50 mm/kasan/kasan.c:303
> memcpy include/linux/string.h:344 [inline]
> array_map_update_elem+0x197/0x240 kernel/bpf/arraymap.c:249
> map_update_elem kernel/bpf/syscall.c:687 [inline]
> SYSC_bpf kernel/bpf/syscall.c:1811 [inline]
> SyS_bpf+0x32df/0x4400 kernel/bpf/syscall.c:1782
> entry_SYSCALL_64_fastpath+0x29/0xa0
> RIP: 0033:0x440ac9
> RSP: 002b:00000000007dff68 EFLAGS: 00000203 ORIG_RAX: 0000000000000141
> RAX: ffffffffffffffda RBX: 00007ffe6a583b10 RCX: 0000000000440ac9
> RDX: 0000000000000020 RSI: 0000000020eaf000 RDI: 0000000000000002
> RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000203 R12: 00000000004022a0
> R13: 0000000000402330 R14: 0000000000000000 R15: 0000000000000000
>
> Allocated by task 3071:
> 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:552
> kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
> kmem_cache_alloc+0x12e/0x760 mm/slab.c:3541
> getname_flags+0xcb/0x580 fs/namei.c:138
> user_path_at_empty+0x2d/0x50 fs/namei.c:2587
> user_path_at include/linux/namei.h:57 [inline]
> SYSC_faccessat fs/open.c:384 [inline]
> SyS_faccessat fs/open.c:353 [inline]
> SYSC_access fs/open.c:431 [inline]
> SyS_access+0x22c/0x6a0 fs/open.c:429
> entry_SYSCALL_64_fastpath+0x29/0xa0
>
> Freed by task 3071:
> save_stack+0x43/0xd0 mm/kasan/kasan.c:447
> set_track mm/kasan/kasan.c:459 [inline]
> __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520
> kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
> __cache_free mm/slab.c:3485 [inline]
> kmem_cache_free+0x86/0x2b0 mm/slab.c:3743
> putname+0xee/0x130 fs/namei.c:258
> filename_lookup+0x315/0x500 fs/namei.c:2342
> user_path_at_empty+0x40/0x50 fs/namei.c:2587
> user_path_at include/linux/namei.h:57 [inline]
> SYSC_faccessat fs/open.c:384 [inline]
> SyS_faccessat fs/open.c:353 [inline]
> SYSC_access fs/open.c:431 [inline]
> SyS_access+0x22c/0x6a0 fs/open.c:429
> entry_SYSCALL_64_fastpath+0x29/0xa0
>
> The buggy address belongs to the object at ffff8801cb124e40
> which belongs to the cache names_cache of size 4096
> The buggy address is located 3456 bytes inside of
> 4096-byte region [ffff8801cb124e40, ffff8801cb125e40)
> The buggy address belongs to the page:
> page:ffffea00072c4900 count:1 mapcount:0 mapping:ffff8801cb124e40 index:0x0
> compound_mapcount: 0
> flags: 0x2fffc0000008100(slab|head)
> raw: 02fffc0000008100 ffff8801cb124e40 0000000000000000 0000000100000001
> raw: ffffea000729bc20 ffffea000729bca0 ffff8801dae30600 0000000000000000
> page dumped because: kasan: bad access detected
>
> Memory state around the buggy address:
> ffff8801cb125a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff8801cb125b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>>
>> ffff8801cb125b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>
> ^
> ffff8801cb125c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff8801cb125c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ==================================================================
This is:
#syz fix:
bpf, array: fix overflow in max_entries and undefined behavior in index_mask
right?
> ---
> This bug is generated by a dumb bot. It may contain errors.
> See https://goo.gl/tpsmEJ for details.
> Direct all questions to syzkaller@...glegroups.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.
>
> --
> 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@...glegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/syzkaller-bugs/001a1144b7fe3898b00562d1d71f%40google.com.
> For more options, visit https://groups.google.com/d/optout.
Powered by blists - more mailing lists