bisecting fixing commit since 293837b9ac8d3021657f44c9d7a14948ec01c5d0 building syzkaller on a343ba6b077a3efe7feb57783dcbb7496d2c3572 testing commit 293837b9ac8d3021657f44c9d7a14948ec01c5d0 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 491b60710417bd2db00782a064482fd1feebb673e51012cf7b28de417f2055a0 all runs: crashed: possible deadlock in f_getown testing current HEAD 58e2cf5d794616b84f591d4d1276c8953278ce24 testing commit 58e2cf5d794616b84f591d4d1276c8953278ce24 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 9f7ae314d7acfffbde386553ccf2fe3fea6390232210100fac6b1d789c740766 all runs: OK # git bisect start 58e2cf5d794616b84f591d4d1276c8953278ce24 293837b9ac8d3021657f44c9d7a14948ec01c5d0 Bisecting: 14620 revisions left to test after this (roughly 14 steps) [6e207b882159ed3e35a4cd4ff0fc155cce5e3cbc] Merge tag 'arm-soc-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc testing commit 6e207b882159ed3e35a4cd4ff0fc155cce5e3cbc compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 3ab0c0eb9e3d000ef37dd18cd7345be68307ed2e260443a9bdb0ed933826dc61 run #0: boot failed: kernel panic: VFS: Unable to mount root fs on unknown-block(NUM,NUM) run #1: boot failed: kernel panic: VFS: Unable to mount root fs on unknown-block(NUM,NUM) run #2: boot failed: kernel panic: VFS: Unable to mount root fs on unknown-block(NUM,NUM) run #3: boot failed: BUG: sleeping function called from invalid context in stack_depot_save run #4: boot failed: BUG: sleeping function called from invalid context in stack_depot_save run #5: boot failed: possible deadlock in get_page_from_freelist run #6: boot failed: kernel panic: VFS: Unable to mount root fs on unknown-block(NUM,NUM) run #7: boot failed: kernel panic: VFS: Unable to mount root fs on unknown-block(NUM,NUM) run #8: boot failed: possible deadlock in get_page_from_freelist run #9: boot failed: kernel panic: VFS: Unable to mount root fs on unknown-block(NUM,NUM) # git bisect skip 6e207b882159ed3e35a4cd4ff0fc155cce5e3cbc Bisecting: 14620 revisions left to test after this (roughly 14 steps) [70a9241fbce5398965bf05a595ee892845ae31e9] selftests/bpf: Add dump type data tests to btf dump tests testing commit 70a9241fbce5398965bf05a595ee892845ae31e9 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: c0be5427862d1e0191f7397b5d4be69964e42e1214db3df676bdf973c5005e1e run #0: crashed: possible deadlock in f_getown run #1: crashed: possible deadlock in f_getown run #2: crashed: possible deadlock in f_getown run #3: crashed: possible deadlock in f_getown run #4: crashed: possible deadlock in f_getown run #5: crashed: possible deadlock in f_getown run #6: OK run #7: OK run #8: OK run #9: OK # git bisect good 70a9241fbce5398965bf05a595ee892845ae31e9 Bisecting: 6785 revisions left to test after this (roughly 13 steps) [ea7b4244b3656ca33b19a950f092b5bbc718b40c] x86/setup: Explicitly include acpi.h testing commit ea7b4244b3656ca33b19a950f092b5bbc718b40c compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 59e4d81e70f887920ab0215f278ab1fd330c11e671aa21dedc19c4742815f76a all runs: OK # git bisect bad ea7b4244b3656ca33b19a950f092b5bbc718b40c Bisecting: 3311 revisions left to test after this (roughly 12 steps) [5ab54e5792a44dc7431cef0d57755d3c0aa9740b] Merge branch 'mptcp-Optimize-received-options-handling' testing commit 5ab54e5792a44dc7431cef0d57755d3c0aa9740b compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 5b0e1f9d06ff1c4880f7d9d0ecaf24fd764934012415863469d274c21b6fe83c all runs: crashed: possible deadlock in f_getown # git bisect good 5ab54e5792a44dc7431cef0d57755d3c0aa9740b Bisecting: 1655 revisions left to test after this (roughly 11 steps) [9b2eacd8f04625c6cb2dd82469972a3bba3a783a] Merge tag 'Smack-for-5.15' of git://github.com/cschaufler/smack-next testing commit 9b2eacd8f04625c6cb2dd82469972a3bba3a783a compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: d254f53fb62ffa25d7cb51d54776cb490a3855bba60de6d94e21705a3ecca1c8 all runs: OK # git bisect bad 9b2eacd8f04625c6cb2dd82469972a3bba3a783a Bisecting: 826 revisions left to test after this (roughly 10 steps) [0a096f240aa1992ddac65f8e704f7b0c0795fe1c] Merge tag 'x86-cpu-2021-08-30' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip testing commit 0a096f240aa1992ddac65f8e704f7b0c0795fe1c compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 7ec4cf4e7bd07d548bbefee91a1c5ddf9771795bc5cc783631bf6c0a0f071e6f all runs: OK # git bisect bad 0a096f240aa1992ddac65f8e704f7b0c0795fe1c Bisecting: 399 revisions left to test after this (roughly 9 steps) [44a7d4441181d0f2d622dc9bb512d7f5ca13f768] Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 testing commit 44a7d4441181d0f2d622dc9bb512d7f5ca13f768 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 32da2b5d10360645a19a4761ef2c2672ef200eddffd65b58dbcf2a7f1ee16a68 all runs: OK # git bisect bad 44a7d4441181d0f2d622dc9bb512d7f5ca13f768 Bisecting: 212 revisions left to test after this (roughly 8 steps) [0da9bc6d2fc3f98095d69f34c17f7d5730bbcc6c] Merge tag 'spi-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi testing commit 0da9bc6d2fc3f98095d69f34c17f7d5730bbcc6c compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 0fc8b6bef414a5121eaee3c2bd5871fb38f995edf17f451722f8fc5bed65c02b all runs: crashed: possible deadlock in f_getown # git bisect good 0da9bc6d2fc3f98095d69f34c17f7d5730bbcc6c Bisecting: 84 revisions left to test after this (roughly 7 steps) [4ca4256453effb885c1688633676682529593f82] Merge branch 'core-rcu.2021.08.28a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu testing commit 4ca4256453effb885c1688633676682529593f82 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: ec86ef7302d81f3870c88001acbae9ffc611dcb826051627a36deacbe70b0127 all runs: OK # git bisect bad 4ca4256453effb885c1688633676682529593f82 Bisecting: 62 revisions left to test after this (roughly 6 steps) [6f01c935d96cd4eb8bbbc5249bd9a754b6939e0a] Merge tag 'locks-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux testing commit 6f01c935d96cd4eb8bbbc5249bd9a754b6939e0a compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 8055d4df390b2f473dbe9dd74572f2c68472e662dff557670847e52d5a419d3b all runs: OK # git bisect bad 6f01c935d96cd4eb8bbbc5249bd9a754b6939e0a Bisecting: 30 revisions left to test after this (roughly 5 steps) [ecdf7e7a1d669bc25e13e21b7beb8814f4636bdc] Merge tag 'ib-mt6360-for-5.15-signed' into psy-next testing commit ecdf7e7a1d669bc25e13e21b7beb8814f4636bdc compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 8dabc6c1fe1c6e9a768bd75e2b7dc247a2223b21dd1ce81a0095636d5cdd951a run #0: crashed: possible deadlock in f_getown run #1: crashed: possible deadlock in f_getown run #2: crashed: possible deadlock in f_getown run #3: crashed: possible deadlock in f_getown run #4: crashed: possible deadlock in f_getown run #5: crashed: possible deadlock in f_getown run #6: crashed: possible deadlock in f_getown run #7: OK run #8: OK run #9: OK # git bisect good ecdf7e7a1d669bc25e13e21b7beb8814f4636bdc Bisecting: 14 revisions left to test after this (roughly 4 steps) [4bf00434a6183a33c1fa315db7cc4d4a00a76be0] power: supply: max17042_battery: more robust chip type checks testing commit 4bf00434a6183a33c1fa315db7cc4d4a00a76be0 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: e551d4a25a9868aade0ceb24ecbd56fc2036a3233ae15deb7e63c3babff461bb run #0: basic kernel testing failed: BUG: sleeping function called from invalid context in stack_depot_save run #1: crashed: possible deadlock in f_getown run #2: crashed: possible deadlock in f_getown run #3: crashed: possible deadlock in f_getown run #4: OK run #5: OK run #6: OK run #7: OK run #8: OK run #9: OK reproducer seems to be flaky # git bisect good 4bf00434a6183a33c1fa315db7cc4d4a00a76be0 Bisecting: 8 revisions left to test after this (roughly 3 steps) [f985911b7bc75d5c98ed24d8aaa8b94c590f7c6a] crypto: public_key: fix overflow during implicit conversion testing commit f985911b7bc75d5c98ed24d8aaa8b94c590f7c6a compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 2f96daa72b4b2cf4fef7fab5473ff7652a943662d5d819058be9619cbe0e8ce4 all runs: crashed: possible deadlock in f_getown # git bisect good f985911b7bc75d5c98ed24d8aaa8b94c590f7c6a Bisecting: 4 revisions left to test after this (roughly 2 steps) [2949e8427af3bb74a1e26354cb68c1700663c827] fs: clean up after mandatory file locking support removal testing commit 2949e8427af3bb74a1e26354cb68c1700663c827 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 261208417a3d697300bd00f3a92c4872b4b01b92b6bcd6b782f6e56ba12ed1b8 all runs: OK # git bisect bad 2949e8427af3bb74a1e26354cb68c1700663c827 Bisecting: 1 revision left to test after this (roughly 1 step) [2f488f698fda820f8e6fa0407630154eceb145d6] fcntl: fix potential deadlock for &fasync_struct.fa_lock testing commit 2f488f698fda820f8e6fa0407630154eceb145d6 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 59bec3f08a1dfb7b9aeb28c5a2772b31c0ac8ee104053a6be1c52e4d185e5444 all runs: OK # git bisect bad 2f488f698fda820f8e6fa0407630154eceb145d6 Bisecting: 0 revisions left to test after this (roughly 0 steps) [f671a691e299f58835d4660d642582bf0e8f6fda] fcntl: fix potential deadlocks for &fown_struct.lock testing commit f671a691e299f58835d4660d642582bf0e8f6fda compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: b8f896f263eea0c56e02e88ad38f3ef6a1929327ea4ed1327b249a9a22246f17 all runs: OK # git bisect bad f671a691e299f58835d4660d642582bf0e8f6fda f671a691e299f58835d4660d642582bf0e8f6fda is the first bad commit commit f671a691e299f58835d4660d642582bf0e8f6fda Author: Desmond Cheong Zhi Xi Date: Fri Jul 2 17:18:30 2021 +0800 fcntl: fix potential deadlocks for &fown_struct.lock Syzbot reports a potential deadlock in do_fcntl: ======================================================== WARNING: possible irq lock inversion dependency detected 5.12.0-syzkaller #0 Not tainted -------------------------------------------------------- syz-executor132/8391 just changed the state of lock: ffff888015967bf8 (&f->f_owner.lock){.+..}-{2:2}, at: f_getown_ex fs/fcntl.c:211 [inline] ffff888015967bf8 (&f->f_owner.lock){.+..}-{2:2}, at: do_fcntl+0x8b4/0x1200 fs/fcntl.c:395 but this lock was taken by another, HARDIRQ-safe lock in the past: (&dev->event_lock){-...}-{2:2} and interrupts could create inverse lock ordering between them. other info that might help us debug this: Chain exists of: &dev->event_lock --> &new->fa_lock --> &f->f_owner.lock Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&f->f_owner.lock); local_irq_disable(); lock(&dev->event_lock); lock(&new->fa_lock); lock(&dev->event_lock); *** DEADLOCK *** This happens because there is a lock hierarchy of &dev->event_lock --> &new->fa_lock --> &f->f_owner.lock from the following call chain: input_inject_event(): spin_lock_irqsave(&dev->event_lock,...); input_handle_event(): input_pass_values(): input_to_handler(): evdev_events(): evdev_pass_values(): spin_lock(&client->buffer_lock); __pass_event(): kill_fasync(): kill_fasync_rcu(): read_lock(&fa->fa_lock); send_sigio(): read_lock_irqsave(&fown->lock,...); However, since &dev->event_lock is HARDIRQ-safe, interrupts have to be disabled while grabbing &f->f_owner.lock, otherwise we invert the lock hierarchy. Hence, we replace calls to read_lock/read_unlock on &f->f_owner.lock, with read_lock_irq/read_unlock_irq. Reported-and-tested-by: syzbot+e6d5398a02c516ce5e70@syzkaller.appspotmail.com Signed-off-by: Desmond Cheong Zhi Xi Signed-off-by: Jeff Layton fs/fcntl.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) parent commit 9ff50bf2f2ff5fab01cac26d8eed21a89308e6ef wasn't tested testing commit 9ff50bf2f2ff5fab01cac26d8eed21a89308e6ef compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 87047c9c5c59f69ff395b9666264906e2b5decbda1f900dc3600a392734c68b7 culprit signature: b8f896f263eea0c56e02e88ad38f3ef6a1929327ea4ed1327b249a9a22246f17 parent signature: 87047c9c5c59f69ff395b9666264906e2b5decbda1f900dc3600a392734c68b7 Reproducer flagged being flaky revisions tested: 18, total time: 4h28m56.15654634s (build: 2h5m7.172145458s, test: 2h21m59.957188228s) first good commit: f671a691e299f58835d4660d642582bf0e8f6fda fcntl: fix potential deadlocks for &fown_struct.lock recipients (to): ["desmondcheongzx@gmail.com" "jlayton@kernel.org" "syzbot+e6d5398a02c516ce5e70@syzkaller.appspotmail.com"] recipients (cc): []