syzbot


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

Status: upstream: reported on 2024/06/14 13:57
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+f243d5f2675d3151439a@syzkaller.appspotmail.com
First crash: 97d, last: 92d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [net?] KASAN: slab-out-of-bounds Read in mini_qdisc_pair_swap 0 (1) 2024/06/14 13:57
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Write in mini_qdisc_pair_swap net C error 76 306d 460d 23/27 fixed on 2023/09/29 02:49
upstream KASAN: slab-use-after-free Read in mini_qdisc_pair_swap net 1 160d 160d 0/27 closed as invalid on 2024/02/22 14:05
upstream KASAN: use-after-free Write in mini_qdisc_pair_swap (2) net 24 496d 876d 22/27 fixed on 2023/02/24 13:50
upstream KASAN: use-after-free Write in mini_qdisc_pair_swap net 1 967d 967d 0/27 closed as invalid on 2022/01/11 13:43
linux-6.1 KASAN: use-after-free Write in mini_qdisc_pair_swap origin:upstream missing-backport syz unreliable 1 372d 403d 0/3 upstream: reported syz repro on 2023/05/19 13:51

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in mini_qdisc_pair_swap+0x68/0x164 net/sched/sch_generic.c:1557
Read of size 8 at addr ffff00018c4b9000 by task kworker/u4:6/261

CPU: 1 PID: 261 Comm: kworker/u4:6 Not tainted 6.8.0-rc7-syzkaller-g707081b61156 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Workqueue: netns cleanup_net
Call trace:
 dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x178/0x518 mm/kasan/report.c:488
 kasan_report+0xd8/0x138 mm/kasan/report.c:601
 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381
 mini_qdisc_pair_swap+0x68/0x164 net/sched/sch_generic.c:1557
 clsact_chain_head_change+0x28/0x38 net/sched/sch_ingress.c:60
 tcf_chain_head_change_item net/sched/cls_api.c:493 [inline]
 tcf_chain0_head_change_cb_del+0x1e0/0x2d8 net/sched/cls_api.c:940
 tcf_block_put_ext+0xfc/0x33c net/sched/cls_api.c:1529
 clsact_destroy+0x1fc/0x790 net/sched/sch_ingress.c:300
 __qdisc_destroy+0x160/0x4b8 net/sched/sch_generic.c:1067
 qdisc_put net/sched/sch_generic.c:1094 [inline]
 shutdown_scheduler_queue+0x168/0x200 net/sched/sch_generic.c:1147
 dev_shutdown+0x244/0x480 net/sched/sch_generic.c:1481
 unregister_netdevice_many_notify+0x7f4/0x17b8 net/core/dev.c:11073
 unregister_netdevice_many net/core/dev.c:11139 [inline]
 default_device_exit_batch+0xa1c/0xa9c net/core/dev.c:11619
 ops_exit_list net/core/net_namespace.c:175 [inline]
 cleanup_net+0x5dc/0x8d0 net/core/net_namespace.c:618
 process_one_work+0x694/0x1204 kernel/workqueue.c:2633
 process_scheduled_works kernel/workqueue.c:2706 [inline]
 worker_thread+0x938/0xef4 kernel/workqueue.c:2787
 kthread+0x288/0x310 kernel/kthread.c:388
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860

Allocated by task 5782:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x40/0x78 mm/kasan/common.c:68
 kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:575
 poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:387
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 kmalloc_trace+0x26c/0x49c mm/slub.c:4012
 kmalloc include/linux/slab.h:590 [inline]
 kzalloc include/linux/slab.h:711 [inline]
 uevent_show+0x160/0x320 drivers/base/core.c:2656
 dev_attr_show+0x60/0xcc drivers/base/core.c:2364
 sysfs_kf_seq_show+0x2d0/0x43c fs/sysfs/file.c:59
 kernfs_seq_show+0x150/0x1fc fs/kernfs/file.c:205
 seq_read_iter+0x3e0/0xc44 fs/seq_file.c:230
 kernfs_fop_read_iter+0x144/0x5c8 fs/kernfs/file.c:279
 call_read_iter include/linux/fs.h:2081 [inline]
 new_sync_read fs/read_write.c:395 [inline]
 vfs_read+0x78c/0x954 fs/read_write.c:476
 ksys_read+0x15c/0x26c fs/read_write.c:619
 __do_sys_read fs/read_write.c:629 [inline]
 __se_sys_read fs/read_write.c:627 [inline]
 __arm64_sys_read+0x7c/0x90 fs/read_write.c:627
 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598

Freed by task 5782:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x40/0x78 mm/kasan/common.c:68
 kasan_save_free_info+0x54/0x6c mm/kasan/generic.c:589
 poison_slab_object+0x124/0x18c mm/kasan/common.c:240
 __kasan_slab_free+0x3c/0x70 mm/kasan/common.c:256
 kasan_slab_free include/linux/kasan.h:184 [inline]
 slab_free_hook mm/slub.c:2121 [inline]
 slab_free mm/slub.c:4299 [inline]
 kfree+0x144/0x3cc mm/slub.c:4409
 uevent_show+0x1c8/0x320 drivers/base/core.c:2669
 dev_attr_show+0x60/0xcc drivers/base/core.c:2364
 sysfs_kf_seq_show+0x2d0/0x43c fs/sysfs/file.c:59
 kernfs_seq_show+0x150/0x1fc fs/kernfs/file.c:205
 seq_read_iter+0x3e0/0xc44 fs/seq_file.c:230
 kernfs_fop_read_iter+0x144/0x5c8 fs/kernfs/file.c:279
 call_read_iter include/linux/fs.h:2081 [inline]
 new_sync_read fs/read_write.c:395 [inline]
 vfs_read+0x78c/0x954 fs/read_write.c:476
 ksys_read+0x15c/0x26c fs/read_write.c:619
 __do_sys_read fs/read_write.c:629 [inline]
 __se_sys_read fs/read_write.c:627 [inline]
 __arm64_sys_read+0x7c/0x90 fs/read_write.c:627
 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline]
 invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48
 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133
 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152
 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598

The buggy address belongs to the object at ffff00018c4b8000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 0 bytes to the right of
 allocated 4096-byte region [ffff00018c4b8000, ffff00018c4b9000)

The buggy address belongs to the physical page:
page:000000000267b9c9 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1cc4b8
head:000000000267b9c9 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x5ffc00000000840(slab|head|node=0|zone=2|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 05ffc00000000840 ffff0000c0002140 fffffdffc6008a00 dead000000000002
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff00018c4b8f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff00018c4b8f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff00018c4b9000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff00018c4b9080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff00018c4b9100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
Unable to handle kernel paging request at virtual address e0d5c054000002d6
KASAN: maybe wild-memory-access in range [0x06b202a0000016b0-0x06b202a0000016b7]
Mem abort info:
  ESR = 0x0000000096000004
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x04: level 0 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
  CM = 0, WnR = 0, TnD = 0, TagAccess = 0
  GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[e0d5c054000002d6] address between user and kernel address ranges
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
Modules linked in:
CPU: 1 PID: 261 Comm: kworker/u4:6 Tainted: G    B              6.8.0-rc7-syzkaller-g707081b61156 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Workqueue: netns cleanup_net
pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : mini_qdisc_pair_swap+0x130/0x164 net/sched/sch_generic.c:1585
lr : mini_qdisc_pair_swap+0x124/0x164 net/sched/sch_generic.c:1585
sp : ffff800097bb74e0
x29: ffff800097bb74e0 x28: 1fffe00018f4985c x27: ffff800089180b74
x26: 1fffe00018f4986c x25: 06b202a000001696 x24: dfff800000000000
x23: 1fffe00031897200 x22: ffff00018c4b9000 x21: ffff0000c7a4c310
x20: 00000000000170f0 x19: 06b202a0000016b6 x18: 1fffe00036804396
x17: ffff80008ec9d000 x16: ffff800080276f8c x15: 0000000000000001
x14: 1ffff00011dcf390 x13: 0000000000000000 x12: 0000000000000000
x11: 0000000000000001 x10: 0000000000000000 x9 : 1fffe00018b89781
x8 : 00d64054000002d6 x7 : 1fffe00036804397 x6 : ffff8000803be9e4
x5 : 0000000000000000 x4 : 0000000000000001 x3 : 0000000000000000
x2 : ffff0000c5c4bc00 x1 : 0000000000000000 x0 : 00000000000170f0
Call trace:
 mini_qdisc_pair_swap+0x130/0x164 net/sched/sch_generic.c:1585
 clsact_chain_head_change+0x28/0x38 net/sched/sch_ingress.c:60
 tcf_chain_head_change_item net/sched/cls_api.c:493 [inline]
 tcf_chain0_head_change_cb_del+0x1e0/0x2d8 net/sched/cls_api.c:940
 tcf_block_put_ext+0xfc/0x33c net/sched/cls_api.c:1529
 clsact_destroy+0x1fc/0x790 net/sched/sch_ingress.c:300
 __qdisc_destroy+0x160/0x4b8 net/sched/sch_generic.c:1067
 qdisc_put net/sched/sch_generic.c:1094 [inline]
 shutdown_scheduler_queue+0x168/0x200 net/sched/sch_generic.c:1147
 dev_shutdown+0x244/0x480 net/sched/sch_generic.c:1481
 unregister_netdevice_many_notify+0x7f4/0x17b8 net/core/dev.c:11073
 unregister_netdevice_many net/core/dev.c:11139 [inline]
 default_device_exit_batch+0xa1c/0xa9c net/core/dev.c:11619
 ops_exit_list net/core/net_namespace.c:175 [inline]
 cleanup_net+0x5dc/0x8d0 net/core/net_namespace.c:618
 process_one_work+0x694/0x1204 kernel/workqueue.c:2633
 process_scheduled_works kernel/workqueue.c:2706 [inline]
 worker_thread+0x938/0xef4 kernel/workqueue.c:2787
 kthread+0x288/0x310 kernel/kthread.c:388
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860
Code: 97b951d7 91008333 aa0003f4 d343fe68 (38786908) 
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
   0:	97b951d7 	bl	0xfffffffffee5475c
   4:	91008333 	add	x19, x25, #0x20
   8:	aa0003f4 	mov	x20, x0
   c:	d343fe68 	lsr	x8, x19, #3
* 10:	38786908 	ldrb	w8, [x8, x24] <-- trapping instruction

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/03/21 00:53 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 707081b61156 5b7d42ae .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-out-of-bounds Read in mini_qdisc_pair_swap
2024/03/26 00:15 net f99c5f563c17 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mini_qdisc_pair_swap
* Struck through repros no longer work on HEAD.