================================================================== BUG: KASAN: slab-use-after-free in drm_atomic_helper_wait_for_vblanks.part.0+0x7d5/0x8a0 drivers/gpu/drm/drm_atomic_helper.c:1905 Read of size 1 at addr ffff88802af5e409 by task kworker/u33:16/23377 CPU: 2 UID: 0 PID: 23377 Comm: kworker/u33:16 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 Workqueue: events_unbound commit_work 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 drm_atomic_helper_wait_for_vblanks.part.0+0x7d5/0x8a0 drivers/gpu/drm/drm_atomic_helper.c:1905 drm_atomic_helper_wait_for_vblanks drivers/gpu/drm/drm_atomic_helper.c:1901 [inline] drm_atomic_helper_commit_tail+0xff/0x130 drivers/gpu/drm/drm_atomic_helper.c:2003 commit_tail+0x338/0x430 drivers/gpu/drm/drm_atomic_helper.c:2080 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3396 process_scheduled_works kernel/workqueue.c:3479 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3560 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 10017: 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:409 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:426 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x2f8/0x6d0 mm/slub.c:5563 _kmalloc_noprof include/linux/slab.h:991 [inline] drm_atomic_helper_crtc_duplicate_state+0x72/0xd0 drivers/gpu/drm/drm_atomic_state_helper.c:204 drm_atomic_get_crtc_state+0x1de/0x690 drivers/gpu/drm/drm_atomic.c:462 drm_atomic_set_property+0x165/0x3f90 drivers/gpu/drm/drm_atomic_uapi.c:1244 drm_mode_atomic_ioctl+0x6ed/0x2940 drivers/gpu/drm/drm_atomic_uapi.c:1744 drm_ioctl_kernel+0x1f3/0x3e0 drivers/gpu/drm/drm_ioctl.c:817 drm_ioctl+0x5e6/0xc60 drivers/gpu/drm/drm_ioctl.c:914 drm_compat_ioctl+0x386/0x4c0 drivers/gpu/drm/drm_ioc32.c:381 __do_compat_sys_ioctl fs/ioctl.c:695 [inline] __se_compat_sys_ioctl fs/ioctl.c:638 [inline] __ia32_compat_sys_ioctl+0x2cf/0x360 fs/ioctl.c:638 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 10016: 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:264 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:296 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2748 [inline] slab_free mm/slub.c:6509 [inline] kfree+0x22b/0x6d0 mm/slub.c:6802 drm_atomic_commit_default_clear+0x465/0x10c0 drivers/gpu/drm/drm_atomic.c:311 drm_atomic_commit_clear drivers/gpu/drm/drm_atomic.c:394 [inline] __drm_atomic_commit_free+0x185/0x2f0 drivers/gpu/drm/drm_atomic.c:411 kref_put include/linux/kref.h:65 [inline] drm_atomic_commit_put include/drm/drm_atomic.h:713 [inline] drm_client_modeset_commit_atomic+0x5f3/0x7e0 drivers/gpu/drm/drm_client_modeset.c:1110 drm_client_modeset_commit_locked+0x14d/0x580 drivers/gpu/drm/drm_client_modeset.c:1207 drm_client_modeset_commit+0x4f/0x80 drivers/gpu/drm/drm_client_modeset.c:1233 __drm_fb_helper_restore_fbdev_mode_unlocked.part.0+0x137/0x160 drivers/gpu/drm/drm_fb_helper.c:138 __drm_fb_helper_restore_fbdev_mode_unlocked drivers/gpu/drm/drm_fb_helper.c:126 [inline] drm_fb_helper_restore_fbdev_mode_unlocked+0x93/0xc0 drivers/gpu/drm/drm_fb_helper.c:169 drm_fbdev_client_restore+0x76/0xa0 drivers/gpu/drm/clients/drm_fbdev_client.c:53 drm_client_dev_restore+0x205/0x2a0 drivers/gpu/drm/drm_client_event.c:118 drm_lastclose drivers/gpu/drm/drm_file.c:408 [inline] drm_release+0x2c6/0x360 drivers/gpu/drm/drm_file.c:441 __fput+0x3ff/0xb50 fs/file_table.c:512 task_work_run+0x150/0x240 kernel/task_work.c:233 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] __exit_to_user_mode_loop kernel/entry/common.c:70 [inline] exit_to_user_mode_loop+0x1d8/0x700 kernel/entry/common.c:101 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:343 [inline] __do_fast_syscall_32+0x59f/0x8b0 arch/x86/entry/syscall_32.c:294 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff88802af5e400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 9 bytes inside of freed 512-byte region [ffff88802af5e400, ffff88802af5e600) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2af5c head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801c042c80 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801c042c80 dead000000000100 dead000000000122 head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000002 ffffffffffffff01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5137, tgid 5137 (find), ts 10584566448 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1871 prep_new_page mm/page_alloc.c:1879 [inline] get_page_from_freelist+0x110d/0x35d0 mm/page_alloc.c:3943 __alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436 alloc_slab_page mm/slub.c:3347 [inline] allocate_slab mm/slub.c:3462 [inline] new_slab+0xa9/0x6e0 mm/slub.c:3513 refill_objects+0xe3/0x410 mm/slub.c:7418 refill_sheaf mm/slub.c:2885 [inline] __pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4774 alloc_from_pcs mm/slub.c:4850 [inline] slab_alloc_node mm/slub.c:4984 [inline] __do_kmalloc_node mm/slub.c:5413 [inline] __kmalloc_noprof+0x67c/0x840 mm/slub.c:5439 _kmalloc_noprof include/linux/slab.h:995 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] tomoyo_init_log+0x1224/0x20c0 security/tomoyo/audit.c:273 tomoyo_supervisor+0x506/0x1340 security/tomoyo/common.c:2232 tomoyo_audit_path_log security/tomoyo/file.c:169 [inline] tomoyo_path_permission security/tomoyo/file.c:592 [inline] tomoyo_path_permission+0x270/0x3b0 security/tomoyo/file.c:577 tomoyo_check_open_permission+0x37f/0x3c0 security/tomoyo/file.c:782 tomoyo_file_open+0x6b/0x90 security/tomoyo/tomoyo.c:334 security_file_open+0xb5/0x1e0 security/security.c:2739 do_dentry_open+0x588/0x14d0 fs/open.c:973 vfs_open+0x82/0x3f0 fs/open.c:1101 do_open fs/namei.c:4837 [inline] path_openat+0x19fa/0x2440 fs/namei.c:5000 page_owner free stack trace missing Memory state around the buggy address: ffff88802af5e300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802af5e380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802af5e400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802af5e480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802af5e500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================