[syzbot] [bfs?] general protection fault in bfs_get_block (2)

14 views
Skip to first unread message

syzbot

unread,
Nov 26, 2023, 10:38:41 AM11/26/23
to aivazia...@gmail.com, linux-...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 98b1cc82c4af Linux 6.7-rc2
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1427ba00e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=aec35c1281ec0aaf
dashboard link: https://syzkaller.appspot.com/bug?extid=dc6ed11a88fb40d6e184
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=16783b84e80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=165172a0e80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/b60687e82ad4/disk-98b1cc82.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/29477f0b04df/vmlinux-98b1cc82.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9aab12888a60/bzImage-98b1cc82.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/58e57ae1d84f/mount_0.gz

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

Code: Unable to access opcode bytes at 0xffffffffffffffd6.
general protection fault, probably for non-canonical address 0xdffffc0000000005: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f]
CPU: 1 PID: 5059 Comm: syz-executor306 Not tainted 6.7.0-rc2-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
RIP: 0010:bfs_move_block fs/bfs/file.c:42 [inline]
RIP: 0010:bfs_move_blocks fs/bfs/file.c:56 [inline]
RIP: 0010:bfs_get_block+0x3b2/0xeb0 fs/bfs/file.c:125
Code: a8 ff 48 8d 7d 20 48 89 c3 48 89 f8 48 c1 e8 03 42 80 3c 28 00 0f 85 5b 08 00 00 48 8d 7b 28 48 8b 55 20 48 89 f8 48 c1 e8 03 <42> 80 3c 28 00 0f 85 dd 08 00 00 48 8d 7d 28 48 8b 43 28 48 89 f9
RSP: 0018:ffffc900033fef30 EFLAGS: 00010206
RAX: 0000000000000005 RBX: 0000000000000000 RCX: ffffffff81fd2b77
RDX: 0000000000000200 RSI: ffffffff81fd2e15 RDI: 0000000000000028
RBP: ffff888074ee20e8 R08: 0000000000000005 R09: 0000000000000000
R10: 00000000fffffffa R11: 0000000000000003 R12: 0000000000000019
R13: dffffc0000000000 R14: ffff88807fb36000 R15: ffffed100ff66c2c
FS: 0000555556c24380(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6250121b3b CR3: 000000001f25d000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__block_write_begin_int+0x3c0/0x1560 fs/buffer.c:2119
__block_write_begin fs/buffer.c:2168 [inline]
block_write_begin+0xb1/0x490 fs/buffer.c:2227
bfs_write_begin+0x31/0xd0 fs/bfs/file.c:177
generic_perform_write+0x278/0x600 mm/filemap.c:3918
__generic_file_write_iter+0x1f9/0x240 mm/filemap.c:4013
generic_file_write_iter+0xe3/0x350 mm/filemap.c:4039
__kernel_write_iter+0x261/0x7b0 fs/read_write.c:517
__kernel_write+0xf6/0x140 fs/read_write.c:537
__dump_emit fs/coredump.c:813 [inline]
dump_emit+0x21d/0x330 fs/coredump.c:850
writenote+0x215/0x2b0 fs/binfmt_elf.c:1422
write_note_info fs/binfmt_elf.c:1897 [inline]
elf_core_dump+0x250c/0x3900 fs/binfmt_elf.c:2064
do_coredump+0x2c97/0x3fd0 fs/coredump.c:764
get_signal+0x2438/0x2790 kernel/signal.c:2890
arch_do_signal_or_restart+0x90/0x7f0 arch/x86/kernel/signal.c:309
exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
exit_to_user_mode_prepare+0x121/0x240 kernel/entry/common.c:204
irqentry_exit_to_user_mode+0xa/0x40 kernel/entry/common.c:309
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570
RIP: 0033:0x0
Code: Unable to access opcode bytes at 0xffffffffffffffd6.
RSP: 002b:0000000020000008 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 0000000000000020 RCX: 00007f3fa02f7db9
RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000555500000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000000f4240
R13: 00007ffdb733b1e8 R14: 0000000000000001 R15: 00007ffdb733afb0
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bfs_move_block fs/bfs/file.c:42 [inline]
RIP: 0010:bfs_move_blocks fs/bfs/file.c:56 [inline]
RIP: 0010:bfs_get_block+0x3b2/0xeb0 fs/bfs/file.c:125
Code: a8 ff 48 8d 7d 20 48 89 c3 48 89 f8 48 c1 e8 03 42 80 3c 28 00 0f 85 5b 08 00 00 48 8d 7b 28 48 8b 55 20 48 89 f8 48 c1 e8 03 <42> 80 3c 28 00 0f 85 dd 08 00 00 48 8d 7d 28 48 8b 43 28 48 89 f9
RSP: 0018:ffffc900033fef30 EFLAGS: 00010206
RAX: 0000000000000005 RBX: 0000000000000000 RCX: ffffffff81fd2b77
RDX: 0000000000000200 RSI: ffffffff81fd2e15 RDI: 0000000000000028
RBP: ffff888074ee20e8 R08: 0000000000000005 R09: 0000000000000000
R10: 00000000fffffffa R11: 0000000000000003 R12: 0000000000000019
R13: dffffc0000000000 R14: ffff88807fb36000 R15: ffffed100ff66c2c
FS: 0000555556c24380(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000001f25d000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
0: a8 ff test $0xff,%al
2: 48 8d 7d 20 lea 0x20(%rbp),%rdi
6: 48 89 c3 mov %rax,%rbx
9: 48 89 f8 mov %rdi,%rax
c: 48 c1 e8 03 shr $0x3,%rax
10: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1)
15: 0f 85 5b 08 00 00 jne 0x876
1b: 48 8d 7b 28 lea 0x28(%rbx),%rdi
1f: 48 8b 55 20 mov 0x20(%rbp),%rdx
23: 48 89 f8 mov %rdi,%rax
26: 48 c1 e8 03 shr $0x3,%rax
* 2a: 42 80 3c 28 00 cmpb $0x0,(%rax,%r13,1) <-- trapping instruction
2f: 0f 85 dd 08 00 00 jne 0x912
35: 48 8d 7d 28 lea 0x28(%rbp),%rdi
39: 48 8b 43 28 mov 0x28(%rbx),%rax
3d: 48 89 f9 mov %rdi,%rcx


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

syzbot

unread,
Nov 26, 2023, 5:41:58 PM11/26/23
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: Test np deref
Author: yuran....@hotmail.com

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

syzbot

unread,
Nov 26, 2023, 6:24:28 PM11/26/23
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: Test patch
---
fs/bfs/file.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index adc2230079c6..8a97909b1484 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -38,7 +38,12 @@ static int bfs_move_block(unsigned long from, unsigned long to,
bh = sb_bread(sb, from);
if (!bh)
return -EIO;
+
new = sb_getblk(sb, to);
+ if (!new) {
+ bforget(bh);
+ return -ENOMEM;
+ }
memcpy(new->b_data, bh->b_data, bh->b_size);
mark_buffer_dirty(new);
bforget(bh);
--
2.25.1

syzbot

unread,
Nov 26, 2023, 7:08:06 PM11/26/23
to linux-...@vger.kernel.org, syzkall...@googlegroups.com, yuran....@hotmail.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in mark_buffer_dirty

------------[ cut here ]------------
WARNING: CPU: 1 PID: 5493 at fs/buffer.c:1176 mark_buffer_dirty+0x37b/0x3f0 fs/buffer.c:1176
Modules linked in:
CPU: 1 PID: 5493 Comm: syz-executor.0 Not tainted 6.7.0-rc2-syzkaller-00265-gd2da77f431ac #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
RIP: 0010:mark_buffer_dirty+0x37b/0x3f0 fs/buffer.c:1176
Code: 89 ff e8 78 cb 89 ff 48 89 ef e8 50 6a e7 ff 5b 5d e9 69 cb 89 ff e8 64 cb 89 ff 90 0f 0b 90 e9 0c fe ff ff e8 56 cb 89 ff 90 <0f> 0b 90 e9 b1 fc ff ff e8 48 cb 89 ff 90 0f 0b 90 e9 ce fc ff ff
RSP: 0018:ffffc9000356ef18 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888067e452f8 RCX: ffffffff81fcb1bb
RDX: ffff88807ed5e1c0 RSI: ffffffff81fcb50a RDI: 0000000000000001
RBP: ffff888067e44700 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000012
R13: dffffc0000000000 R14: ffff888029428000 R15: ffffed100528502c
FS: 00007f564a9a36c0(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f564a9a3fe8 CR3: 0000000029a41000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
bfs_move_block fs/bfs/file.c:43 [inline]
bfs_move_blocks fs/bfs/file.c:56 [inline]
bfs_get_block+0x3eb/0xeb0 fs/bfs/file.c:125
__block_write_begin_int+0x3c0/0x1560 fs/buffer.c:2119
__block_write_begin fs/buffer.c:2168 [inline]
block_write_begin+0xb1/0x490 fs/buffer.c:2227
bfs_write_begin+0x31/0xd0 fs/bfs/file.c:177
generic_perform_write+0x278/0x600 mm/filemap.c:3918
__generic_file_write_iter+0x1f9/0x240 mm/filemap.c:4013
generic_file_write_iter+0xe3/0x350 mm/filemap.c:4039
__kernel_write_iter+0x261/0x7b0 fs/read_write.c:517
__kernel_write+0xf6/0x140 fs/read_write.c:537
__dump_emit fs/coredump.c:813 [inline]
dump_emit+0x21d/0x330 fs/coredump.c:850
writenote+0x215/0x2b0 fs/binfmt_elf.c:1422
write_note_info fs/binfmt_elf.c:1904 [inline]
elf_core_dump+0x27f4/0x3900 fs/binfmt_elf.c:2064
do_coredump+0x2c97/0x3fd0 fs/coredump.c:764
get_signal+0x2438/0x2790 kernel/signal.c:2890
arch_do_signal_or_restart+0x90/0x7f0 arch/x86/kernel/signal.c:309
exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
exit_to_user_mode_prepare+0x121/0x240 kernel/entry/common.c:204
irqentry_exit_to_user_mode+0xa/0x40 kernel/entry/common.c:309
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570
RIP: 0033:0x0
Code: Unable to access opcode bytes at 0xffffffffffffffd6.
RSP: 002b:0000000020000008 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 00007f5649d9bf80 RCX: 00007f5649c7cae9
RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000000
RBP: 00007f5649cc847a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f5649d9bf80 R15: 00007ffee518f008
</TASK>


Tested on:

commit: d2da77f4 Merge tag 'parisc-for-6.7-rc3' of git://git.k..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=156441d8e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=aec35c1281ec0aaf
dashboard link: https://syzkaller.appspot.com/bug?extid=dc6ed11a88fb40d6e184
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40

Note: no patches were applied.

syzbot

unread,
Nov 26, 2023, 7:19:06 PM11/26/23
to linux-...@vger.kernel.org, syzkall...@googlegroups.com, yuran....@hotmail.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in mark_buffer_dirty

------------[ cut here ]------------
WARNING: CPU: 0 PID: 5488 at fs/buffer.c:1176 mark_buffer_dirty+0x37b/0x3f0 fs/buffer.c:1176
Modules linked in:
CPU: 0 PID: 5488 Comm: syz-executor.0 Not tainted 6.7.0-rc2-syzkaller-00265-gd2da77f431ac-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
RIP: 0010:mark_buffer_dirty+0x37b/0x3f0 fs/buffer.c:1176
Code: 89 ff e8 78 cb 89 ff 48 89 ef e8 50 6a e7 ff 5b 5d e9 69 cb 89 ff e8 64 cb 89 ff 90 0f 0b 90 e9 0c fe ff ff e8 56 cb 89 ff 90 <0f> 0b 90 e9 b1 fc ff ff e8 48 cb 89 ff 90 0f 0b 90 e9 ce fc ff ff
RSP: 0018:ffffc9000381efc8 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff888070b933e0 RCX: ffffffff81fcb1bb
RDX: ffff888029eec100 RSI: ffffffff81fcb50a RDI: 0000000000000001
RBP: ffff888070b93300 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000013
R13: dffffc0000000000 R14: ffff888029be2000 R15: ffffed100537c403
FS: 00007fe0721f36c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000001ffffe40 CR3: 0000000029e95000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
bfs_move_block fs/bfs/file.c:48 [inline]
bfs_move_blocks fs/bfs/file.c:61 [inline]
bfs_get_block+0x41b/0xe90 fs/bfs/file.c:130
__block_write_begin_int+0x3c0/0x1560 fs/buffer.c:2119
__block_write_begin fs/buffer.c:2168 [inline]
block_write_begin+0xb1/0x490 fs/buffer.c:2227
bfs_write_begin+0x31/0xd0 fs/bfs/file.c:182
generic_perform_write+0x278/0x600 mm/filemap.c:3918
__generic_file_write_iter+0x1f9/0x240 mm/filemap.c:4013
generic_file_write_iter+0xe3/0x350 mm/filemap.c:4039
__kernel_write_iter+0x261/0x7b0 fs/read_write.c:517
__kernel_write+0xf6/0x140 fs/read_write.c:537
__dump_emit fs/coredump.c:813 [inline]
dump_emit+0x21d/0x330 fs/coredump.c:850
elf_core_dump+0x21bc/0x3900 fs/binfmt_elf.c:2056
do_coredump+0x2c97/0x3fd0 fs/coredump.c:764
get_signal+0x2438/0x2790 kernel/signal.c:2890
arch_do_signal_or_restart+0x90/0x7f0 arch/x86/kernel/signal.c:309
exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
exit_to_user_mode_prepare+0x121/0x240 kernel/entry/common.c:204
irqentry_exit_to_user_mode+0xa/0x40 kernel/entry/common.c:309
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570
RIP: 0033:0x0
Code: Unable to access opcode bytes at 0xffffffffffffffd6.
RSP: 002b:0000000020000008 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 00007fe07159bf80 RCX: 00007fe07147cae9
RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000000
RBP: 00007fe0714c847a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fe07159bf80 R15: 00007ffe7a2118b8
</TASK>


Tested on:

commit: d2da77f4 Merge tag 'parisc-for-6.7-rc3' of git://git.k..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=16ec3052e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=aec35c1281ec0aaf
dashboard link: https://syzkaller.appspot.com/bug?extid=dc6ed11a88fb40d6e184
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=146bba62e80000

syzbot

unread,
Jan 16, 2024, 3:20:08 AMJan 16
to aivazia...@gmail.com, ax...@kernel.dk, bra...@kernel.org, ja...@suse.cz, linux-...@vger.kernel.org, linux-kern...@lists.linuxfoundation.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, yuran....@hotmail.com
syzbot suspects this issue was fixed by commit:

commit 6f861765464f43a71462d52026fbddfc858239a5
Author: Jan Kara <ja...@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=16c3c513e80000
start commit: 98b1cc82c4af Linux 6.7-rc2
git tree: upstream
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

Aleksandr Nogikh

unread,
Jan 16, 2024, 4:25:01 AMJan 16
to syzbot, aivazia...@gmail.com, ax...@kernel.dk, bra...@kernel.org, ja...@suse.cz, linux-...@vger.kernel.org, linux-kern...@lists.linuxfoundation.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, yuran....@hotmail.com
#syz fix: fs: Block writes to mounted block devices

Reply all
Reply to author
Forward
0 new messages