bisecting cause commit starting from c11d28ab4a691736e30b49813fb801847bd44e83 building syzkaller on 9682898d6f14dd27f95c419d059fd867bb91b22b testing commit c11d28ab4a691736e30b49813fb801847bd44e83 with gcc (GCC) 8.1.0 kernel signature: c07a98f1483118ddc37daadb3109f384869e53aee5a28d827c81e5497257b6ec run #0: crashed: KASAN: use-after-free Read in evdev_cleanup run #1: crashed: KASAN: use-after-free Read in evdev_cleanup run #2: crashed: KASAN: use-after-free Read in evdev_cleanup run #3: crashed: KASAN: use-after-free Read in evdev_cleanup run #4: crashed: KASAN: use-after-free Read in evdev_cleanup run #5: crashed: KASAN: use-after-free Read in evdev_cleanup run #6: crashed: KASAN: use-after-free Read in evdev_cleanup run #7: crashed: KASAN: use-after-free Read in cdev_put run #8: crashed: KASAN: use-after-free Read in evdev_cleanup run #9: crashed: KASAN: use-after-free Read in evdev_cleanup testing release v5.6 testing commit 7111951b8d4973bda27ff663f2cf18b663d15b48 with gcc (GCC) 8.1.0 kernel signature: f6a17435ba8a7f3801957c4b795f6f3f78d9de15d4cc115a7c28d7351b79eee7 all runs: OK # git bisect start c11d28ab4a691736e30b49813fb801847bd44e83 7111951b8d4973bda27ff663f2cf18b663d15b48 Bisecting: 13326 revisions left to test after this (roughly 14 steps) [74cd3984f13381049627cfa260fd87e6fcd31add] media: imx: utils: Split find|enum_format into fourcc and mbus functions testing commit 74cd3984f13381049627cfa260fd87e6fcd31add with gcc (GCC) 8.1.0 kernel signature: 73d1f72d41f9c24dad31460f1ee803cf3b41342690b335fbc2314a0c6153dac5 all runs: OK # git bisect good 74cd3984f13381049627cfa260fd87e6fcd31add Bisecting: 6630 revisions left to test after this (roughly 13 steps) [8bf9e28a25c6bbff58513b8175620e096368ede4] Merge remote-tracking branch 'net-next/master' testing commit 8bf9e28a25c6bbff58513b8175620e096368ede4 with gcc (GCC) 8.1.0 kernel signature: 3240428d3f0eec0ccd1636ff040bdb2f5d36032a383ed2889e9f185a16dfa19e all runs: crashed: KASAN: use-after-free Read in evdev_cleanup # git bisect bad 8bf9e28a25c6bbff58513b8175620e096368ede4 Bisecting: 3347 revisions left to test after this (roughly 12 steps) [e0b0f9fd6d0a1f228f3c09958e25def4865454db] Merge remote-tracking branch 'sh/sh-next' testing commit e0b0f9fd6d0a1f228f3c09958e25def4865454db with gcc (GCC) 8.1.0 kernel signature: a70567dff70f89f132f6068c1bb09c270784c49394e8b46820e733bfad61cea3 all runs: crashed: KASAN: use-after-free Read in evdev_cleanup # git bisect bad e0b0f9fd6d0a1f228f3c09958e25def4865454db Bisecting: 1671 revisions left to test after this (roughly 11 steps) [7e71515c910d8a1ce0a780982f41f921616a97d6] Merge remote-tracking branch 'drm-fixes/drm-fixes' testing commit 7e71515c910d8a1ce0a780982f41f921616a97d6 with gcc (GCC) 8.1.0 kernel signature: 827583d9d05fc8734ed9fc9a8ee121f8cef921e38d6bb993e7f3ec5234ee15d3 all runs: crashed: KASAN: use-after-free Read in evdev_cleanup # git bisect bad 7e71515c910d8a1ce0a780982f41f921616a97d6 Bisecting: 837 revisions left to test after this (roughly 10 steps) [17e34526f0a8f81a214d1ee6f7d8ad2a9c9bae33] mm/vmscan: remove unnecessary argument description of isolate_lru_pages() testing commit 17e34526f0a8f81a214d1ee6f7d8ad2a9c9bae33 with gcc (GCC) 8.1.0 kernel signature: adf923b80eb4b2477e9003f9c7ef5d9344207fe7b8c0a51d9e3f8165d87e44c3 all runs: OK # git bisect good 17e34526f0a8f81a214d1ee6f7d8ad2a9c9bae33 Bisecting: 419 revisions left to test after this (roughly 9 steps) [d69100b8eee27c2d60ee52df76e0b80a8d492d34] net: nlmsg_cancel() if put fails for nhmsg testing commit d69100b8eee27c2d60ee52df76e0b80a8d492d34 with gcc (GCC) 8.1.0 kernel signature: 6e7944ef40470394eed6bee6fedc4d5554fad16fef0f494a55dc3715d1232a27 all runs: OK # git bisect good d69100b8eee27c2d60ee52df76e0b80a8d492d34 Bisecting: 213 revisions left to test after this (roughly 8 steps) [03fb3acae4be8a6b680ffedb220a8b6c07260b40] Merge branch 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux testing commit 03fb3acae4be8a6b680ffedb220a8b6c07260b40 with gcc (GCC) 8.1.0 kernel signature: 3adb51a6eda5ade7b1bd852737b4946cdc9a3da0aca0e3bf0b0dc5d5a4eac6de all runs: OK # git bisect good 03fb3acae4be8a6b680ffedb220a8b6c07260b40 Bisecting: 105 revisions left to test after this (roughly 7 steps) [4aada7791fa2bd3e927502bc67ba604b95bb21bf] Merge remote-tracking branch 'sound-current/for-linus' testing commit 4aada7791fa2bd3e927502bc67ba604b95bb21bf with gcc (GCC) 8.1.0 kernel signature: 6c220338a001e7659f7ea3b92f5ddd188d8f43887a788937a85f7d1150403342 all runs: OK # git bisect good 4aada7791fa2bd3e927502bc67ba604b95bb21bf Bisecting: 53 revisions left to test after this (roughly 6 steps) [078c7b0d185f6c1065afa4e4ac3389beece7d503] Merge remote-tracking branch 'tty.current/tty-linus' testing commit 078c7b0d185f6c1065afa4e4ac3389beece7d503 with gcc (GCC) 8.1.0 kernel signature: 3f8078abdf83fe6cec5fdc70fca8f2617ca9743b55b36d34a7ef5ad6d617f19d all runs: crashed: KASAN: use-after-free Read in evdev_cleanup # git bisect bad 078c7b0d185f6c1065afa4e4ac3389beece7d503 Bisecting: 25 revisions left to test after this (roughly 5 steps) [e881587896db7a10902579c44350a01f7557a6d8] Merge remote-tracking branch 'asoc/for-5.7' into asoc-linus testing commit e881587896db7a10902579c44350a01f7557a6d8 with gcc (GCC) 8.1.0 kernel signature: 66c94c9abf7a14725839f8caef2391c21f443a4a5293c6cdfb8f4d88d7b96ae0 all runs: OK # git bisect good e881587896db7a10902579c44350a01f7557a6d8 Bisecting: 13 revisions left to test after this (roughly 4 steps) [83c813e237b8edf0fe8184ccdf3dc9622202084c] Merge remote-tracking branch 'spi/for-5.7' into spi-linus testing commit 83c813e237b8edf0fe8184ccdf3dc9622202084c with gcc (GCC) 8.1.0 kernel signature: ac504268950dd5a9ae17e27da00b78bf9aa0b819bb66a17e9e804b510fc1b008 all runs: OK # git bisect good 83c813e237b8edf0fe8184ccdf3dc9622202084c Bisecting: 6 revisions left to test after this (roughly 3 steps) [66ac4422fa22def9ce0886d3a032c5c288799c87] Merge remote-tracking branch 'regulator-fixes/for-linus' testing commit 66ac4422fa22def9ce0886d3a032c5c288799c87 with gcc (GCC) 8.1.0 kernel signature: 3fd9ed2041913de200ff7d68c72b3c95df2ad80f62732e2645d9da410c0c469c all runs: OK # git bisect good 66ac4422fa22def9ce0886d3a032c5c288799c87 Bisecting: 3 revisions left to test after this (roughly 2 steps) [4ef12f7198023c09ad6d25b652bd8748c965c7fa] kobject: Make sure the parent does not get released before its children testing commit 4ef12f7198023c09ad6d25b652bd8748c965c7fa with gcc (GCC) 8.1.0 kernel signature: 4e08642f6fc72b97b0ccd055066070083f9e987fbc59cdc3f85d4b54f20bc579 all runs: crashed: KASAN: use-after-free Read in evdev_cleanup # git bisect bad 4ef12f7198023c09ad6d25b652bd8748c965c7fa Bisecting: 0 revisions left to test after this (roughly 1 step) [44e960490ddf868fc9135151c4a658936e771dc2] driver core: Fix handling of SYNC_STATE_ONLY + STATELESS device links testing commit 44e960490ddf868fc9135151c4a658936e771dc2 with gcc (GCC) 8.1.0 kernel signature: 9deff3e16447e966e60bfa4deaeda67265aa7320eddaf3204f9ec9b6fc2b5b0e all runs: OK # git bisect good 44e960490ddf868fc9135151c4a658936e771dc2 4ef12f7198023c09ad6d25b652bd8748c965c7fa is the first bad commit commit 4ef12f7198023c09ad6d25b652bd8748c965c7fa Author: Heikki Krogerus Date: Wed May 13 18:18:40 2020 +0300 kobject: Make sure the parent does not get released before its children In the function kobject_cleanup(), kobject_del(kobj) is called before the kobj->release(). That makes it possible to release the parent of the kobject before the kobject itself. To fix that, adding function __kboject_del() that does everything that kobject_del() does except release the parent reference. kobject_cleanup() then calls __kobject_del() instead of kobject_del(), and separately decrements the reference count of the parent kobject after kobj->release() has been called. Reported-by: Naresh Kamboju Reported-by: kernel test robot Fixes: 7589238a8cf3 ("Revert "software node: Simplify software_node_release() function"") Suggested-by: "Rafael J. Wysocki" Signed-off-by: Heikki Krogerus Reviewed-by: Rafael J. Wysocki Reviewed-by: Brendan Higgins Tested-by: Brendan Higgins Acked-by: Randy Dunlap Link: https://lore.kernel.org/r/20200513151840.36400-1-heikki.krogerus@linux.intel.com Cc: stable Signed-off-by: Greg Kroah-Hartman lib/kobject.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) culprit signature: 4e08642f6fc72b97b0ccd055066070083f9e987fbc59cdc3f85d4b54f20bc579 parent signature: 9deff3e16447e966e60bfa4deaeda67265aa7320eddaf3204f9ec9b6fc2b5b0e revisions tested: 16, total time: 3h38m21.741927141s (build: 1h35m31.958797517s, test: 2h1m41.385139034s) first bad commit: 4ef12f7198023c09ad6d25b652bd8748c965c7fa kobject: Make sure the parent does not get released before its children cc: ["brendanhiggins@google.com" "gregkh@linuxfoundation.org" "heikki.krogerus@linux.intel.com" "rafael.j.wysocki@intel.com" "rdunlap@infradead.org"] crash: KASAN: use-after-free Read in evdev_cleanup ================================================================== BUG: KASAN: use-after-free in __mutex_lock_common kernel/locking/mutex.c:938 [inline] BUG: KASAN: use-after-free in __mutex_lock+0x105d/0x13e0 kernel/locking/mutex.c:1103 Read of size 8 at addr ffff888097e17158 by task syz-executor.1/8443 CPU: 1 PID: 8443 Comm: syz-executor.1 Not tainted 5.7.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x128/0x182 lib/dump_stack.c:118 print_address_description.constprop.8.cold.10+0x9/0x317 mm/kasan/report.c:382 __kasan_report.cold.11+0x35/0x4d mm/kasan/report.c:511 kasan_report+0x32/0x50 mm/kasan/common.c:625 __mutex_lock_common kernel/locking/mutex.c:938 [inline] __mutex_lock+0x105d/0x13e0 kernel/locking/mutex.c:1103 evdev_mark_dead drivers/input/evdev.c:1324 [inline] evdev_cleanup+0x1c/0x170 drivers/input/evdev.c:1333 evdev_disconnect+0x40/0xb0 drivers/input/evdev.c:1418 __input_unregister_device+0x199/0x3f0 drivers/input/input.c:2091 input_unregister_device+0x7f/0xb0 drivers/input/input.c:2273 uinput_destroy_device+0x18a/0x1f0 drivers/input/misc/uinput.c:298 uinput_release+0x32/0x60 drivers/input/misc/uinput.c:710 __fput+0x2a4/0x7a0 fs/file_table.c:280 task_work_run+0xc2/0x160 kernel/task_work.c:123 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x23d/0x2d0 arch/x86/entry/common.c:165 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline] syscall_return_slowpath arch/x86/entry/common.c:279 [inline] do_syscall_64+0x52a/0x620 arch/x86/entry/common.c:305 entry_SYSCALL_64_after_hwframe+0x49/0xb3 RIP: 0033:0x416621 Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01 RSP: 002b:00007ffeb2f891c0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000416621 RDX: 0000001b2c520000 RSI: 0000000000000001 RDI: 0000000000000003 RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000 R10: 00007ffeb2f892b0 R11: 0000000000000293 R12: 0000000000792ac0 R13: 000000000000e181 R14: ffffffffffffffff R15: 000000000078bf0c Allocated by task 8445: save_stack+0x19/0x40 mm/kasan/common.c:49 set_track mm/kasan/common.c:57 [inline] __kasan_kmalloc.constprop.17+0xc1/0xd0 mm/kasan/common.c:495 kmem_cache_alloc_trace+0x156/0x780 mm/slab.c:3551 kmalloc include/linux/slab.h:555 [inline] kzalloc include/linux/slab.h:669 [inline] evdev_connect+0x66/0x430 drivers/input/evdev.c:1362 input_attach_handler+0xfc/0x170 drivers/input/input.c:1031 input_register_device.cold.21+0xb4/0x1ea drivers/input/input.c:2229 uinput_create_device drivers/input/misc/uinput.c:364 [inline] uinput_ioctl_handler.isra.11+0x983/0x1990 drivers/input/misc/uinput.c:870 vfs_ioctl fs/ioctl.c:47 [inline] ksys_ioctl+0xb8/0x110 fs/ioctl.c:771 __do_sys_ioctl fs/ioctl.c:780 [inline] __se_sys_ioctl fs/ioctl.c:778 [inline] __x64_sys_ioctl+0x6a/0xb0 fs/ioctl.c:778 do_syscall_64+0xc6/0x620 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x49/0xb3 Freed by task 8443: save_stack+0x19/0x40 mm/kasan/common.c:49 set_track mm/kasan/common.c:57 [inline] kasan_set_free_info mm/kasan/common.c:317 [inline] __kasan_slab_free+0xf7/0x140 mm/kasan/common.c:456 __cache_free mm/slab.c:3426 [inline] kfree+0x107/0x2b0 mm/slab.c:3757 device_release+0x65/0x1c0 drivers/base/core.c:1394 kobject_cleanup lib/kobject.c:701 [inline] kobject_release lib/kobject.c:732 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x12e/0x230 lib/kobject.c:749 evdev_disconnect+0x38/0xb0 drivers/input/evdev.c:1417 __input_unregister_device+0x199/0x3f0 drivers/input/input.c:2091 input_unregister_device+0x7f/0xb0 drivers/input/input.c:2273 uinput_destroy_device+0x18a/0x1f0 drivers/input/misc/uinput.c:298 uinput_release+0x32/0x60 drivers/input/misc/uinput.c:710 __fput+0x2a4/0x7a0 fs/file_table.c:280 task_work_run+0xc2/0x160 kernel/task_work.c:123 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x23d/0x2d0 arch/x86/entry/common.c:165 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline] syscall_return_slowpath arch/x86/entry/common.c:279 [inline] do_syscall_64+0x52a/0x620 arch/x86/entry/common.c:305 entry_SYSCALL_64_after_hwframe+0x49/0xb3 The buggy address belongs to the object at ffff888097e17000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 344 bytes inside of 2048-byte region [ffff888097e17000, ffff888097e17800) The buggy address belongs to the page: page:ffffea00025f85c0 refcount:1 mapcount:0 mapping:000000003db6c889 index:0x0 flags: 0xfffe0000000200(slab) raw: 00fffe0000000200 ffffea000230c108 ffffea000291b608 ffff8880aa400e00 raw: 0000000000000000 ffff888097e17000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888097e17000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888097e17080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888097e17100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888097e17180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888097e17200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================