syzbot


KASAN: slab-out-of-bounds Read in bpf_prog_create

Status: fixed on 2020/01/08 01:07
Subsystems: bpf net
[Documentation on labels]
Reported-by: syzbot+eb853b51b10f1befa0b7@syzkaller.appspotmail.com
Fix commit: 0033b34a03ec ppp: fix out-of-bounds access in bpf_prog_create()
First crash: 1710d, last: 1626d
Cause bisection: introduced by (bisect log) :
commit 2f4fa2db75e26995709043c8d3de4632ebed5c4b
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Thu Apr 18 03:48:01 2019 +0000

  compat_ioctl: unify copy-in of ppp filters

Crash: KASAN: slab-out-of-bounds Read in bpf_prog_create (log)
Repro: C syz .config
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] ppp: fix out-of-bounds access in bpf_prog_create() 3 (3) 2019/12/05 22:45
KASAN: slab-out-of-bounds Read in bpf_prog_create 3 (4) 2019/12/05 09:08

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:404 [inline]
BUG: KASAN: slab-out-of-bounds in bpf_prog_create+0xe9/0x250 net/core/filter.c:1351
Read of size 32768 at addr ffff888091bc6000 by task syz-executor090/8612

CPU: 1 PID: 8612 Comm: syz-executor090 Not tainted 5.3.0-next-20190926 #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+0x172/0x1f0 lib/dump_stack.c:113
 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
 check_memory_region_inline mm/kasan/generic.c:185 [inline]
 check_memory_region+0x134/0x1a0 mm/kasan/generic.c:192
 memcpy+0x24/0x50 mm/kasan/common.c:122
 memcpy include/linux/string.h:404 [inline]
 bpf_prog_create+0xe9/0x250 net/core/filter.c:1351
 get_filter.isra.0+0x108/0x1a0 drivers/net/ppp/ppp_generic.c:572
 ppp_get_filter drivers/net/ppp/ppp_generic.c:584 [inline]
 ppp_ioctl+0x129d/0x2590 drivers/net/ppp/ppp_generic.c:801
 vfs_ioctl fs/ioctl.c:47 [inline]
 file_ioctl fs/ioctl.c:539 [inline]
 do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:726
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:743
 __do_sys_ioctl fs/ioctl.c:750 [inline]
 __se_sys_ioctl fs/ioctl.c:748 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:748
 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4401a9
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffcb9965988 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004401a9
RDX: 00000000200000c0 RSI: 0000000040107447 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401a30
R13: 0000000000401ac0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 8612:
 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 mm/slab.c:3655 [inline]
 __kmalloc_track_caller+0x15f/0x760 mm/slab.c:3670
 memdup_user+0x26/0xb0 mm/util.c:172
 get_filter.isra.0+0xd7/0x1a0 drivers/net/ppp/ppp_generic.c:568
 ppp_get_filter drivers/net/ppp/ppp_generic.c:584 [inline]
 ppp_ioctl+0x129d/0x2590 drivers/net/ppp/ppp_generic.c:801
 vfs_ioctl fs/ioctl.c:47 [inline]
 file_ioctl fs/ioctl.c:539 [inline]
 do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:726
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:743
 __do_sys_ioctl fs/ioctl.c:750 [inline]
 __se_sys_ioctl fs/ioctl.c:748 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:748
 do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff888091bc6000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 0 bytes inside of
 4096-byte region [ffff888091bc6000, ffff888091bc7000)
The buggy address belongs to the page:
page:ffffea000246f180 refcount:1 mapcount:0 mapping:ffff8880aa402000 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea000260b208 ffffea00025a3008 ffff8880aa402000
raw: 0000000000000000 ffff888091bc6000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888091bc6f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888091bc6f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888091bc7000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff888091bc7080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888091bc7100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (447):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/09/29 00:51 linux-next bb2aee77c82d eb6b9855 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/09/16 14:58 linux-next 2015a28f2cd5 cb936299 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/12/08 13:34 upstream 9455d25f4e3b 1508f453 .config console log report ci-upstream-kasan-gce
2019/12/08 10:57 upstream ad910e36da4c 1508f453 .config console log report ci-upstream-kasan-gce
2019/12/07 08:59 upstream 7ada90eb9c7a 85f26751 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/06 15:34 upstream b0d4beaa5a4b 98b4ef2d .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/06 12:25 upstream b0d4beaa5a4b 98b4ef2d .config console log report ci-upstream-kasan-gce
2019/12/06 09:42 upstream b0d4beaa5a4b 98b4ef2d .config console log report ci-upstream-kasan-gce
2019/12/06 09:39 upstream b0d4beaa5a4b 98b4ef2d .config console log report ci-upstream-kasan-gce-root
2019/12/05 20:26 upstream 2f13437b8917 4fb74474 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/05 10:18 upstream aedc0650f913 b2088328 .config console log report ci-upstream-kasan-gce
2019/12/05 03:49 upstream 63de37476ebd b2088328 .config console log report ci-upstream-kasan-gce
2019/12/04 19:12 upstream 63de37476ebd b2088328 .config console log report ci-upstream-kasan-gce
2019/12/04 15:30 upstream 63de37476ebd b2088328 .config console log report ci-upstream-kasan-gce
2019/12/04 07:33 upstream 76bb8b05960c ae13a849 .config console log report ci-upstream-kasan-gce
2019/12/04 05:23 upstream 76bb8b05960c ae13a849 .config console log report ci-upstream-kasan-gce-root
2019/12/03 16:28 upstream 76bb8b05960c ab342da3 .config console log report ci-upstream-kasan-gce
2019/12/03 05:14 upstream 596cf45cbf6e ab342da3 .config console log report ci-upstream-kasan-gce-root
2019/12/03 00:22 upstream 596cf45cbf6e ab342da3 .config console log report ci-upstream-kasan-gce-root
2019/12/02 20:08 upstream ceb307474506 f879db37 .config console log report ci-upstream-kasan-gce-root
2019/12/02 18:58 upstream ceb307474506 f879db37 .config console log report ci-upstream-kasan-gce-smack-root
2019/12/02 06:51 upstream ceb307474506 f879db37 .config console log report ci-upstream-kasan-gce-root
2019/12/02 05:48 upstream ceb307474506 f879db37 .config console log report ci-upstream-kasan-gce
2019/12/02 05:28 upstream ceb307474506 f879db37 .config console log report ci-upstream-kasan-gce-root
2019/12/02 04:23 upstream ceb307474506 f879db37 .config console log report ci-upstream-kasan-gce-selinux-root
2019/12/02 00:53 upstream ceb307474506 f879db37 .config console log report ci-qemu-upstream
2019/12/02 08:26 upstream ceb307474506 f879db37 .config console log report ci-upstream-kasan-gce-386
2019/12/02 08:21 upstream ceb307474506 f879db37 .config console log report ci-upstream-kasan-gce-386
2019/12/07 07:19 linux-next 838333c80c4f 85f26751 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/12/06 20:32 linux-next 838333c80c4f 85f26751 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/12/06 13:51 linux-next 838333c80c4f 98b4ef2d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/12/06 05:25 linux-next 282ffdf30a3e 98b4ef2d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/12/04 21:20 linux-next c7c32c43e831 b2088328 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/12/04 07:33 linux-next 1ab75b2e415a ae13a849 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/29 23:05 linux-next 419593dad843 d29b9e84 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/29 06:05 linux-next d26b0e226f22 76357d6f .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/28 23:10 linux-next d26b0e226f22 46869e3e .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/28 23:09 linux-next d26b0e226f22 46869e3e .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/28 16:56 linux-next d26b0e226f22 46869e3e .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/27 22:25 linux-next 1875ff320f14 0d63f89c .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/26 03:32 linux-next c165016bac27 f746151a .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/25 19:06 linux-next c165016bac27 371caf77 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/25 16:38 linux-next c165016bac27 371caf77 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/25 04:21 linux-next b9d3d0140506 598ca6c8 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/24 23:20 linux-next b9d3d0140506 598ca6c8 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/24 20:13 linux-next b9d3d0140506 598ca6c8 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/24 10:44 linux-next b9d3d0140506 598ca6c8 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/24 10:35 linux-next b9d3d0140506 598ca6c8 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/23 21:03 linux-next b9d3d0140506 598ca6c8 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/23 13:51 linux-next b9d3d0140506 598ca6c8 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/23 12:40 linux-next b9d3d0140506 598ca6c8 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/11/22 04:56 linux-next 1fef9976397f 8098ea0f .config console log report ci-upstream-linux-next-kasan-gce-root
2019/09/16 05:50 linux-next 2015a28f2cd5 32d59357 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.