[syzbot] [fs?] WARNING: lock held when returning to user space in ns_ioctl

From: syzbot
Date: Wed Jul 17 2024 - 21:31:48 EST


Hello,

syzbot found the following issue on:

HEAD commit: 51835949dda3 Merge tag 'net-next-6.11' of git://git.kernel..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1758d8e6980000
kernel config: https://syzkaller.appspot.com/x/.config?x=a2f87f8b8afcec45
dashboard link: https://syzkaller.appspot.com/bug?extid=dd73570cf9918519e789
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1799ccb5980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15ef5b4e980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/67cb6b0946ba/disk-51835949.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1946faba5973/vmlinux-51835949.xz
kernel image: https://storage.googleapis.com/syzbot-assets/fc2e329875bd/bzImage-51835949.xz

The issue was bisected to:

commit ca567df74a28a9fb368c6b2d93e864113f73f5c2
Author: Christian Brauner <brauner@xxxxxxxxxx>
Date: Sun Jun 7 20:47:08 2020 +0000

nsfs: add pid translation ioctls

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=113c7b2d980000
final oops: https://syzkaller.appspot.com/x/report.txt?x=133c7b2d980000
console output: https://syzkaller.appspot.com/x/log.txt?x=153c7b2d980000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+dd73570cf9918519e789@xxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: ca567df74a28 ("nsfs: add pid translation ioctls")

================================================
WARNING: lock held when returning to user space!
6.10.0-syzkaller-04472-g51835949dda3 #0 Not tainted
------------------------------------------------
syz-executor257/5082 is leaving the kernel with locks still held!
1 lock held by syz-executor257/5082:
#0: ffffffff8e335fe0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:327 [inline]
#0: ffffffff8e335fe0 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:839 [inline]
#0: ffffffff8e335fe0 (rcu_read_lock){....}-{1:2}, at: ns_ioctl+0x3e0/0x740 fs/nsfs.c:184
BUG: sleeping function called from invalid context at include/linux/sched/mm.h:337
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5082, name: syz-executor257
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
INFO: lockdep is turned off.
CPU: 1 PID: 5082 Comm: syz-executor257 Not tainted 6.10.0-syzkaller-04472-g51835949dda3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
__might_resched+0x5d4/0x780 kernel/sched/core.c:8437
might_alloc include/linux/sched/mm.h:337 [inline]
prepare_alloc_pages+0x1c9/0x5d0 mm/page_alloc.c:4454
__alloc_pages_noprof+0x166/0x6c0 mm/page_alloc.c:4672
alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
vma_alloc_folio_noprof+0xf3/0x1f0 mm/mempolicy.c:2304
folio_prealloc+0x31/0x170
wp_page_copy mm/memory.c:3285 [inline]
do_wp_page+0x11cc/0x52f0 mm/memory.c:3677
handle_pte_fault+0x117e/0x7090 mm/memory.c:5397
__handle_mm_fault mm/memory.c:5524 [inline]
handle_mm_fault+0xfb0/0x19d0 mm/memory.c:5689
do_user_addr_fault arch/x86/mm/fault.c:1338 [inline]
handle_page_fault arch/x86/mm/fault.c:1481 [inline]
exc_page_fault+0x459/0x8c0 arch/x86/mm/fault.c:1539
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623
RIP: 0033:0x7f72e4df2de0
Code: 41 54 55 48 89 f5 53 89 fb 48 83 ec 18 48 83 3d 0d 02 0a 00 00 89 54 24 0c 74 08 84 c9 0f 85 09 02 00 00 31 c0 ba 01 00 00 00 <f0> 0f b1 15 e0 2e 0a 00 0f 85 0f 02 00 00 4c 8d 25 d3 2e 0a 00 4c
RSP: 002b:00007ffd9317a820 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 00007f72e4e93110 RDI: 0000000000000000
RBP: 00007f72e4e93110 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 431bde82d7b634db R14: 0000000000000001 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@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

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