================================================================== BUG: KASAN: use-after-free in fb_mode_is_equal+0x284/0x2f0 drivers/video/fbdev/core/modedb.c:924 Read of size 4 at addr ffff888014fd1e1c by task syz-executor.2/27833 CPU: 1 PID: 27833 Comm: syz-executor.2 Not tainted 5.13.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x141/0x1d7 lib/dump_stack.c:120 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436 fb_mode_is_equal+0x284/0x2f0 drivers/video/fbdev/core/modedb.c:924 fbcon_mode_deleted+0x13d/0x1d0 drivers/video/fbdev/core/fbcon.c:2718 fb_set_var+0xae1/0xda0 drivers/video/fbdev/core/fbmem.c:975 do_fb_ioctl+0x2f9/0x690 drivers/video/fbdev/core/fbmem.c:1108 fb_ioctl+0xe7/0x150 drivers/video/fbdev/core/fbmem.c:1185 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl fs/ioctl.c:1055 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:1055 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665d9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f198c883188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665d9 RDX: 0000000020000c00 RSI: 0000000000004601 RDI: 0000000000000003 RBP: 00000000004bfcb9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 00007ffc0f85135f R14: 00007f198c883300 R15: 0000000000022000 Allocated by task 11880: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc mm/kasan/common.c:507 [inline] ____kasan_kmalloc mm/kasan/common.c:466 [inline] __kasan_kmalloc+0x9b/0xd0 mm/kasan/common.c:516 kmalloc include/linux/slab.h:556 [inline] fb_add_videomode drivers/video/fbdev/core/modedb.c:1073 [inline] fb_add_videomode+0x2fb/0x610 drivers/video/fbdev/core/modedb.c:1057 fb_set_var+0x631/0xda0 drivers/video/fbdev/core/fbmem.c:1049 do_fb_ioctl+0x2f9/0x690 drivers/video/fbdev/core/fbmem.c:1108 fb_ioctl+0xe7/0x150 drivers/video/fbdev/core/fbmem.c:1185 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl fs/ioctl.c:1055 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:1055 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 27804: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357 ____kasan_slab_free mm/kasan/common.c:360 [inline] ____kasan_slab_free mm/kasan/common.c:325 [inline] __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:212 [inline] slab_free_hook mm/slub.c:1582 [inline] slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1607 slab_free mm/slub.c:3167 [inline] kfree+0xe5/0x7f0 mm/slub.c:4217 fb_delete_videomode+0x3d2/0x570 drivers/video/fbdev/core/modedb.c:1104 fb_set_var+0xaf1/0xda0 drivers/video/fbdev/core/fbmem.c:978 do_fb_ioctl+0x2f9/0x690 drivers/video/fbdev/core/fbmem.c:1108 fb_ioctl+0xe7/0x150 drivers/video/fbdev/core/fbmem.c:1185 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl fs/ioctl.c:1055 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:1055 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae Last potentially related work creation: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_record_aux_stack+0xe5/0x110 mm/kasan/generic.c:345 kvfree_call_rcu+0x74/0x8c0 kernel/rcu/tree.c:3597 __hw_addr_del_entry+0x2dd/0x3b0 net/core/dev_addr_lists.c:107 __hw_addr_del_ex+0x129/0x150 net/core/dev_addr_lists.c:121 __dev_mc_del net/core/dev_addr_lists.c:815 [inline] dev_mc_del+0xb9/0x110 net/core/dev_addr_lists.c:833 igmp6_group_dropped+0x31e/0xe90 net/ipv6/mcast.c:710 ipv6_mc_down+0xc7/0x4c0 net/ipv6/mcast.c:2718 ipv6_mc_destroy_dev+0x25/0x620 net/ipv6/mcast.c:2787 addrconf_ifdown.isra.0+0xf51/0x15b0 net/ipv6/addrconf.c:3840 addrconf_notify+0x55c/0x23e0 net/ipv6/addrconf.c:3631 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2121 call_netdevice_notifiers_extack net/core/dev.c:2133 [inline] call_netdevice_notifiers net/core/dev.c:2147 [inline] unregister_netdevice_many+0x951/0x1790 net/core/dev.c:11025 __rtnl_newlink+0x1407/0x1710 net/core/rtnetlink.c:3483 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3500 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5564 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:654 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:674 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2350 ___sys_sendmsg+0xf3/0x170 net/socket.c:2404 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2433 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae Second to last potentially related work creation: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_record_aux_stack+0xe5/0x110 mm/kasan/generic.c:345 __call_rcu kernel/rcu/tree.c:3038 [inline] call_rcu+0xb1/0x750 kernel/rcu/tree.c:3113 nf_hook_entries_free net/netfilter/core.c:88 [inline] nf_hook_entries_free net/netfilter/core.c:75 [inline] __nf_register_net_hook+0x2aa/0x610 net/netfilter/core.c:424 nf_register_net_hook+0x114/0x170 net/netfilter/core.c:541 nf_register_net_hooks+0x59/0xc0 net/netfilter/core.c:557 ip6t_register_table+0x262/0x360 net/ipv6/netfilter/ip6_tables.c:1777 ip6table_filter_table_init+0x93/0xc0 net/ipv6/netfilter/ip6table_filter.c:59 xt_find_table_lock+0x5d8/0xae0 net/netfilter/x_tables.c:1244 xt_request_find_table_lock+0x27/0xf0 net/netfilter/x_tables.c:1275 get_info+0x16a/0x740 net/ipv6/netfilter/ip6_tables.c:980 do_ip6t_get_ctl+0x152/0xa10 net/ipv6/netfilter/ip6_tables.c:1662 nf_getsockopt+0x72/0xd0 net/netfilter/nf_sockopt.c:116 ipv6_getsockopt+0x1be/0x270 net/ipv6/ipv6_sockglue.c:1486 tcp_getsockopt+0x86/0xd0 net/ipv4/tcp.c:4252 __sys_getsockopt+0x21f/0x5f0 net/socket.c:2161 __do_sys_getsockopt net/socket.c:2176 [inline] __se_sys_getsockopt net/socket.c:2173 [inline] __x64_sys_getsockopt+0xba/0x150 net/socket.c:2173 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888014fd1e00 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 28 bytes inside of 96-byte region [ffff888014fd1e00, ffff888014fd1e60) The buggy address belongs to the page: page:ffffea000053f440 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888014fd1e80 pfn:0x14fd1 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00007f0a08 ffffea00008796c8 ffff888011041780 raw: ffff888014fd1e80 000000000020001d 00000001ffffffff 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 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 6440, ts 31666213994, free_ts 31653048817 prep_new_page mm/page_alloc.c:2358 [inline] get_page_from_freelist+0x1033/0x2b60 mm/page_alloc.c:3994 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5200 alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2272 alloc_slab_page mm/slub.c:1645 [inline] allocate_slab+0x2c5/0x4c0 mm/slub.c:1785 new_slab mm/slub.c:1848 [inline] new_slab_objects mm/slub.c:2594 [inline] ___slab_alloc+0x4a1/0x810 mm/slub.c:2757 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2797 slab_alloc_node mm/slub.c:2879 [inline] slab_alloc mm/slub.c:2921 [inline] __kmalloc+0x315/0x330 mm/slub.c:4055 kmalloc include/linux/slab.h:561 [inline] kzalloc include/linux/slab.h:686 [inline] tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45 tomoyo_encode2 security/tomoyo/realpath.c:31 [inline] tomoyo_encode+0x28/0x50 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x186/0x620 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822 security_inode_getattr+0xcf/0x140 security/security.c:1332 vfs_getattr fs/stat.c:139 [inline] vfs_fstat+0x43/0xb0 fs/stat.c:164 __do_sys_newfstat+0x81/0x100 fs/stat.c:404 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1298 [inline] free_pcp_prepare+0x223/0x300 mm/page_alloc.c:1342 free_unref_page_prepare mm/page_alloc.c:3250 [inline] free_unref_page_list+0x19b/0x7c0 mm/page_alloc.c:3318 release_pages+0x853/0x2120 mm/swap.c:972 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:242 [inline] tlb_flush_mmu mm/mmu_gather.c:249 [inline] tlb_finish_mmu+0x165/0x8c0 mm/mmu_gather.c:340 exit_mmap+0x2c2/0x590 mm/mmap.c:3210 __mmput+0x122/0x470 kernel/fork.c:1096 mmput+0x58/0x60 kernel/fork.c:1117 free_bprm+0x65/0x2e0 fs/exec.c:1478 kernel_execve+0x380/0x460 fs/exec.c:1975 call_usermodehelper_exec_async+0x2e3/0x580 kernel/umh.c:112 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 Memory state around the buggy address: ffff888014fd1d00: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ffff888014fd1d80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc >ffff888014fd1e00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff888014fd1e80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff888014fd1f00: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc ==================================================================