lkml.org 
[lkml]   [2018]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: KASAN: use-after-free Read in erspan_build_header
From
Date
[ cc William Tu]

On 1/22/18 12:58 PM, syzbot wrote:
> Hello,
>
> syzbot hit the following crash on upstream commit
> 0d665e7b109d512b7cae3ccef6e8654714887844 (Fri Jan 19 12:49:24 2018 +0000)
> mm, page_vma_mapped: Drop faulty pointer arithmetics in check_pte()
>
> So far this crash happened 11 times on upstream.
> C reproducer is attached.
> syzkaller reproducer is attached.
> Raw console output is attached.
> compiler: gcc (GCC) 7.1.1 20170620
> .config is attached.
> user-space arch: i386
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+eefa384efad8d7997f20@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.
>
> audit: type=1400 audit(1516645172.960:10): avc:  denied  { sys_chroot }
> for  pid=3651 comm="syzkaller942389" 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 erspan_build_header+0x3bf/0x3d0
> net/ipv4/ip_gre.c:698
> Read of size 2 at addr ffff8801d82a834b by task syzkaller942389/3651
>
> CPU: 0 PID: 3651 Comm: syzkaller942389 Not tainted 4.15.0-rc9+ #184
> 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:252
>  kasan_report_error mm/kasan/report.c:351 [inline]
>  kasan_report+0x25b/0x340 mm/kasan/report.c:409
>  __asan_report_load_n_noabort+0xf/0x20 mm/kasan/report.c:440
>  erspan_build_header+0x3bf/0x3d0 net/ipv4/ip_gre.c:698
>  erspan_xmit+0x3b8/0x13b0 net/ipv4/ip_gre.c:740
>  __netdev_start_xmit include/linux/netdevice.h:4042 [inline]
>  netdev_start_xmit include/linux/netdevice.h:4051 [inline]
>  packet_direct_xmit+0x315/0x6b0 net/packet/af_packet.c:266
>  packet_snd net/packet/af_packet.c:2943 [inline]
>  packet_sendmsg+0x3aed/0x60b0 net/packet/af_packet.c:2968
>  sock_sendmsg_nosec net/socket.c:638 [inline]
>  sock_sendmsg+0xca/0x110 net/socket.c:648
>  SYSC_sendto+0x361/0x5c0 net/socket.c:1729
>  SyS_sendto+0x40/0x50 net/socket.c:1697
>  do_syscall_32_irqs_on arch/x86/entry/common.c:327 [inline]
>  do_fast_syscall_32+0x3ee/0xf9d arch/x86/entry/common.c:389
>  entry_SYSENTER_compat+0x54/0x63 arch/x86/entry/entry_64_compat.S:129
> RIP: 0023:0xf7f0bc79
> RSP: 002b:000000000820fdfc EFLAGS: 00000216 ORIG_RAX: 0000000000000171
> RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000020003fd9
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020008000
> RBP: 000000000000001c R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
> R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
>
> Allocated by task 3767:
>  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
>  kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
>  kmem_cache_alloc+0x12e/0x760 mm/slab.c:3544
>  prepare_creds+0x78/0x360 kernel/cred.c:252
>  SYSC_faccessat fs/open.c:365 [inline]
>  SyS_faccessat fs/open.c:353 [inline]
>  SYSC_access fs/open.c:431 [inline]
>  SyS_access+0x8f/0x6a0 fs/open.c:429
>  entry_SYSCALL_64_fastpath+0x29/0xa0
>
> Freed by task 3768:
>  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:3488 [inline]
>  kmem_cache_free+0x83/0x2a0 mm/slab.c:3746
>  put_cred_rcu+0x263/0x400 kernel/cred.c:126
>  __rcu_reclaim kernel/rcu/rcu.h:195 [inline]
>  rcu_do_batch kernel/rcu/tree.c:2758 [inline]
>  invoke_rcu_callbacks kernel/rcu/tree.c:3012 [inline]
>  __rcu_process_callbacks kernel/rcu/tree.c:2979 [inline]
>  rcu_process_callbacks+0xd6c/0x17f0 kernel/rcu/tree.c:2996
>  __do_softirq+0x2d7/0xb85 kernel/softirq.c:285
>
> The buggy address belongs to the object at ffff8801d82a8300
>  which belongs to the cache cred_jar of size 168
> The buggy address is located 75 bytes inside of
>  168-byte region [ffff8801d82a8300, ffff8801d82a83a8)
> The buggy address belongs to the page:
> page:ffffea000760aa00 count:1 mapcount:0 mapping:ffff8801d82a8000 index:0x0
> flags: 0x2fffc0000000100(slab)
> raw: 02fffc0000000100 ffff8801d82a8000 0000000000000000 0000000100000010
> raw: ffffea00076115a0 ffffea00076138a0 ffff8801dad30380 0000000000000000
> page dumped because: kasan: bad access detected
>
> Memory state around the buggy address:
>  ffff8801d82a8200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>  ffff8801d82a8280: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
>> ffff8801d82a8300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>                                               ^
>  ffff8801d82a8380: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
>  ffff8801d82a8400: 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.

\
 
 \ /
  Last update: 2018-01-22 23:43    [W:0.042 / U:0.192 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site