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+0xea1/0x1140 drivers/net/slip/slip.c:806 Read of size 1 at addr ffff888060f14d91 by task syz-executor.2/6548 CPU: 0 PID: 6548 Comm: syz-executor.2 Not tainted 6.9.0-rc5-syzkaller-00042-ge88c4cfcb7b8 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 sl_sync drivers/net/slip/slip.c:730 [inline] slip_open+0xea1/0x1140 drivers/net/slip/slip.c:806 tty_ldisc_open+0x9c/0x120 drivers/tty/tty_ldisc.c:432 tty_set_ldisc+0x2e6/0x680 drivers/tty/tty_ldisc.c:557 tiocsetd drivers/tty/tty_io.c:2439 [inline] tty_ioctl+0xc2e/0x15f0 drivers/tty/tty_io.c:2739 tty_compat_ioctl+0x25c/0x4f0 drivers/tty/tty_io.c:2953 __do_compat_sys_ioctl+0x2c3/0x330 fs/ioctl.c:1004 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf725b579 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:00000000f5e4d5ac EFLAGS: 00000292 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 0000000000005423 RDX: 0000000020000040 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 6539: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:3966 [inline] __kmalloc_node+0x226/0x480 mm/slub.c:3973 kmalloc_node include/linux/slab.h:648 [inline] kvmalloc_node+0x9d/0x1a0 mm/util.c:634 kvmalloc include/linux/slab.h:766 [inline] kvzalloc include/linux/slab.h:774 [inline] alloc_netdev_mqs+0xb3/0x1260 net/core/dev.c:10849 sl_alloc drivers/net/slip/slip.c:756 [inline] slip_open+0x35d/0x1140 drivers/net/slip/slip.c:817 tty_ldisc_open+0x9c/0x120 drivers/tty/tty_ldisc.c:432 tty_set_ldisc+0x2e6/0x680 drivers/tty/tty_ldisc.c:557 tiocsetd drivers/tty/tty_io.c:2439 [inline] tty_ioctl+0xc2e/0x15f0 drivers/tty/tty_io.c:2739 tty_compat_ioctl+0x25c/0x4f0 drivers/tty/tty_io.c:2953 __do_compat_sys_ioctl+0x2c3/0x330 fs/ioctl.c:1004 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 6538: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object mm/kasan/common.c:240 [inline] __kasan_slab_free+0x11d/0x1a0 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2106 [inline] slab_free mm/slub.c:4280 [inline] kfree+0x129/0x390 mm/slub.c:4390 kvfree+0x47/0x50 mm/util.c:680 device_release+0xa1/0x240 drivers/base/core.c:2580 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1fa/0x5b0 lib/kobject.c:737 netdev_run_todo+0x7d1/0x1260 net/core/dev.c:10600 slip_close+0x165/0x1c0 drivers/net/slip/slip.c:906 tty_ldisc_close+0x111/0x1a0 drivers/tty/tty_ldisc.c:455 tty_ldisc_kill+0x8e/0x150 drivers/tty/tty_ldisc.c:607 tty_ldisc_release+0x116/0x2a0 drivers/tty/tty_ldisc.c:775 tty_release_struct+0x23/0xe0 drivers/tty/tty_io.c:1696 tty_release+0xe33/0x1420 drivers/tty/tty_io.c:1867 __fput+0x270/0xb80 fs/file_table.c:422 __fput_sync+0x47/0x50 fs/file_table.c:507 __do_sys_close fs/open.c:1556 [inline] __se_sys_close fs/open.c:1541 [inline] __ia32_sys_close+0x86/0x100 fs/open.c:1541 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff888060f14000 which belongs to the cache kmalloc-cg-4k of size 4096 The buggy address is located 3473 bytes inside of freed 4096-byte region [ffff888060f14000, ffff888060f15000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x60f10 head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff888062fc1b81 ksm flags: 0x4fff80000000840(slab|head|node=1|zone=1|lastcpupid=0xfff) page_type: 0xffffffff() raw: 04fff80000000840 ffff888014c50280 ffffea0001781000 0000000000000003 raw: 0000000000000000 0000000080040004 00000001ffffffff ffff888062fc1b81 head: 04fff80000000840 ffff888014c50280 ffffea0001781000 0000000000000003 head: 0000000000000000 0000000080040004 00000001ffffffff ffff888062fc1b81 head: 04fff80000000003 ffffea000183c401 dead000000000122 00000000ffffffff head: 0000000800000000 0000000000000000 00000000ffffffff 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4691, tgid 1247449937 (udevd), ts 4691, free_ts 61356039317 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317 __alloc_pages+0x22b/0x2460 mm/page_alloc.c:4575 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page mm/slub.c:2175 [inline] allocate_slab mm/slub.c:2338 [inline] new_slab+0xcc/0x3a0 mm/slub.c:2391 ___slab_alloc+0x670/0x16d0 mm/slub.c:3525 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3610 __slab_alloc_node mm/slub.c:3663 [inline] slab_alloc_node mm/slub.c:3835 [inline] __do_kmalloc_node mm/slub.c:3965 [inline] __kmalloc_node+0x36e/0x480 mm/slub.c:3973 kmalloc_node include/linux/slab.h:648 [inline] kvmalloc_node+0x9d/0x1a0 mm/util.c:634 kvmalloc include/linux/slab.h:766 [inline] seq_buf_alloc fs/seq_file.c:38 [inline] seq_read_iter+0x830/0x12c0 fs/seq_file.c:210 kernfs_fop_read_iter+0x41a/0x590 fs/kernfs/file.c:279 call_read_iter include/linux/fs.h:2104 [inline] new_sync_read fs/read_write.c:395 [inline] vfs_read+0x6c0/0xb80 fs/read_write.c:476 ksys_read+0x12f/0x260 fs/read_write.c:619 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcf/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 4691 tgid 4691 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2347 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2487 __put_partials+0x14c/0x170 mm/slub.c:2906 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3798 [inline] slab_alloc_node mm/slub.c:3845 [inline] __do_kmalloc_node mm/slub.c:3965 [inline] __kmalloc+0x1bd/0x440 mm/slub.c:3979 kmalloc include/linux/slab.h:632 [inline] kzalloc include/linux/slab.h:749 [inline] tomoyo_encode2+0x100/0x3e0 security/tomoyo/realpath.c:45 tomoyo_encode security/tomoyo/realpath.c:80 [inline] tomoyo_realpath_from_path+0x1a7/0x710 security/tomoyo/realpath.c:283 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x2a7/0x3b0 security/tomoyo/file.c:771 tomoyo_file_open+0x71/0x90 security/tomoyo/tomoyo.c:334 security_file_open+0x78/0x630 security/security.c:2961 do_dentry_open+0x583/0x18c0 fs/open.c:942 do_open fs/namei.c:3642 [inline] path_openat+0x1dfb/0x2990 fs/namei.c:3799 do_filp_open+0x1dc/0x430 fs/namei.c:3826 do_sys_openat2+0x17a/0x1e0 fs/open.c:1406 Memory state around the buggy address: ffff888060f14c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888060f14d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888060f14d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888060f14e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888060f14e80: 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 ret 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