================================================================== BUG: KASAN: slab-use-after-free in drm_atomic_helper_wait_for_vblanks+0x317/0x8f0 drivers/gpu/drm/drm_atomic_helper.c:1905 Read of size 1 at addr ffff8880404fe009 by task kworker/u4:6/109 CPU: 0 UID: 0 PID: 109 Comm: kworker/u4:6 Not tainted syzkaller #0 PREEMPT(full) 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_lvl+0xe8/0x150 lib/dump_stack.c:120 print_address_description+0x55/0x1e0 mm/kasan/report.c:378 print_report+0x58/0x70 mm/kasan/report.c:482 kasan_report+0x117/0x150 mm/kasan/report.c:595 drm_atomic_helper_wait_for_vblanks+0x317/0x8f0 drivers/gpu/drm/drm_atomic_helper.c:1905 drm_atomic_helper_commit_tail+0x2e9/0x510 drivers/gpu/drm/drm_atomic_helper.c:2003 commit_tail+0x2b1/0x3c0 drivers/gpu/drm/drm_atomic_helper.c:2080 process_one_work kernel/workqueue.c:3396 [inline] process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3479 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3560 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 5320: kasan_save_stack mm/kasan/common.c:57 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:415 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x321/0x600 mm/slub.c:5563 _kmalloc_noprof include/linux/slab.h:991 [inline] drm_atomic_helper_crtc_duplicate_state+0x72/0xb0 drivers/gpu/drm/drm_atomic_state_helper.c:204 drm_atomic_get_crtc_state+0x1b3/0x570 drivers/gpu/drm/drm_atomic.c:462 drm_atomic_set_property+0x17b/0x4040 drivers/gpu/drm/drm_atomic_uapi.c:1244 drm_mode_atomic_ioctl+0x817/0x2550 drivers/gpu/drm/drm_atomic_uapi.c:1737 drm_ioctl_kernel+0x2df/0x3b0 drivers/gpu/drm/drm_ioctl.c:817 drm_ioctl+0x70e/0xba0 drivers/gpu/drm/drm_ioctl.c:914 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 1914: kasan_save_stack mm/kasan/common.c:57 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:78 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2748 [inline] slab_free mm/slub.c:6499 [inline] kfree+0x1c5/0x650 mm/slub.c:6792 drm_atomic_commit_default_clear+0x47f/0xf00 drivers/gpu/drm/drm_atomic.c:311 drm_atomic_commit_clear drivers/gpu/drm/drm_atomic.c:394 [inline] __drm_atomic_commit_free+0xb4/0x230 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_atomic_helper_dirtyfb+0xee3/0xfd0 drivers/gpu/drm/drm_damage_helper.c:195 drm_fbdev_shmem_helper_fb_dirty+0x160/0x310 drivers/gpu/drm/drm_fbdev_shmem.c:117 drm_fb_helper_fb_dirty drivers/gpu/drm/drm_fb_helper.c:339 [inline] drm_fb_helper_damage_work+0x84c/0xf20 drivers/gpu/drm/drm_fb_helper.c:365 process_one_work kernel/workqueue.c:3396 [inline] process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3479 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3560 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff8880404fe000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 9 bytes inside of freed 512-byte region [ffff8880404fe000, ffff8880404fe200) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff8880404fec00 pfn:0x404fe head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000240(workingset|head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000240 ffff88801b041c80 ffffea0000fd9c90 ffff8880304007c8 raw: ffff8880404fec00 0000000000080003 00000000f5000000 0000000000000000 head: 04fff00000000240 ffff88801b041c80 ffffea0000fd9c90 ffff8880304007c8 head: ffff8880404fec00 0000000000080003 00000000f5000000 0000000000000000 head: 04fff00000000001 ffffffffffffff81 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000002 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5318, tgid 5318 (kworker/0:6), ts 91578673572 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1871 prep_new_page mm/page_alloc.c:1879 [inline] get_page_from_freelist+0x2209/0x2280 mm/page_alloc.c:3943 __alloc_frozen_pages_noprof+0x217/0x5a0 mm/page_alloc.c:5436 alloc_slab_page mm/slub.c:3347 [inline] allocate_slab+0x7d/0x620 mm/slub.c:3462 new_slab mm/slub.c:3513 [inline] refill_objects+0x2d5/0x350 mm/slub.c:7410 refill_sheaf mm/slub.c:2885 [inline] __pcs_replace_empty_main+0x2c8/0x6c0 mm/slub.c:4774 alloc_from_pcs mm/slub.c:4850 [inline] slab_alloc_node mm/slub.c:4984 [inline] __kmalloc_cache_noprof+0x39b/0x600 mm/slub.c:5559 _kmalloc_noprof include/linux/slab.h:991 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] drm_atomic_helper_setup_commit+0x1b2/0x1a30 drivers/gpu/drm/drm_atomic_helper.c:2533 drm_atomic_helper_commit+0x6a/0xb10 drivers/gpu/drm/drm_atomic_helper.c:2268 drm_atomic_commit+0x24e/0x2b0 drivers/gpu/drm/drm_atomic.c:1869 drm_atomic_helper_dirtyfb+0xe2f/0xfd0 drivers/gpu/drm/drm_damage_helper.c:183 drm_fbdev_shmem_helper_fb_dirty+0x160/0x310 drivers/gpu/drm/drm_fbdev_shmem.c:117 drm_fb_helper_fb_dirty drivers/gpu/drm/drm_fb_helper.c:339 [inline] drm_fb_helper_damage_work+0x84c/0xf20 drivers/gpu/drm/drm_fb_helper.c:365 process_one_work kernel/workqueue.c:3396 [inline] process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3479 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3560 kthread+0x38b/0x480 kernel/kthread.c:436 page last free pid 5213 tgid 5213 ts 76486853675 stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] __free_pages_prepare mm/page_alloc.c:1418 [inline] __free_frozen_pages+0xc93/0xd90 mm/page_alloc.c:2962 __slab_free+0x274/0x2c0 mm/slub.c:5815 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x99/0x100 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:350 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4683 [inline] slab_alloc_node mm/slub.c:4996 [inline] __do_kmalloc_node mm/slub.c:5413 [inline] __kmalloc_node_track_caller_noprof+0x44b/0x720 mm/slub.c:5545 __kmemdup_nul mm/util.c:64 [inline] kstrdup+0x42/0x100 mm/util.c:84 bprm_change_interp+0x88/0xc0 fs/exec.c:1569 load_script+0x717/0x8a0 fs/binfmt_script.c:125 search_binary_handler fs/exec.c:1759 [inline] exec_binprm fs/exec.c:1791 [inline] bprm_execve+0x930/0x1590 fs/exec.c:1847 do_execveat_common+0x4f4/0x670 fs/exec.c:1945 __do_sys_execve fs/exec.c:2018 [inline] __se_sys_execve fs/exec.c:2012 [inline] __x64_sys_execve+0x97/0xc0 fs/exec.c:2012 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff8880404fdf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880404fdf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880404fe000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880404fe080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880404fe100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================