lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66edb247.050a0220.3195df.0001.GAE@google.com>
Date: Fri, 20 Sep 2024 10:35:03 -0700
From: syzbot <syzbot+7c48153a9d788824044b@...kaller.appspotmail.com>
To: aha310510@...il.com, linux-kernel@...r.kernel.org, 
	syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [netfs?] KASAN: slab-use-after-free Read in iov_iter_advance

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
BUG: sleeping function called from invalid context in mempool_alloc_noprof

BUG: sleeping function called from invalid context at include/linux/sched/mm.h:337
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 6020, name: syz.0.15
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
2 locks held by syz.0.15/6020:
 #0: ffff888071360500 (&ctx->wb_lock){+.+.}-{3:3}, at: netfs_writepages+0xb8/0xb90 fs/netfs/write_issue.c:509
 #1: ffff888143aea528 (&rreq->lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
 #1: ffff888143aea528 (&rreq->lock){+.+.}-{2:2}, at: netfs_write_folio+0x5a9/0x19b0 fs/netfs/write_issue.c:431
Preemption disabled at:
[<0000000000000000>] 0x0
CPU: 0 UID: 0 PID: 6020 Comm: syz.0.15 Not tainted 6.11.0-syzkaller-07341-gbaeb9a7d8b60-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x16c/0x1f0 lib/dump_stack.c:119
 __might_resched+0x3c0/0x5e0 kernel/sched/core.c:8547
 might_alloc include/linux/sched/mm.h:337 [inline]
 mempool_alloc_noprof+0x1e8/0x390 mm/mempool.c:392
 netfs_alloc_subrequest+0xc1/0x3c0 fs/netfs/objects.c:186
 netfs_prepare_write fs/netfs/write_issue.c:157 [inline]
 netfs_advance_write fs/netfs/write_issue.c:279 [inline]
 netfs_advance_write+0x3b0/0xbd0 fs/netfs/write_issue.c:259
 netfs_write_folio+0xb62/0x19b0 fs/netfs/write_issue.c:471
 netfs_writepages+0x2ba/0xb90 fs/netfs/write_issue.c:544
 do_writepages+0x1a6/0x7f0 mm/page-writeback.c:2683
 filemap_fdatawrite_wbc mm/filemap.c:397 [inline]
 filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:387
 __filemap_fdatawrite_range+0xba/0x100 mm/filemap.c:430
 v9fs_dir_release+0x429/0x590 fs/9p/vfs_dir.c:219
 __fput+0x3f9/0xb60 fs/file_table.c:431
 task_work_run+0x151/0x250 kernel/task_work.c:228
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0x27b/0x2a0 kernel/entry/common.c:218
 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fbfe037def9
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:00007ffc8aec11f8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007fbfe0537a80 RCX: 00007fbfe037def9
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007fbfe0537a80 R08: 0000000000000000 R09: 00007ffc8aec14ef
R10: 000000000003fd88 R11: 0000000000000246 R12: 00000000000239d8
R13: 00007ffc8aec1300 R14: 0000000000000032 R15: ffffffffffffffff
 </TASK>

============================================
WARNING: possible recursive locking detected
6.11.0-syzkaller-07341-gbaeb9a7d8b60-dirty #0 Tainted: G        W         
--------------------------------------------
syz.0.15/6020 is trying to acquire lock:
ffff888143aea528 (&rreq->lock){+.+.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline]
ffff888143aea528 (&rreq->lock){+.+.}-{2:2}, at: netfs_prepare_write fs/netfs/write_issue.c:191 [inline]
ffff888143aea528 (&rreq->lock){+.+.}-{2:2}, at: netfs_advance_write fs/netfs/write_issue.c:279 [inline]
ffff888143aea528 (&rreq->lock){+.+.}-{2:2}, at: netfs_advance_write+0x6c8/0xbd0 fs/netfs/write_issue.c:259

but task is already holding lock:
ffff888143aea528 (&rreq->lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffff888143aea528 (&rreq->lock){+.+.}-{2:2}, at: netfs_write_folio+0x5a9/0x19b0 fs/netfs/write_issue.c:431

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&rreq->lock);
  lock(&rreq->lock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by syz.0.15/6020:
 #0: ffff888071360500 (&ctx->wb_lock){+.+.}-{3:3}, at: netfs_writepages+0xb8/0xb90 fs/netfs/write_issue.c:509
 #1: ffff888143aea528 (&rreq->lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
 #1: ffff888143aea528 (&rreq->lock){+.+.}-{2:2}, at: netfs_write_folio+0x5a9/0x19b0 fs/netfs/write_issue.c:431

stack backtrace:
CPU: 0 UID: 0 PID: 6020 Comm: syz.0.15 Tainted: G        W          6.11.0-syzkaller-07341-gbaeb9a7d8b60-dirty #0
Tainted: [W]=WARN
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119
 print_deadlock_bug+0x2e3/0x410 kernel/locking/lockdep.c:3034
 check_deadlock kernel/locking/lockdep.c:3086 [inline]
 validate_chain kernel/locking/lockdep.c:3888 [inline]
 __lock_acquire+0x2185/0x3ce0 kernel/locking/lockdep.c:5199
 lock_acquire kernel/locking/lockdep.c:5822 [inline]
 lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5787
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
 _raw_spin_lock_bh+0x33/0x40 kernel/locking/spinlock.c:178
 spin_lock_bh include/linux/spinlock.h:356 [inline]
 netfs_prepare_write fs/netfs/write_issue.c:191 [inline]
 netfs_advance_write fs/netfs/write_issue.c:279 [inline]
 netfs_advance_write+0x6c8/0xbd0 fs/netfs/write_issue.c:259
 netfs_write_folio+0xb62/0x19b0 fs/netfs/write_issue.c:471
 netfs_writepages+0x2ba/0xb90 fs/netfs/write_issue.c:544
 do_writepages+0x1a6/0x7f0 mm/page-writeback.c:2683
 filemap_fdatawrite_wbc mm/filemap.c:397 [inline]
 filemap_fdatawrite_wbc+0x148/0x1c0 mm/filemap.c:387
 __filemap_fdatawrite_range+0xba/0x100 mm/filemap.c:430
 v9fs_dir_release+0x429/0x590 fs/9p/vfs_dir.c:219
 __fput+0x3f9/0xb60 fs/file_table.c:431
 task_work_run+0x151/0x250 kernel/task_work.c:228
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0x27b/0x2a0 kernel/entry/common.c:218
 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fbfe037def9
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:00007ffc8aec11f8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007fbfe0537a80 RCX: 00007fbfe037def9
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 00007fbfe0537a80 R08: 0000000000000000 R09: 00007ffc8aec14ef
R10: 000000000003fd88 R11: 0000000000000246 R12: 00000000000239d8
R13: 00007ffc8aec1300 R14: 0000000000000032 R15: ffffffffffffffff
 </TASK>


Tested on:

commit:         baeb9a7d Merge tag 'sched-rt-2024-09-17' of git://git...
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/ master
console output: https://syzkaller.appspot.com/x/log.txt?x=10b0a427980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=5a0a1caedf9d578f
dashboard link: https://syzkaller.appspot.com/bug?extid=7c48153a9d788824044b
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=1499bf00580000


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ