linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [fs?] WARNING in copy_mnt_ns
@ 2025-10-01 20:18 syzbot
  2025-10-02  8:06 ` syzbot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: syzbot @ 2025-10-01 20:18 UTC (permalink / raw)
  To: brauner, jack, linux-fsdevel, linux-kernel, syzkaller-bugs, viro

Hello,

syzbot found the following issue on:

HEAD commit:    50c19e20ed2e Merge tag 'nolibc-20250928-for-6.18-1' of git..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=126f605b980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8f1ac8502efee0ee
dashboard link: https://syzkaller.appspot.com/bug?extid=e0f8855a87443d6a2413
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1374b858580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15602092580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5fb1f87b20e9/disk-50c19e20.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/aebfd0341e80/vmlinux-50c19e20.xz
kernel image: https://storage.googleapis.com/syzbot-assets/11452a5eed6c/bzImage-50c19e20.xz

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

------------[ cut here ]------------
ida_free called for id=1019 which is not allocated.
WARNING: CPU: 1 PID: 6112 at lib/idr.c:592 ida_free+0x280/0x310 lib/idr.c:592
Modules linked in:
CPU: 1 UID: 0 PID: 6112 Comm: syz.4.41 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
RIP: 0010:ida_free+0x280/0x310 lib/idr.c:592
Code: 00 00 00 00 fc ff df 48 8b 5c 24 10 48 8b 7c 24 40 48 89 de e8 71 2c 0c 00 90 48 c7 c7 a0 7b 76 8c 44 89 fe e8 41 11 54 f6 90 <0f> 0b 90 90 eb 34 e8 85 a2 90 f6 49 bd 00 00 00 00 00 fc ff df eb
RSP: 0018:ffffc90003087b60 EFLAGS: 00010246

RAX: d54b8a9e76833a00 RBX: 0000000000000a02 RCX: ffff888026663c80
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000002
RBP: ffffc90003087c60 R08: ffff8880b8924293 R09: 1ffff11017124852
R10: dffffc0000000000 R11: ffffed1017124853 R12: 1ffff92000610f70
R13: dffffc0000000000 R14: ffff88801d6d9000 R15: 00000000000003fb
FS:  000055558bcc4500(0000) GS:ffff888126473000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007feaa252acf0 CR3: 000000005ee84000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 copy_mnt_ns+0x197/0x820 fs/namespace.c:4168
 create_new_namespaces+0xd1/0x720 kernel/nsproxy.c:78
 unshare_nsproxy_namespaces+0x11c/0x170 kernel/nsproxy.c:218
 ksys_unshare+0x4c8/0x8c0 kernel/fork.c:3132
 __do_sys_unshare kernel/fork.c:3203 [inline]
 __se_sys_unshare kernel/fork.c:3201 [inline]
 __x64_sys_unshare+0x38/0x50 kernel/fork.c:3201
 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:0x7feaa258eec9
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:00007ffd780455e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000110
RAX: ffffffffffffffda RBX: 00007feaa27e5fa0 RCX: 00007feaa258eec9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000002a020400
RBP: 00007ffd78045640 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002
R13: 00007feaa27e5fa0 R14: 00007feaa27e5fa0 R15: 0000000000000001
 </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] 6+ messages in thread

* Re: [syzbot] [fs?] WARNING in copy_mnt_ns
  2025-10-01 20:18 [syzbot] [fs?] WARNING in copy_mnt_ns syzbot
@ 2025-10-02  8:06 ` syzbot
  2025-10-02  8:19 ` Jan Kara
  2025-10-02  8:57 ` Jan Kara
  2 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2025-10-02  8:06 UTC (permalink / raw)
  To: akpm, anna-maria, anna.schumaker, bodonnel, brauner, cgroups,
	cyphar, davem, edumazet, frederic, hannes, horms, jack, jlayton,
	joel.granados, kuba, kuniyu, linux-fsdevel, linux-kernel,
	mawupeng1, mkoutny, netdev, pabeni, rostedt, sd, syzkaller-bugs,
	tglx, tj, viro

syzbot has bisected this issue to:

commit be5f21d3985f00827e09b798f7a07ebd6dd7f54a
Author: Christian Brauner <brauner@kernel.org>
Date:   Wed Sep 17 10:28:08 2025 +0000

    ns: add ns_common_free()

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=135eeee2580000
start commit:   50c19e20ed2e Merge tag 'nolibc-20250928-for-6.18-1' of git..
git tree:       upstream
final oops:     https://syzkaller.appspot.com/x/report.txt?x=10deeee2580000
console output: https://syzkaller.appspot.com/x/log.txt?x=175eeee2580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=8f1ac8502efee0ee
dashboard link: https://syzkaller.appspot.com/bug?extid=e0f8855a87443d6a2413
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1374b858580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15602092580000

Reported-by: syzbot+e0f8855a87443d6a2413@syzkaller.appspotmail.com
Fixes: be5f21d3985f ("ns: add ns_common_free()")

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

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

* Re: [syzbot] [fs?] WARNING in copy_mnt_ns
  2025-10-01 20:18 [syzbot] [fs?] WARNING in copy_mnt_ns syzbot
  2025-10-02  8:06 ` syzbot
@ 2025-10-02  8:19 ` Jan Kara
  2025-10-02  8:33   ` syzbot
  2025-10-02  8:57 ` Jan Kara
  2 siblings, 1 reply; 6+ messages in thread
From: Jan Kara @ 2025-10-02  8:19 UTC (permalink / raw)
  To: syzbot; +Cc: brauner, jack, linux-fsdevel, linux-kernel, syzkaller-bugs, viro

[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]

On Wed 01-10-25 13:18:33, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    50c19e20ed2e Merge tag 'nolibc-20250928-for-6.18-1' of git..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=126f605b980000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=8f1ac8502efee0ee
> dashboard link: https://syzkaller.appspot.com/bug?extid=e0f8855a87443d6a2413
> compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1374b858580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15602092580000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/5fb1f87b20e9/disk-50c19e20.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/aebfd0341e80/vmlinux-50c19e20.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/11452a5eed6c/bzImage-50c19e20.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+e0f8855a87443d6a2413@syzkaller.appspotmail.com
> 
> ------------[ cut here ]------------
> ida_free called for id=1019 which is not allocated.

Please try attached patch:

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

[-- Attachment #2: 0001-ns-Fix-mnt-ns-ida-handling-in-copy_mnt_ns.patch --]
[-- Type: text/x-patch, Size: 1038 bytes --]

From 5cbdc1dd457f85fdbaa8f5840feeffee41f9aaae Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Thu, 2 Oct 2025 10:15:06 +0200
Subject: [PATCH] ns: Fix mnt ns ida handling in copy_mnt_ns()

Commit be5f21d3985f ("ns: add ns_common_free()") modified error cleanup
and started to free wrong inode number from the ida. Fix it.

Reported-by: syzbot+e0f8855a87443d6a2413@syzkaller.appspotmail.com
Fixes: be5f21d3985f ("ns: add ns_common_free()")
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index dc01b14c58cd..1ba97d745019 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -4165,7 +4165,7 @@ struct mnt_namespace *copy_mnt_ns(u64 flags, struct mnt_namespace *ns,
 	new = copy_tree(old, old->mnt.mnt_root, copy_flags);
 	if (IS_ERR(new)) {
 		namespace_unlock();
-		ns_common_free(ns);
+		ns_common_free(new_ns);
 		dec_mnt_namespaces(new_ns->ucounts);
 		mnt_ns_release(new_ns);
 		return ERR_CAST(new);
-- 
2.51.0


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

* Re: [syzbot] [fs?] WARNING in copy_mnt_ns
  2025-10-02  8:19 ` Jan Kara
@ 2025-10-02  8:33   ` syzbot
  0 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2025-10-02  8:33 UTC (permalink / raw)
  To: brauner, jack, linux-fsdevel, linux-kernel, syzkaller-bugs, viro

Hello,

syzbot tried to test the proposed patch but the build/boot failed:

failed to checkout kernel repo git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/Honza: failed to run ["git" "fetch" "--force" "f569e972c8e9057ee9c286220c83a480ebf30cc5" "Honza"]: exit status 128
fatal: couldn't find remote ref Honza



Tested on:

commit:         [unknown 
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Honza
kernel config:  https://syzkaller.appspot.com/x/.config?x=8f1ac8502efee0ee
dashboard link: https://syzkaller.appspot.com/bug?extid=e0f8855a87443d6a2413
compiler:       
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1411285b980000


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

* Re: [syzbot] [fs?] WARNING in copy_mnt_ns
  2025-10-01 20:18 [syzbot] [fs?] WARNING in copy_mnt_ns syzbot
  2025-10-02  8:06 ` syzbot
  2025-10-02  8:19 ` Jan Kara
@ 2025-10-02  8:57 ` Jan Kara
  2025-10-02 14:36   ` syzbot
  2 siblings, 1 reply; 6+ messages in thread
From: Jan Kara @ 2025-10-02  8:57 UTC (permalink / raw)
  To: syzbot; +Cc: brauner, jack, linux-fsdevel, linux-kernel, syzkaller-bugs, viro

[-- Attachment #1: Type: text/plain, Size: 1448 bytes --]

On Wed 01-10-25 13:18:33, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    50c19e20ed2e Merge tag 'nolibc-20250928-for-6.18-1' of git..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=126f605b980000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=8f1ac8502efee0ee
> dashboard link: https://syzkaller.appspot.com/bug?extid=e0f8855a87443d6a2413
> compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1374b858580000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=15602092580000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/5fb1f87b20e9/disk-50c19e20.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/aebfd0341e80/vmlinux-50c19e20.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/11452a5eed6c/bzImage-50c19e20.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+e0f8855a87443d6a2413@syzkaller.appspotmail.com
> 
> ------------[ cut here ]------------
> ida_free called for id=1019 which is not allocated.

Let's try second time: Please try attached patch:

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

[-- Attachment #2: 0001-ns-Fix-mnt-ns-ida-handling-in-copy_mnt_ns.patch --]
[-- Type: text/x-patch, Size: 1038 bytes --]

From 5cbdc1dd457f85fdbaa8f5840feeffee41f9aaae Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Thu, 2 Oct 2025 10:15:06 +0200
Subject: [PATCH] ns: Fix mnt ns ida handling in copy_mnt_ns()

Commit be5f21d3985f ("ns: add ns_common_free()") modified error cleanup
and started to free wrong inode number from the ida. Fix it.

Reported-by: syzbot+e0f8855a87443d6a2413@syzkaller.appspotmail.com
Fixes: be5f21d3985f ("ns: add ns_common_free()")
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index dc01b14c58cd..1ba97d745019 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -4165,7 +4165,7 @@ struct mnt_namespace *copy_mnt_ns(u64 flags, struct mnt_namespace *ns,
 	new = copy_tree(old, old->mnt.mnt_root, copy_flags);
 	if (IS_ERR(new)) {
 		namespace_unlock();
-		ns_common_free(ns);
+		ns_common_free(new_ns);
 		dec_mnt_namespaces(new_ns->ucounts);
 		mnt_ns_release(new_ns);
 		return ERR_CAST(new);
-- 
2.51.0


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

* Re: [syzbot] [fs?] WARNING in copy_mnt_ns
  2025-10-02  8:57 ` Jan Kara
@ 2025-10-02 14:36   ` syzbot
  0 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2025-10-02 14:36 UTC (permalink / raw)
  To: brauner, jack, linux-fsdevel, linux-kernel, syzkaller-bugs, viro

Hello,

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

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

Tested on:

commit:         7f707257 Merge tag 'kbuild-6.18-1' of git://git.kernel..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1190c92f980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=f9d13d0fd373120a
dashboard link: https://syzkaller.appspot.com/bug?extid=e0f8855a87443d6a2413
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1137e092580000

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

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

end of thread, other threads:[~2025-10-02 14:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-01 20:18 [syzbot] [fs?] WARNING in copy_mnt_ns syzbot
2025-10-02  8:06 ` syzbot
2025-10-02  8:19 ` Jan Kara
2025-10-02  8:33   ` syzbot
2025-10-02  8:57 ` Jan Kara
2025-10-02 14:36   ` syzbot

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).