syzbot


KASAN: slab-use-after-free Read in slip_open

Status: auto-obsoleted due to no activity on 2023/08/05 06:52
Subsystems: net
[Documentation on labels]
First crash: 386d, last: 373d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in slip_open (2) net 1 10d 6d08h 0/26 moderation: reported on 2024/04/29 07:50
linux-6.1 KASAN: use-after-free Read in slip_open 1 328d 328d 0/3 auto-obsoleted due to no activity on 2023/09/20 09:40
upstream KASAN: use-after-free Read in slip_open (2) net 4 569d 722d 0/26 auto-obsoleted due to no activity on 2023/02/11 15:10

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in sl_sync drivers/net/slip/slip.c:730 [inline]
BUG: KASAN: slab-use-after-free in slip_open+0xef7/0x1210 drivers/net/slip/slip.c:806
Read of size 1 at addr ffff88804be52d71 by task syz-executor.3/21890

CPU: 3 PID: 21890 Comm: syz-executor.3 Not tainted 6.3.0-rc6-syzkaller-00168-g95abc817ab3a #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:319
 print_report mm/kasan/report.c:430 [inline]
 kasan_report+0x11c/0x130 mm/kasan/report.c:536
 sl_sync drivers/net/slip/slip.c:730 [inline]
 slip_open+0xef7/0x1210 drivers/net/slip/slip.c:806
 tty_ldisc_open+0x9b/0x110 drivers/tty/tty_ldisc.c:433
 tty_set_ldisc+0x2f5/0x690 drivers/tty/tty_ldisc.c:558
 tiocsetd drivers/tty/tty_io.c:2432 [inline]
 tty_ioctl+0x67e/0x16e0 drivers/tty/tty_io.c:2713
 tty_compat_ioctl+0x2c3/0x4a0 drivers/tty/tty_io.c:2927
 __do_compat_sys_ioctl+0x255/0x2b0 fs/ioctl.c:968
 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
 __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178
 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82
RIP: 0023:0xf7fc1579
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000f7fbc5cc EFLAGS: 00000296 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 0000000000005423
RDX: 0000000020000040 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Allocated by task 21884:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 ____kasan_kmalloc mm/kasan/common.c:333 [inline]
 __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:196 [inline]
 __do_kmalloc_node mm/slab_common.c:967 [inline]
 __kmalloc_node+0x61/0x1a0 mm/slab_common.c:974
 kmalloc_node include/linux/slab.h:610 [inline]
 kvmalloc_node+0xa2/0x1a0 mm/util.c:603
 kvmalloc include/linux/slab.h:737 [inline]
 kvzalloc include/linux/slab.h:745 [inline]
 alloc_netdev_mqs+0x9c/0x1250 net/core/dev.c:10588
 sl_alloc drivers/net/slip/slip.c:756 [inline]
 slip_open+0x371/0x1210 drivers/net/slip/slip.c:817
 tty_ldisc_open+0x9b/0x110 drivers/tty/tty_ldisc.c:433
 tty_set_ldisc+0x2f5/0x690 drivers/tty/tty_ldisc.c:558
 tiocsetd drivers/tty/tty_io.c:2432 [inline]
 tty_ioctl+0x67e/0x16e0 drivers/tty/tty_io.c:2713
 tty_compat_ioctl+0x2c3/0x4a0 drivers/tty/tty_io.c:2927
 __do_compat_sys_ioctl+0x255/0x2b0 fs/ioctl.c:968
 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
 __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178
 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82

Freed by task 21883:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:521
 ____kasan_slab_free mm/kasan/common.c:236 [inline]
 ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200
 kasan_slab_free include/linux/kasan.h:162 [inline]
 slab_free_hook mm/slub.c:1781 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807
 slab_free mm/slub.c:3787 [inline]
 __kmem_cache_free+0xaf/0x2d0 mm/slub.c:3800
 kvfree+0x46/0x50 mm/util.c:649
 device_release+0xa3/0x240 drivers/base/core.c:2436
 kobject_cleanup lib/kobject.c:681 [inline]
 kobject_release lib/kobject.c:712 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x1c2/0x4d0 lib/kobject.c:729
 netdev_run_todo+0x762/0x1100 net/core/dev.c:10362
 slip_close+0x165/0x1c0 drivers/net/slip/slip.c:906
 tty_ldisc_close+0x110/0x190 drivers/tty/tty_ldisc.c:456
 tty_ldisc_kill+0x94/0x150 drivers/tty/tty_ldisc.c:608
 tty_ldisc_release+0xe5/0x2a0 drivers/tty/tty_ldisc.c:776
 tty_release_struct+0x24/0xf0 drivers/tty/tty_io.c:1689
 tty_release+0xd9e/0x1380 drivers/tty/tty_io.c:1860
 __fput+0x27c/0xa90 fs/file_table.c:321
 task_work_run+0x16f/0x270 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
 exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
 syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297
 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181
 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82

The buggy address belongs to the object at ffff88804be52000
 which belongs to the cache kmalloc-cg-4k of size 4096
The buggy address is located 3441 bytes inside of
 freed 4096-byte region [ffff88804be52000, ffff88804be53000)

The buggy address belongs to the physical page:
page:ffffea00012f9400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4be50
head:ffffea00012f9400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff88805af15d41
flags: 0x4fff00000010200(slab|head|node=1|zone=1|lastcpupid=0x7ff)
raw: 04fff00000010200 ffff888012450280 ffffea0001267800 dead000000000002
raw: 0000000000000000 0000000000040004 00000001ffffffff ffff88805af15d41
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 21592, tgid 21592 (cmp), ts 2154607866515, free_ts 2154191927652
 prep_new_page mm/page_alloc.c:2553 [inline]
 get_page_from_freelist+0x1190/0x2e20 mm/page_alloc.c:4326
 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:5592
 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2283
 alloc_slab_page mm/slub.c:1851 [inline]
 allocate_slab+0x25f/0x390 mm/slub.c:1998
 new_slab mm/slub.c:2051 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3193
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3292
 __slab_alloc_node mm/slub.c:3345 [inline]
 slab_alloc_node mm/slub.c:3442 [inline]
 __kmem_cache_alloc_node+0x136/0x320 mm/slub.c:3491
 __do_kmalloc_node mm/slab_common.c:966 [inline]
 __kmalloc_node+0x51/0x1a0 mm/slab_common.c:974
 kmalloc_node include/linux/slab.h:610 [inline]
 kvmalloc_node+0xa2/0x1a0 mm/util.c:603
 kvmalloc include/linux/slab.h:737 [inline]
 seq_buf_alloc fs/seq_file.c:38 [inline]
 seq_read_iter+0x7fb/0x12d0 fs/seq_file.c:210
 proc_reg_read_iter+0x1ff/0x2d0 fs/proc/inode.c:305
 call_read_iter include/linux/fs.h:1845 [inline]
 new_sync_read fs/read_write.c:389 [inline]
 vfs_read+0x681/0x930 fs/read_write.c:470
 ksys_read+0x12b/0x250 fs/read_write.c:613
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1454 [inline]
 free_pcp_prepare+0x5d5/0xa50 mm/page_alloc.c:1504
 free_unref_page_prepare mm/page_alloc.c:3388 [inline]
 free_unref_page+0x1d/0x490 mm/page_alloc.c:3483
 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2637
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x192/0x220 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:186 [inline]
 slab_post_alloc_hook mm/slab.h:769 [inline]
 slab_alloc_node mm/slub.c:3452 [inline]
 slab_alloc mm/slub.c:3460 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3467 [inline]
 kmem_cache_alloc+0x17c/0x3b0 mm/slub.c:3476
 getname_flags.part.0+0x50/0x4f0 fs/namei.c:140
 getname_flags+0x9e/0xe0 include/linux/audit.h:321
 user_path_at_empty+0x2f/0x60 fs/namei.c:2876
 user_path_at include/linux/namei.h:57 [inline]
 ksys_umount fs/namespace.c:1824 [inline]
 __do_sys_umount fs/namespace.c:1832 [inline]
 __se_sys_umount fs/namespace.c:1830 [inline]
 __ia32_sys_umount+0xfc/0x190 fs/namespace.c:1830
 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
 __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178
 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203
 entry_SYSENTER_compat_after_hwframe+0x70/0x82

Memory state around the buggy address:
 ffff88804be52c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804be52c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88804be52d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff88804be52d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804be52e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 2 bytes skipped:
   0:	10 06                	adc    %al,(%rsi)
   2:	03 74 b4 01          	add    0x1(%rsp,%rsi,4),%esi
   6:	10 07                	adc    %al,(%rdi)
   8:	03 74 b0 01          	add    0x1(%rax,%rsi,4),%esi
   c:	10 08                	adc    %cl,(%rax)
   e:	03 74 d8 01          	add    0x1(%rax,%rbx,8),%esi
  1e:	00 51 52             	add    %dl,0x52(%rcx)
  21:	55                   	push   %rbp
  22:	89 e5                	mov    %esp,%ebp
  24:	0f 34                	sysenter
  26:	cd 80                	int    $0x80
* 28:	5d                   	pop    %rbp <-- trapping instruction
  29:	5a                   	pop    %rdx
  2a:	59                   	pop    %rcx
  2b:	c3                   	retq
  2c:	90                   	nop
  2d:	90                   	nop
  2e:	90                   	nop
  2f:	90                   	nop
  30:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi
  37:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/04/15 05:58 upstream 95abc817ab3a ec410564 .config console log report info ci-qemu-upstream-386 KASAN: slab-use-after-free Read in slip_open
2023/04/27 19:24 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 14f8db1c0f9a 6f5b1cc4 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in slip_open
* Struck through repros no longer work on HEAD.