public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [reiserfs?] general protection fault in __fget_files (2)
@ 2024-01-01  9:54 syzbot
  2024-01-05 13:14 ` Edward Adam Davis
  2024-02-15  5:14 ` syzbot
  0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2024-01-01  9:54 UTC (permalink / raw)
  To: brauner, chouhan.shreyansh630, jack, jeffm, linux-fsdevel,
	linux-kernel, reiserfs-devel, rkovhaev, syzkaller-bugs, tglx,
	viro

Hello,

syzbot found the following issue on:

HEAD commit:    f5837722ffec Merge tag 'mm-hotfixes-stable-2023-12-27-15-0..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17ad7616e80000
kernel config:  https://syzkaller.appspot.com/x/.config?x=da1c95d4e55dda83
dashboard link: https://syzkaller.appspot.com/bug?extid=63cebbb27f598a7f901b
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1230c7e9e80000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=133d189ae80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/bb9a47cfe092/disk-f5837722.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3e6428b5b55b/vmlinux-f5837722.xz
kernel image: https://storage.googleapis.com/syzbot-assets/545d22abacbc/bzImage-f5837722.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/bb1e27bc000d/mount_0.gz

The issue was bisected to:

commit 13d257503c0930010ef9eed78b689cec417ab741
Author: Shreyansh Chouhan <chouhan.shreyansh630@gmail.com>
Date:   Fri Jul 9 15:29:29 2021 +0000

    reiserfs: check directory items on read from disk

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=125e92f9e80000
final oops:     https://syzkaller.appspot.com/x/report.txt?x=115e92f9e80000
console output: https://syzkaller.appspot.com/x/log.txt?x=165e92f9e80000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+63cebbb27f598a7f901b@syzkaller.appspotmail.com
Fixes: 13d257503c09 ("reiserfs: check directory items on read from disk")

general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 0 PID: 5053 Comm: sshd Not tainted 6.7.0-rc7-syzkaller-00016-gf5837722ffec #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
RIP: 0010:__fget_files_rcu fs/file.c:963 [inline]
RIP: 0010:__fget_files+0x96/0x340 fs/file.c:1022
Code: 89 f8 48 c1 e8 03 4c 01 f0 48 89 04 24 e8 62 86 92 ff 48 8b 04 24 80 38 00 0f 85 7f 02 00 00 4d 8b 65 58 4c 89 e0 48 c1 e8 03 <42> 0f b6 04 30 84 c0 74 08 3c 03 0f 8e 70 02 00 00 41 8b 1c 24 89
RSP: 0018:ffffc9000331f8a0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff81f3df8d
RDX: ffff88802a5e2180 RSI: ffffffff81f3de1e RDI: 0000000000000001
RBP: 0000000000000004 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88807300f040 R14: dffffc0000000000 R15: ffff88807300f098
FS:  00007f9d8d382800(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005592de0c8df8 CR3: 000000001f753000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __fget fs/file.c:1030 [inline]
 __fget_light+0xd0/0x260 fs/file.c:1137
 fdget include/linux/file.h:64 [inline]
 do_pollfd fs/select.c:866 [inline]
 do_poll fs/select.c:921 [inline]
 do_sys_poll+0x469/0xde0 fs/select.c:1015
 __do_sys_ppoll fs/select.c:1121 [inline]
 __se_sys_ppoll fs/select.c:1101 [inline]
 __x64_sys_ppoll+0x256/0x2d0 fs/select.c:1101
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f9d8cf19ad5
Code: 85 d2 74 0d 0f 10 02 48 8d 54 24 20 0f 11 44 24 20 64 8b 04 25 18 00 00 00 85 c0 75 27 41 b8 08 00 00 00 b8 0f 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 75 48 8b 15 24 73 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007ffeaa4272d0 EFLAGS: 00000246 ORIG_RAX: 000000000000010f
RAX: ffffffffffffffda RBX: 00000000000668a0 RCX: 00007f9d8cf19ad5
RDX: 00007ffeaa4272f0 RSI: 0000000000000004 RDI: 000055c03123eaa0
RBP: 000055c03123f260 R08: 0000000000000008 R09: 0000000000000000
R10: 00007ffeaa4273d8 R11: 0000000000000246 R12: 000055c02f66caa4
R13: 0000000000000001 R14: 000055c02f66d3e8 R15: 00007ffeaa427358
 </TASK>
Modules linked in:
----------------
Code disassembly (best guess):
   0:	89 f8                	mov    %edi,%eax
   2:	48 c1 e8 03          	shr    $0x3,%rax
   6:	4c 01 f0             	add    %r14,%rax
   9:	48 89 04 24          	mov    %rax,(%rsp)
   d:	e8 62 86 92 ff       	call   0xff928674
  12:	48 8b 04 24          	mov    (%rsp),%rax
  16:	80 38 00             	cmpb   $0x0,(%rax)
  19:	0f 85 7f 02 00 00    	jne    0x29e
  1f:	4d 8b 65 58          	mov    0x58(%r13),%r12
  23:	4c 89 e0             	mov    %r12,%rax
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	42 0f b6 04 30       	movzbl (%rax,%r14,1),%eax <-- trapping instruction
  2f:	84 c0                	test   %al,%al
  31:	74 08                	je     0x3b
  33:	3c 03                	cmp    $0x3,%al
  35:	0f 8e 70 02 00 00    	jle    0x2ab
  3b:	41 8b 1c 24          	mov    (%r12),%ebx
  3f:	89                   	.byte 0x89


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

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

* Re: [syzbot] [reiserfs?] general protection fault in __fget_files (2)
  2024-01-01  9:54 [syzbot] [reiserfs?] general protection fault in __fget_files (2) syzbot
@ 2024-01-05 13:14 ` Edward Adam Davis
  2024-01-05 13:49   ` syzbot
  2024-02-15  5:14 ` syzbot
  1 sibling, 1 reply; 5+ messages in thread
From: Edward Adam Davis @ 2024-01-05 13:14 UTC (permalink / raw)
  To: syzbot+63cebbb27f598a7f901b; +Cc: linux-kernel, syzkaller-bugs

please test general protection fault in __fget_files

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

diff --git a/fs/file.c b/fs/file.c
index 5fb0b146e79e..724f60e6cc4f 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -1134,6 +1134,8 @@ static unsigned long __fget_light(unsigned int fd, fmode_t mask)
 			return 0;
 		return (unsigned long)file;
 	} else {
+		if (!atomic_read_acquire(&files->count))
+			return 0;
 		file = __fget(fd, mask);
 		if (!file)
 			return 0;


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

* Re: [syzbot] [reiserfs?] general protection fault in __fget_files (2)
  2024-01-05 13:14 ` Edward Adam Davis
@ 2024-01-05 13:49   ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2024-01-05 13:49 UTC (permalink / raw)
  To: eadavis, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
INFO: trying to register non-static key in psi_account_irqtime

INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 1 PID: 5487 Comm: syz-executor.0 Not tainted 6.7.0-rc7-syzkaller-00016-gf5837722ffec-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 assign_lock_key kernel/locking/lockdep.c:976 [inline]
 register_lock_class+0xc1e/0x1220 kernel/locking/lockdep.c:1289
 __lock_acquire+0x112/0x3b20 kernel/locking/lockdep.c:5014
 lock_acquire kernel/locking/lockdep.c:5754 [inline]
 lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719
 do_write_seqcount_begin_nested include/linux/seqlock.h:525 [inline]
 do_write_seqcount_begin include/linux/seqlock.h:551 [inline]
 psi_account_irqtime+0x29f/0x510 kernel/sched/psi.c:1016
 update_rq_clock_task kernel/sched/core.c:725 [inline]
 update_rq_clock kernel/sched/core.c:769 [inline]
 update_rq_clock+0x24c/0xb30 kernel/sched/core.c:750
 scheduler_tick+0xee/0x650 kernel/sched/core.c:5648
 update_process_times+0x19f/0x220 kernel/time/timer.c:2076
 tick_sched_handle+0x8e/0x170 kernel/time/tick-sched.c:255
 tick_nohz_highres_handler+0xe9/0x110 kernel/time/tick-sched.c:1516
 __run_hrtimer kernel/time/hrtimer.c:1688 [inline]
 __hrtimer_run_queues+0x647/0xc20 kernel/time/hrtimer.c:1752
 hrtimer_interrupt+0x31b/0x800 kernel/time/hrtimer.c:1814
 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1065 [inline]
 __sysvec_apic_timer_interrupt+0x105/0x400 arch/x86/kernel/apic/apic.c:1082
 sysvec_apic_timer_interrupt+0x90/0xb0 arch/x86/kernel/apic/apic.c:1076
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649
RIP: 0010:memmove+0x28/0x1b0 arch/x86/lib/memmove_64.S:44
Code: c3 90 f3 0f 1e fa 48 89 f8 48 39 fe 7d 0f 49 89 f0 49 01 d0 49 39 f8 0f 8f b5 00 00 00 48 83 fa 20 0f 82 01 01 00 00 48 89 d1 <f3> a4 c3 48 81 fa a8 02 00 00 72 05 40 38 fe 74 47 48 83 ea 20 48
RSP: 0018:ffffc9000382ef40 EFLAGS: 00010286

RAX: ffff8880653d3030 RBX: 0000000000000030 RCX: fffffffffccb761b
RDX: fffffffffffffec9 RSI: ffff88806871c8ae RDI: ffff88806871b8de
RBP: dffffc0000000000 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000008 R11: 00000fe800000001 R12: 0000000000000001
R13: ffffc9000382f120 R14: ffff8880653d30d8 R15: 0000000000000fd0
 leaf_paste_in_buffer+0x26c/0xb80 fs/reiserfs/lbalance.c:1017
 balance_leaf_new_nodes_paste_whole fs/reiserfs/do_balan.c:1171 [inline]
 balance_leaf_new_nodes_paste fs/reiserfs/do_balan.c:1215 [inline]
 balance_leaf_new_nodes fs/reiserfs/do_balan.c:1246 [inline]
 balance_leaf+0x3d2e/0xcda0 fs/reiserfs/do_balan.c:1450
 do_balance+0x337/0x840 fs/reiserfs/do_balan.c:1888
 reiserfs_paste_into_item+0x62b/0x7c0 fs/reiserfs/stree.c:2158
 reiserfs_get_block+0x117f/0x4570 fs/reiserfs/inode.c:1069
 __block_write_begin_int+0x3c0/0x1560 fs/buffer.c:2119
 reiserfs_write_begin+0x350/0x7d0 fs/reiserfs/inode.c:2767
 generic_cont_expand_simple+0x11f/0x200 fs/buffer.c:2473
 reiserfs_setattr+0x36d/0x12a0 fs/reiserfs/inode.c:3298
 notify_change+0x742/0x11c0 fs/attr.c:499
 do_truncate+0x15c/0x220 fs/open.c:66
 do_sys_ftruncate+0x6a2/0x790 fs/open.c:194
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b
RIP: 0033:0x7f580747cce9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f580826a0c8 EFLAGS: 00000246
 ORIG_RAX: 000000000000004d
RAX: ffffffffffffffda RBX: 00007f580759bf80 RCX: 00007f580747cce9
RDX: 0000000000000000 RSI: 0000000002007fff RDI: 0000000000000005
RBP: 00007f58074c947a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f580759bf80 R15: 00007fffc7bc8578
 </TASK>
----------------
Code disassembly (best guess):
   0:	c3                   	ret
   1:	90                   	nop
   2:	f3 0f 1e fa          	endbr64
   6:	48 89 f8             	mov    %rdi,%rax
   9:	48 39 fe             	cmp    %rdi,%rsi
   c:	7d 0f                	jge    0x1d
   e:	49 89 f0             	mov    %rsi,%r8
  11:	49 01 d0             	add    %rdx,%r8
  14:	49 39 f8             	cmp    %rdi,%r8
  17:	0f 8f b5 00 00 00    	jg     0xd2
  1d:	48 83 fa 20          	cmp    $0x20,%rdx
  21:	0f 82 01 01 00 00    	jb     0x128
  27:	48 89 d1             	mov    %rdx,%rcx
* 2a:	f3 a4                	rep movsb %ds:(%rsi),%es:(%rdi) <-- trapping instruction
  2c:	c3                   	ret
  2d:	48 81 fa a8 02 00 00 	cmp    $0x2a8,%rdx
  34:	72 05                	jb     0x3b
  36:	40 38 fe             	cmp    %dil,%sil
  39:	74 47                	je     0x82
  3b:	48 83 ea 20          	sub    $0x20,%rdx
  3f:	48                   	rex.W


Tested on:

commit:         f5837722 Merge tag 'mm-hotfixes-stable-2023-12-27-15-0..
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=135b91c9e80000
kernel config:  https://syzkaller.appspot.com/x/.config?x=da1c95d4e55dda83
dashboard link: https://syzkaller.appspot.com/bug?extid=63cebbb27f598a7f901b
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=11972409e80000


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

* Re: [syzbot] [reiserfs?] general protection fault in __fget_files (2)
  2024-01-01  9:54 [syzbot] [reiserfs?] general protection fault in __fget_files (2) syzbot
  2024-01-05 13:14 ` Edward Adam Davis
@ 2024-02-15  5:14 ` syzbot
  2024-02-15  9:30   ` Jan Kara
  1 sibling, 1 reply; 5+ messages in thread
From: syzbot @ 2024-02-15  5:14 UTC (permalink / raw)
  To: axboe, brauner, chouhan.shreyansh630, eadavis, jack, jeffm,
	linux-fsdevel, linux-kernel, reiserfs-devel, rkovhaev,
	syzkaller-bugs, tglx, viro

syzbot suspects this issue was fixed by commit:

commit 6f861765464f43a71462d52026fbddfc858239a5
Author: Jan Kara <jack@suse.cz>
Date:   Wed Nov 1 17:43:10 2023 +0000

    fs: Block writes to mounted block devices

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=16fbb3dc180000
start commit:   f5837722ffec Merge tag 'mm-hotfixes-stable-2023-12-27-15-0..
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=da1c95d4e55dda83
dashboard link: https://syzkaller.appspot.com/bug?extid=63cebbb27f598a7f901b
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1230c7e9e80000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=133d189ae80000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: fs: Block writes to mounted block devices

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

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

* Re: [syzbot] [reiserfs?] general protection fault in __fget_files (2)
  2024-02-15  5:14 ` syzbot
@ 2024-02-15  9:30   ` Jan Kara
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2024-02-15  9:30 UTC (permalink / raw)
  To: syzbot
  Cc: axboe, brauner, chouhan.shreyansh630, eadavis, jack, jeffm,
	linux-fsdevel, linux-kernel, reiserfs-devel, rkovhaev,
	syzkaller-bugs, tglx, viro

On Wed 14-02-24 21:14:05, syzbot wrote:
> syzbot suspects this issue was fixed by commit:
> 
> commit 6f861765464f43a71462d52026fbddfc858239a5
> Author: Jan Kara <jack@suse.cz>
> Date:   Wed Nov 1 17:43:10 2023 +0000
> 
>     fs: Block writes to mounted block devices
> 
> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=16fbb3dc180000
> start commit:   f5837722ffec Merge tag 'mm-hotfixes-stable-2023-12-27-15-0..
> git tree:       upstream
> kernel config:  https://syzkaller.appspot.com/x/.config?x=da1c95d4e55dda83
> dashboard link: https://syzkaller.appspot.com/bug?extid=63cebbb27f598a7f901b
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1230c7e9e80000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=133d189ae80000
> 
> If the result looks correct, please mark the issue as fixed by replying with:

Looks sensible.

#syz fix: fs: Block writes to mounted block devices

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

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

end of thread, other threads:[~2024-02-15  9:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-01  9:54 [syzbot] [reiserfs?] general protection fault in __fget_files (2) syzbot
2024-01-05 13:14 ` Edward Adam Davis
2024-01-05 13:49   ` syzbot
2024-02-15  5:14 ` syzbot
2024-02-15  9:30   ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox