================================================================== BUG: KASAN: slab-use-after-free in string_nocheck lib/vsprintf.c:648 [inline] BUG: KASAN: slab-use-after-free in string+0x471/0x4d0 lib/vsprintf.c:730 Read of size 1 at addr ffff8880261c4c60 by task syz.2.1573/11662 CPU: 2 UID: 0 PID: 11662 Comm: syz.2.1573 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 string_nocheck lib/vsprintf.c:648 [inline] string+0x471/0x4d0 lib/vsprintf.c:730 vsnprintf+0x422/0x1300 lib/vsprintf.c:2945 seq_vprintf fs/seq_file.c:392 [inline] seq_printf+0x1a4/0x250 fs/seq_file.c:407 irq_seq_show+0x390/0x8b0 kernel/irq/proc.c:601 seq_read_iter+0xbce/0x1270 fs/seq_file.c:273 proc_reg_read_iter+0x220/0x310 fs/proc/inode.c:299 new_sync_read fs/read_write.c:493 [inline] vfs_read+0x82e/0xb40 fs/read_write.c:574 ksys_read+0x12a/0x250 fs/read_write.c:716 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf706efec Code: Unable to access opcode bytes at 0xf706efc2. RSP: 002b:00000000f543c50c EFLAGS: 00000292 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 0000000000000007 RCX: 0000000080000400 RDX: 000000000000fdef 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 5733: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kasan_kmalloc include/linux/kasan.h:263 [inline] __do_kmalloc_node mm/slub.c:5334 [inline] __kmalloc_node_noprof+0x339/0x830 mm/slub.c:5346 _kmalloc_node_noprof include/linux/slab.h:1197 [inline] __vmalloc_area_node mm/vmalloc.c:3893 [inline] __vmalloc_node_range_noprof+0x409/0x1630 mm/vmalloc.c:4104 __vmalloc_node_noprof+0xad/0xf0 mm/vmalloc.c:4165 alloc_counters net/ipv6/netfilter/ip6_tables.c:815 [inline] compat_copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:1567 [inline] compat_get_entries+0x3b0/0x860 net/ipv6/netfilter/ip6_tables.c:1610 do_ip6t_get_ctl+0x5c1/0xb00 net/ipv6/netfilter/ip6_tables.c:1675 nf_getsockopt+0x7c/0xe0 net/netfilter/nf_sockopt.c:116 ipv6_getsockopt+0x207/0x2a0 net/ipv6/ipv6_sockglue.c:1464 tcp_getsockopt+0xa1/0x110 net/ipv4/tcp.c:4864 do_sock_getsockopt+0x50a/0x6e0 net/socket.c:2474 __sys_getsockopt+0x133/0x1d0 net/socket.c:2505 __do_compat_sys_socketcall net/compat.c:493 [inline] __se_compat_sys_socketcall net/compat.c:422 [inline] __ia32_compat_sys_socketcall+0x6af/0x770 net/compat.c:422 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 5733: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2677 [inline] slab_free mm/slub.c:6377 [inline] kfree+0x22b/0x6c0 mm/slub.c:6692 vfree mm/vmalloc.c:3511 [inline] vfree+0x12e/0x750 mm/vmalloc.c:3484 compat_copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:1580 [inline] compat_get_entries+0x5d2/0x860 net/ipv6/netfilter/ip6_tables.c:1610 do_ip6t_get_ctl+0x5c1/0xb00 net/ipv6/netfilter/ip6_tables.c:1675 nf_getsockopt+0x7c/0xe0 net/netfilter/nf_sockopt.c:116 ipv6_getsockopt+0x207/0x2a0 net/ipv6/ipv6_sockglue.c:1464 tcp_getsockopt+0xa1/0x110 net/ipv4/tcp.c:4864 do_sock_getsockopt+0x50a/0x6e0 net/socket.c:2474 __sys_getsockopt+0x133/0x1d0 net/socket.c:2505 __do_compat_sys_socketcall net/compat.c:493 [inline] __se_compat_sys_socketcall net/compat.c:422 [inline] __ia32_compat_sys_socketcall+0x6af/0x770 net/compat.c:422 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff8880261c4c60 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes inside of freed 8-byte region [ffff8880261c4c60, ffff8880261c4c68) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x261c4 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801bc42500 dead000000000100 dead000000000122 raw: 0000000000000000 0000000800800080 00000000f5000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0xd2cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 5200980168, free_ts 0 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859 prep_new_page mm/page_alloc.c:1867 [inline] get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946 __alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304 alloc_slab_page mm/slub.c:3266 [inline] allocate_slab mm/slub.c:3380 [inline] new_slab+0xa2/0x640 mm/slub.c:3426 refill_objects+0xe3/0x410 mm/slub.c:7310 refill_sheaf mm/slub.c:2804 [inline] __pcs_replace_empty_main+0x376/0x680 mm/slub.c:4675 alloc_from_pcs mm/slub.c:4773 [inline] slab_alloc_node mm/slub.c:4905 [inline] __do_kmalloc_node mm/slub.c:5333 [inline] __kmalloc_node_track_caller_noprof+0x679/0x830 mm/slub.c:5471 __kmemdup_nul mm/util.c:64 [inline] kstrdup+0x51/0xe0 mm/util.c:84 kstrdup_const+0x63/0x80 mm/util.c:104 __kernfs_new_node+0x9b/0xa10 fs/kernfs/dir.c:661 kernfs_new_node+0x117/0x150 fs/kernfs/dir.c:751 kernfs_create_link+0xcc/0x240 fs/kernfs/symlink.c:39 sysfs_do_create_link_sd+0x90/0x140 fs/sysfs/symlink.c:44 sysfs_do_create_link fs/sysfs/symlink.c:80 [inline] sysfs_create_link+0x61/0xc0 fs/sysfs/symlink.c:92 device_create_sys_dev_entry drivers/base/core.c:3583 [inline] device_add+0xb62/0x1970 drivers/base/core.c:3727 tty_register_device_attr+0x388/0x7f0 drivers/tty/tty_io.c:3261 page_owner free stack trace missing Memory state around the buggy address: ffff8880261c4b00: 07 fc fc fc 06 fc fc fc 05 fc fc fc 05 fc fc fc ffff8880261c4b80: 05 fc fc fc 05 fc fc fc 00 fc fc fc 07 fc fc fc >ffff8880261c4c00: 06 fc fc fc 06 fc fc fc 07 fc fc fc fa fc fc fc ^ ffff8880261c4c80: 07 fc fc fc 06 fc fc fc 04 fc fc fc 07 fc fc fc ffff8880261c4d00: 07 fc fc fc 07 fc fc fc 00 fc fc fc 00 fc fc fc ==================================================================