linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [fs?] WARNING: bad unlock balance in query_matching_vma
@ 2025-07-14 21:11 syzbot
  2025-07-15  0:21 ` Hillf Danton
  2025-07-15 10:09 ` syzbot
  0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2025-07-14 21:11 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    a62b7a37e6fc Add linux-next specific files for 20250711
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1422dd82580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=7d42120e19faaef
dashboard link: https://syzkaller.appspot.com/bug?extid=d4316c39e84f412115c9
compiler:       Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1222dd82580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1205d0f0580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/691b5f8ab5b1/disk-a62b7a37.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/47d1a209784d/vmlinux-a62b7a37.xz
kernel image: https://storage.googleapis.com/syzbot-assets/eb70d73c9e55/bzImage-a62b7a37.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d4316c39e84f412115c9@syzkaller.appspotmail.com

=====================================
WARNING: bad unlock balance detected!
6.16.0-rc5-next-20250711-syzkaller #0 Not tainted
-------------------------------------
syz.0.32/6076 is trying to release lock (vm_lock) at:
[<ffffffff825aa9e7>] get_next_vma fs/proc/task_mmu.c:181 [inline]
[<ffffffff825aa9e7>] query_vma_find_by_addr fs/proc/task_mmu.c:512 [inline]
[<ffffffff825aa9e7>] query_matching_vma+0x2f7/0x5c0 fs/proc/task_mmu.c:544
but there are no more locks to release!

other info that might help us debug this:
1 lock held by syz.0.32/6076:
 #0: ffffffff8e53c5a0 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline]
 #0: ffffffff8e53c5a0 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline]
 #0: ffffffff8e53c5a0 (rcu_read_lock){....}-{1:3}, at: query_vma_find_by_addr fs/proc/task_mmu.c:510 [inline]
 #0: ffffffff8e53c5a0 (rcu_read_lock){....}-{1:3}, at: query_matching_vma+0x141/0x5c0 fs/proc/task_mmu.c:544

stack backtrace:
CPU: 1 UID: 0 PID: 6076 Comm: syz.0.32 Not tainted 6.16.0-rc5-next-20250711-syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_unlock_imbalance_bug+0xdc/0xf0 kernel/locking/lockdep.c:5301
 __lock_release kernel/locking/lockdep.c:5540 [inline]
 lock_release+0x269/0x3e0 kernel/locking/lockdep.c:5892
 vma_refcount_put include/linux/mmap_lock.h:141 [inline]
 vma_end_read include/linux/mmap_lock.h:237 [inline]
 unlock_vma+0x70/0x180 fs/proc/task_mmu.c:135
 get_next_vma fs/proc/task_mmu.c:181 [inline]
 query_vma_find_by_addr fs/proc/task_mmu.c:512 [inline]
 query_matching_vma+0x2f7/0x5c0 fs/proc/task_mmu.c:544
 do_procmap_query fs/proc/task_mmu.c:629 [inline]
 procfs_procmap_ioctl+0x3f9/0xd50 fs/proc/task_mmu.c:747
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:598 [inline]
 __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:584
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f667ed8e929
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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f667fb27038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f667efb6080 RCX: 00007f667ed8e929
RDX: 0000200000000180 RSI: 00000000c0686611 RDI: 0000000000000003
RBP: 00007f667ee10b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f667efb6080 R15: 00007fff4a18d328
 </TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [fs?] WARNING: bad unlock balance in query_matching_vma
  2025-07-14 21:11 [syzbot] [fs?] WARNING: bad unlock balance in query_matching_vma syzbot
@ 2025-07-15  0:21 ` Hillf Danton
  2025-07-15  0:49   ` syzbot
  2025-07-15 10:09 ` syzbot
  1 sibling, 1 reply; 5+ messages in thread
From: Hillf Danton @ 2025-07-15  0:21 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, syzkaller-bugs

> Date: Mon, 14 Jul 2025 14:11:36 -0700
> syzbot found the following issue on:
> 
> HEAD commit:    a62b7a37e6fc Add linux-next specific files for 20250711
> git tree:       linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=1422dd82580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=7d42120e19faaef
> dashboard link: https://syzkaller.appspot.com/bug?extid=d4316c39e84f412115c9
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1222dd82580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1205d0f0580000

#syz test

--- x/fs/proc/task_mmu.c
+++ y/fs/proc/task_mmu.c
@@ -585,6 +585,7 @@ no_vma:
 	return ERR_PTR(-ENOENT);
 }
 
+static DEFINE_MUTEX(query_mutex);
 static int do_procmap_query(struct proc_maps_private *priv, void __user *uarg)
 {
 	struct procmap_query karg;
@@ -620,8 +621,10 @@ static int do_procmap_query(struct proc_
 	if (!mm || !mmget_not_zero(mm))
 		return -ESRCH;
 
+	mutex_lock(&query_mutex);
 	err = query_vma_setup(priv);
 	if (err) {
+		mutex_unlock(&query_mutex);
 		mmput(mm);
 		return err;
 	}
@@ -712,6 +715,7 @@ static int do_procmap_query(struct proc_
 
 	/* unlock vma or mmap_lock, and put mm_struct before copying data to user */
 	query_vma_teardown(priv);
+	mutex_unlock(&query_mutex);
 	mmput(mm);
 
 	if (karg.vma_name_size && copy_to_user(u64_to_user_ptr(karg.vma_name_addr),
@@ -732,6 +736,7 @@ static int do_procmap_query(struct proc_
 
 out:
 	query_vma_teardown(priv);
+	mutex_unlock(&query_mutex);
 	mmput(mm);
 	kfree(name_buf);
 	return err;
--

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [fs?] WARNING: bad unlock balance in query_matching_vma
  2025-07-15  0:21 ` Hillf Danton
@ 2025-07-15  0:49   ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2025-07-15  0:49 UTC (permalink / raw)
  To: hdanton, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+d4316c39e84f412115c9@syzkaller.appspotmail.com
Tested-by: syzbot+d4316c39e84f412115c9@syzkaller.appspotmail.com

Tested on:

commit:         0be23810 Add linux-next specific files for 20250714
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=131ffd82580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=be9e2082003f81ff
dashboard link: https://syzkaller.appspot.com/bug?extid=d4316c39e84f412115c9
compiler:       Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
patch:          https://syzkaller.appspot.com/x/patch.diff?x=11c370f0580000

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [fs?] WARNING: bad unlock balance in query_matching_vma
  2025-07-14 21:11 [syzbot] [fs?] WARNING: bad unlock balance in query_matching_vma syzbot
  2025-07-15  0:21 ` Hillf Danton
@ 2025-07-15 10:09 ` syzbot
  2025-07-16  0:08   ` Andrew Morton
  1 sibling, 1 reply; 5+ messages in thread
From: syzbot @ 2025-07-15 10:09 UTC (permalink / raw)
  To: akpm, andrii, david, hdanton, linux-fsdevel, linux-kernel,
	lorenzo.stoakes, surenb, syzkaller-bugs

syzbot has bisected this issue to:

commit fb8a9ee1f05345b1fae37902d32d954d2150437b
Author: Suren Baghdasaryan <surenb@google.com>
Date:   Fri Jul 4 06:07:26 2025 +0000

    fs/proc/task_mmu: execute PROCMAP_QUERY ioctl under per-vma locks

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=171c27d4580000
start commit:   a62b7a37e6fc Add linux-next specific files for 20250711
git tree:       linux-next
final oops:     https://syzkaller.appspot.com/x/report.txt?x=149c27d4580000
console output: https://syzkaller.appspot.com/x/log.txt?x=109c27d4580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=bb4e3ec360fcbd0f
dashboard link: https://syzkaller.appspot.com/bug?extid=d4316c39e84f412115c9
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=14ad50f0580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1173018c580000

Reported-by: syzbot+d4316c39e84f412115c9@syzkaller.appspotmail.com
Fixes: fb8a9ee1f053 ("fs/proc/task_mmu: execute PROCMAP_QUERY ioctl under per-vma locks")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [fs?] WARNING: bad unlock balance in query_matching_vma
  2025-07-15 10:09 ` syzbot
@ 2025-07-16  0:08   ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2025-07-16  0:08 UTC (permalink / raw)
  To: syzbot
  Cc: andrii, david, hdanton, linux-fsdevel, linux-kernel,
	lorenzo.stoakes, surenb, syzkaller-bugs, linux-mm

On Tue, 15 Jul 2025 03:09:02 -0700 syzbot <syzbot+d4316c39e84f412115c9@syzkaller.appspotmail.com> wrote:

> syzbot has bisected this issue to:
> 
> commit fb8a9ee1f05345b1fae37902d32d954d2150437b
> Author: Suren Baghdasaryan <surenb@google.com>
> Date:   Fri Jul 4 06:07:26 2025 +0000
> 
>     fs/proc/task_mmu: execute PROCMAP_QUERY ioctl under per-vma locks
> 
> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=171c27d4580000
> start commit:   a62b7a37e6fc Add linux-next specific files for 20250711
> git tree:       linux-next
> final oops:     https://syzkaller.appspot.com/x/report.txt?x=149c27d4580000
> console output: https://syzkaller.appspot.com/x/log.txt?x=109c27d4580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=bb4e3ec360fcbd0f
> dashboard link: https://syzkaller.appspot.com/bug?extid=d4316c39e84f412115c9
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=14ad50f0580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1173018c580000
> 
> Reported-by: syzbot+d4316c39e84f412115c9@syzkaller.appspotmail.com

Thanks.

This email (and the original bug report) lacked a cc:linux-mm@kvack.org.

> Fixes: fb8a9ee1f053 ("fs/proc/task_mmu: execute PROCMAP_QUERY ioctl under per-vma locks")

Could I suggest that your scripts be altered to parse the fb8a9ee1f053
changelog for its Link:, fetch the submitter's original email and from
that, figure out which mailing list(s) were cc'ed?

> For information about bisection process see: https://goo.gl/tpsmEJ#bisection

Suren, I'll drop the v6 series from mm-new.  Links which I have
accumulated are:

https://lkml.kernel.org/r/6871f94b.a00a0220.26a83e.0070.GAE@google.com
https://lkml.kernel.org/r/f532558b-b19a-40ea-b594-94d1ba92188d@lucifer.local
https://lkml.kernel.org/r/687628be.a00a0220.3af5df.0002.GAE@google.com
https://lkml.kernel.org/r/687628be.a00a0220.3af5df.0002.GAE@google.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-16  0:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-14 21:11 [syzbot] [fs?] WARNING: bad unlock balance in query_matching_vma syzbot
2025-07-15  0:21 ` Hillf Danton
2025-07-15  0:49   ` syzbot
2025-07-15 10:09 ` syzbot
2025-07-16  0:08   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).