================================================================== 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 ffff88802816c840 by task syz.5.12870/1144 CPU: 2 UID: 0 PID: 1144 Comm: syz.5.12870 Tainted: G L syzkaller #0 PREEMPT(lazy) 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_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f43f7b9e0d9 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f43f8ae9028 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 00007f43f7e25fa0 RCX: 00007f43f7b9e0d9 RDX: 00000000000003e8 RSI: 0000200000000400 RDI: 0000000000000003 RBP: 00007f43f7c35024 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f43f7e26038 R14: 00007f43f7e25fa0 R15: 00007fff7bc04e68 Allocated by task 28636: 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:3871 [inline] __vmalloc_node_range_noprof+0x409/0x1630 mm/vmalloc.c:4082 __vmalloc_node_noprof+0xad/0xf0 mm/vmalloc.c:4143 alloc_counters net/ipv4/netfilter/ip_tables.c:799 [inline] copy_entries_to_user net/ipv4/netfilter/ip_tables.c:821 [inline] get_entries net/ipv4/netfilter/ip_tables.c:1020 [inline] do_ipt_get_ctl+0x7e0/0xbf0 net/ipv4/netfilter/ip_tables.c:1669 nf_getsockopt+0x7c/0xe0 net/netfilter/nf_sockopt.c:116 ip_getsockopt+0x192/0x1e0 net/ipv4/ip_sockglue.c:1777 tcp_getsockopt+0xa1/0x110 net/ipv4/tcp.c:4864 do_sock_getsockopt+0x50a/0x6e0 net/socket.c:2474 __sys_getsockopt+0x148/0x260 net/socket.c:2505 __do_sys_getsockopt net/socket.c:2512 [inline] __se_sys_getsockopt net/socket.c:2509 [inline] __x64_sys_getsockopt+0xbd/0x160 net/socket.c:2509 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 28636: 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:3489 [inline] vfree+0x12e/0x750 mm/vmalloc.c:3462 copy_entries_to_user net/ipv4/netfilter/ip_tables.c:864 [inline] get_entries net/ipv4/netfilter/ip_tables.c:1020 [inline] do_ipt_get_ctl+0x9d7/0xbf0 net/ipv4/netfilter/ip_tables.c:1669 nf_getsockopt+0x7c/0xe0 net/netfilter/nf_sockopt.c:116 ip_getsockopt+0x192/0x1e0 net/ipv4/ip_sockglue.c:1777 tcp_getsockopt+0xa1/0x110 net/ipv4/tcp.c:4864 do_sock_getsockopt+0x50a/0x6e0 net/socket.c:2474 __sys_getsockopt+0x148/0x260 net/socket.c:2505 __do_sys_getsockopt net/socket.c:2512 [inline] __se_sys_getsockopt net/socket.c:2509 [inline] __x64_sys_getsockopt+0xbd/0x160 net/socket.c:2509 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88802816c840 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes inside of freed 8-byte region [ffff88802816c840, ffff88802816c848) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88802816c660 pfn:0x2816c flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000200 ffff88801bc42500 ffffea00007fa4d0 ffffea0000a48010 raw: ffff88802816c660 000000080080006d 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 6599162945, 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 fs/kernfs/dir.c:751 [inline] kernfs_create_dir_ns+0xa6/0x2b0 fs/kernfs/dir.c:1120 sysfs_create_dir_ns+0x13a/0x2b0 fs/sysfs/dir.c:59 create_dir lib/kobject.c:73 [inline] kobject_add_internal+0x2c8/0x930 lib/kobject.c:240 kobject_add_varg lib/kobject.c:374 [inline] kobject_add+0x16a/0x1e0 lib/kobject.c:426 device_add+0x294/0x1970 drivers/base/core.c:3695 tty_register_device_attr+0x388/0x7f0 drivers/tty/tty_io.c:3261 page_owner free stack trace missing Memory state around the buggy address: ffff88802816c700: fa fc fc fc fa fc fc fc 02 fc fc fc 06 fc fc fc ffff88802816c780: 02 fc fc fc 05 fc fc fc 07 fc fc fc 02 fc fc fc >ffff88802816c800: fa fc fc fc fa fc fc fc fa fc fc fc 07 fc fc fc ^ ffff88802816c880: fa fc fc fc fa fc fc fc 02 fc fc fc 00 fc fc fc ffff88802816c900: fa fc fc fc fa fc fc fc 04 fc fc fc 00 fc fc fc ==================================================================