syzbot


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

Status: fixed on 2021/11/10 00:50
Subsystems: bridge
[Documentation on labels]
Reported-by: syzbot+24b98616278c31afc800@syzkaller.appspotmail.com
Fix commit: 9384eacd80f3 net: core: don't call SIOCBRADD/DELIF for non-bridge devices
First crash: 996d, last: 983d
Cause bisection: introduced by (bisect log) [no-op commit]:
commit b9fc8b4a591811546fec2dbef7e9f809362100c9
Author: Grant Seltzer <grantseltzer@gmail.com>
Date: Mon Feb 22 19:58:46 2021 +0000

  bpf: Add kernel/modules BTF presence checks to bpftool feature command

Crash: WARNING in kvm_wait (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] KASAN: slab-out-of-bounds Read in add_del_if 2 (4) 2021/09/03 11:47
Last patch testing requests (1)
Created Duration User Patch Repo Result
2021/09/03 10:04 26m nikolay@nvidia.com git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git d15040a33883 OK

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in add_del_if+0x13a/0x140 net/bridge/br_ioctl.c:85
Read of size 8 at addr ffff888019118c88 by task syz-executor790/8443

CPU: 0 PID: 8443 Comm: syz-executor790 Not tainted 5.14.0-rc2-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
 print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:436
 add_del_if+0x13a/0x140 net/bridge/br_ioctl.c:85
 br_ioctl_stub+0x1c6/0x7f0 net/bridge/br_ioctl.c:397
 br_ioctl_call+0x5e/0xa0 net/socket.c:1091
 dev_ifsioc+0xc1f/0xf60 net/core/dev_ioctl.c:382
 dev_ioctl+0x1b9/0xee0 net/core/dev_ioctl.c:580
 sock_do_ioctl+0x18b/0x210 net/socket.c:1128
 sock_ioctl+0x2f1/0x640 net/socket.c:1231
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:1069 [inline]
 __se_sys_ioctl fs/ioctl.c:1055 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:1055
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x43ee49
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc164ff518 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 000000000043ee49
RDX: 0000000020000180 RSI: 00000000000089a3 RDI: 0000000000000003
RBP: 0000000000402e30 R08: 0000000000000000 R09: 0000000000400488
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402ec0
R13: 0000000000000000 R14: 00000000004ac018 R15: 0000000000400488

Allocated by task 1:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 ____kasan_kmalloc mm/kasan/common.c:472 [inline]
 __kasan_kmalloc+0x9b/0xd0 mm/kasan/common.c:522
 kmalloc_node include/linux/slab.h:614 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:587
 kvmalloc include/linux/mm.h:806 [inline]
 kvzalloc include/linux/mm.h:814 [inline]
 alloc_netdev_mqs+0x98/0xe80 net/core/dev.c:10847
 loopback_net_init+0x31/0x160 drivers/net/loopback.c:211
 ops_init+0xaf/0x470 net/core/net_namespace.c:140
 __register_pernet_operations net/core/net_namespace.c:1137 [inline]
 register_pernet_operations+0x35a/0x850 net/core/net_namespace.c:1214
 register_pernet_device+0x26/0x70 net/core/net_namespace.c:1301
 net_dev_init+0x566/0x612 net/core/dev.c:11705
 do_one_initcall+0x103/0x650 init/main.c:1282
 do_initcall_level init/main.c:1355 [inline]
 do_initcalls init/main.c:1371 [inline]
 do_basic_setup init/main.c:1391 [inline]
 kernel_init_freeable+0x6b8/0x741 init/main.c:1593
 kernel_init+0x1a/0x1d0 init/main.c:1485
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff888019118000
 which belongs to the cache kmalloc-cg-4k of size 4096
The buggy address is located 3208 bytes inside of
 4096-byte region [ffff888019118000, ffff888019119000)
The buggy address belongs to the page:
page:ffffea0000644600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x19118
head:ffffea0000644600 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff88801084c280
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd60c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 3473484541, free_ts 0
 prep_new_page mm/page_alloc.c:2433 [inline]
 get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4166
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5388
 alloc_page_interleave+0x1e/0x200 mm/mempolicy.c:2119
 alloc_pages+0x238/0x2a0 mm/mempolicy.c:2242
 alloc_slab_page mm/slub.c:1688 [inline]
 allocate_slab+0x32e/0x4b0 mm/slub.c:1828
 new_slab mm/slub.c:1891 [inline]
 new_slab_objects mm/slub.c:2637 [inline]
 ___slab_alloc+0x4ba/0x820 mm/slub.c:2800
 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2840
 slab_alloc_node mm/slub.c:2922 [inline]
 __kmalloc_node+0x2df/0x380 mm/slub.c:4148
 kmalloc_node include/linux/slab.h:614 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:587
 kvmalloc include/linux/mm.h:806 [inline]
 kvzalloc include/linux/mm.h:814 [inline]
 alloc_netdev_mqs+0x98/0xe80 net/core/dev.c:10847
 loopback_net_init+0x31/0x160 drivers/net/loopback.c:211
 ops_init+0xaf/0x470 net/core/net_namespace.c:140
 __register_pernet_operations net/core/net_namespace.c:1137 [inline]
 register_pernet_operations+0x35a/0x850 net/core/net_namespace.c:1214
 register_pernet_device+0x26/0x70 net/core/net_namespace.c:1301
 net_dev_init+0x566/0x612 net/core/dev.c:11705
 do_one_initcall+0x103/0x650 init/main.c:1282
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888019118b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888019118c00: 00 00 00 07 fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888019118c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                      ^
 ffff888019118d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888019118d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (970):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/07/28 15:34 net-next-old 3bdc70669eb2 17d6ab15 .config console log report syz C ci-upstream-net-kasan-gce KASAN: slab-out-of-bounds Read in add_del_if
2021/07/28 14:43 net-next-old 3bdc70669eb2 17d6ab15 .config console log report syz C ci-upstream-net-kasan-gce KASAN: slab-out-of-bounds Read in add_del_if
2021/07/28 17:40 net-next-old 3bdc70669eb2 17d6ab15 .config console log report syz C ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/07/28 17:26 net-next-old 3bdc70669eb2 17d6ab15 .config console log report syz C ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/07/28 17:07 net-next-old 3bdc70669eb2 17d6ab15 .config console log report syz C ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/07/28 15:49 net-next-old 3bdc70669eb2 17d6ab15 .config console log report syz C ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/07/28 14:26 net-next-old 3bdc70669eb2 17d6ab15 .config console log report syz C ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/07/28 13:08 net-next-old 3bdc70669eb2 17d6ab15 .config console log report syz C ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/08/05 14:01 net-next-old 372bbdd5bb3f 7f7bb950 .config console log report info ci-upstream-net-kasan-gce KASAN: slab-out-of-bounds Read in add_del_if
2021/08/05 12:56 net-next-old 372bbdd5bb3f 7f7bb950 .config console log report info ci-upstream-net-kasan-gce KASAN: slab-out-of-bounds Read in add_del_if
2021/08/04 21:59 net-next-old c2eecaa193ff b97d64c9 .config console log report info ci-upstream-net-kasan-gce KASAN: slab-out-of-bounds Read in add_del_if
2021/08/04 17:59 net-next-old c2eecaa193ff b97d64c9 .config console log report info ci-upstream-net-kasan-gce KASAN: slab-out-of-bounds Read in add_del_if
2021/08/04 14:03 net-next-old b820c114eba7 6c236867 .config console log report info ci-upstream-net-kasan-gce KASAN: slab-out-of-bounds Read in add_del_if
2021/07/28 11:43 net-next-old 3bdc70669eb2 17d6ab15 .config console log report info ci-upstream-net-kasan-gce KASAN: slab-out-of-bounds Read in add_del_if
2021/08/06 22:04 linux-next 8d4b477da1a8 f9e341e3 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/06 17:35 linux-next 8d4b477da1a8 f9e341e3 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/06 13:32 linux-next 8d4b477da1a8 f9e341e3 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/06 03:02 linux-next 8d4b477da1a8 d2d6e680 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/05 21:31 linux-next 8d4b477da1a8 d2d6e680 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/05 09:51 linux-next 8d4b477da1a8 7f7bb950 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/05 04:19 linux-next 8d4b477da1a8 b97d64c9 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/04 23:06 linux-next 8d4b477da1a8 b97d64c9 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/04 19:16 linux-next 8d4b477da1a8 b97d64c9 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/04 14:30 linux-next 8d4b477da1a8 6c236867 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/04 12:59 linux-next 8d4b477da1a8 6c236867 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/04 07:41 linux-next 8d4b477da1a8 6c236867 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: slab-out-of-bounds Read in add_del_if
2021/08/10 17:40 bpf-next 874be05f525e 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce general protection fault in add_del_if
2021/08/07 05:09 bpf-next c83ae15dc947 6972b106 .config console log report info ci-upstream-bpf-next-kasan-gce general protection fault in add_del_if
2021/08/05 15:29 net-next-old 372bbdd5bb3f 7f7bb950 .config console log report info ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/08/05 14:09 net-next-old 372bbdd5bb3f 7f7bb950 .config console log report info ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/08/05 11:53 net-next-old 372bbdd5bb3f 7f7bb950 .config console log report info ci-upstream-net-kasan-gce KASAN: global-out-of-bounds Read in add_del_if
2021/08/05 10:42 net-next-old 372bbdd5bb3f 7f7bb950 .config console log report info ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/08/05 08:50 net-next-old 372bbdd5bb3f 7f7bb950 .config console log report info ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/08/05 07:33 net-next-old 372bbdd5bb3f 7f7bb950 .config console log report info ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/08/05 02:16 net-next-old c2eecaa193ff b97d64c9 .config console log report info ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/08/04 15:38 net-next-old b820c114eba7 6c236867 .config console log report info ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/08/04 11:54 net-next-old b820c114eba7 6c236867 .config console log report info ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/08/04 10:50 net-next-old b820c114eba7 6c236867 .config console log report info ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/08/04 09:48 net-next-old b820c114eba7 6c236867 .config console log report info ci-upstream-net-kasan-gce general protection fault in add_del_if
2021/08/06 21:37 linux-next 8d4b477da1a8 f9e341e3 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/06 20:33 linux-next 8d4b477da1a8 f9e341e3 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/06 18:53 linux-next 8d4b477da1a8 f9e341e3 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/06 15:26 linux-next 8d4b477da1a8 f9e341e3 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/06 14:51 linux-next 8d4b477da1a8 f9e341e3 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/06 08:06 linux-next 8d4b477da1a8 d2d6e680 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/06 06:48 linux-next 8d4b477da1a8 d2d6e680 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/06 05:40 linux-next 8d4b477da1a8 d2d6e680 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/06 00:07 linux-next 8d4b477da1a8 d2d6e680 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/05 22:54 linux-next 8d4b477da1a8 d2d6e680 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/05 17:02 linux-next 8d4b477da1a8 7f7bb950 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/05 05:21 linux-next 8d4b477da1a8 b97d64c9 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/05 03:05 linux-next 8d4b477da1a8 b97d64c9 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/05 00:14 linux-next 8d4b477da1a8 b97d64c9 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/04 20:55 linux-next 8d4b477da1a8 b97d64c9 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/04 10:53 linux-next 8d4b477da1a8 6c236867 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
2021/08/04 08:45 linux-next 8d4b477da1a8 6c236867 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in add_del_if
* Struck through repros no longer work on HEAD.