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

23 views
Skip to first unread message

syzbot

unread,
Oct 29, 2024, 8:43:31 PM10/29/24
to aivazia...@gmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: c71f8fb4dc91 Merge tag 'v6.12-rc4-smb3-client-fixes' of gi..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=121c2a87980000
kernel config: https://syzkaller.appspot.com/x/.config?x=309bb816d40abc28
dashboard link: https://syzkaller.appspot.com/bug?extid=f51a2a34984e4d8888fd
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=169e84a7980000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-c71f8fb4.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a47500c947a2/vmlinux-c71f8fb4.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d8ce30ea9c33/bzImage-c71f8fb4.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/01cd1174fb5c/mount_0.gz

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

Oops: general protection fault, probably for non-canonical address 0xdffffc0000000005: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f]
CPU: 0 UID: 0 PID: 7369 Comm: syz.0.496 Not tainted 6.12.0-rc4-syzkaller-00256-gc71f8fb4dc91 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:bfs_move_block fs/bfs/file.c:43 [inline]
RIP: 0010:bfs_move_blocks fs/bfs/file.c:57 [inline]
RIP: 0010:bfs_get_block+0xa75/0xb70 fs/bfs/file.c:126
Code: 00 41 8b 0f b8 77 7f ff ff 21 c1 81 c9 08 80 00 00 4c 89 ef 4c 89 f6 e8 29 14 a0 ff 49 89 c5 48 8d 68 28 48 89 e8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 ef e8 6c 7b 7b ff 4c 8b 75 00 48 8d 7b
RSP: 0018:ffffc9000d36ec50 EFLAGS: 00010206
RAX: 0000000000000005 RBX: ffff888045ebdae0 RCX: ffff88801fa40000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000028 R08: ffffffff822344c7 R09: 1ffffd40002594b6
R10: dffffc0000000000 R11: fffff940002594b7 R12: dffffc0000000000
R13: 0000000000000000 R14: 0000000000000043 R15: ffff888031cfce68
FS: 0000555581ad0500(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020007000 CR3: 0000000044902000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__block_write_begin_int+0x50c/0x1a70 fs/buffer.c:2121
block_write_begin+0x8f/0x120 fs/buffer.c:2231
bfs_write_begin+0x35/0xd0 fs/bfs/file.c:179
generic_perform_write+0x344/0x6d0 mm/filemap.c:4054
generic_file_write_iter+0xae/0x310 mm/filemap.c:4181
__kernel_write_iter+0x42a/0x940 fs/read_write.c:616
__kernel_write+0x120/0x180 fs/read_write.c:636
__dump_emit+0x237/0x360 fs/coredump.c:807
elf_core_dump+0x360a/0x4770 fs/binfmt_elf.c:2100
do_coredump+0x2162/0x2ec0 fs/coredump.c:758
get_signal+0x13fc/0x1740 kernel/signal.c:2902
arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:337
exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
irqentry_exit_to_user_mode+0x79/0x280 kernel/entry/common.c:231
exc_page_fault+0x590/0x8c0 arch/x86/mm/fault.c:1542
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623
RIP: 0033:0x7ff939d7e721
Code: 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 83 c8 ff c3 66 2e 0f 1f
RSP: 002b:ffffffffffffffe0 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 00007ff939f35f80 RCX: 00007ff939d7e719
RDX: 0000000000000000 RSI: ffffffffffffffe0 RDI: 0000000004008011
RBP: 00007ff939df132e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 00007ff939f35f80 R14: 00007ff939f35f80 R15: 000000000000130d
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bfs_move_block fs/bfs/file.c:43 [inline]
RIP: 0010:bfs_move_blocks fs/bfs/file.c:57 [inline]
RIP: 0010:bfs_get_block+0xa75/0xb70 fs/bfs/file.c:126
Code: 00 41 8b 0f b8 77 7f ff ff 21 c1 81 c9 08 80 00 00 4c 89 ef 4c 89 f6 e8 29 14 a0 ff 49 89 c5 48 8d 68 28 48 89 e8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 ef e8 6c 7b 7b ff 4c 8b 75 00 48 8d 7b
RSP: 0018:ffffc9000d36ec50 EFLAGS: 00010206
RAX: 0000000000000005 RBX: ffff888045ebdae0 RCX: ffff88801fa40000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000028 R08: ffffffff822344c7 R09: 1ffffd40002594b6
R10: dffffc0000000000 R11: fffff940002594b7 R12: dffffc0000000000
R13: 0000000000000000 R14: 0000000000000043 R15: ffff888031cfce68
FS: 0000555581ad0500(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020007000 CR3: 0000000044902000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 41 8b 0f mov (%r15),%ecx
3: b8 77 7f ff ff mov $0xffff7f77,%eax
8: 21 c1 and %eax,%ecx
a: 81 c9 08 80 00 00 or $0x8008,%ecx
10: 4c 89 ef mov %r13,%rdi
13: 4c 89 f6 mov %r14,%rsi
16: e8 29 14 a0 ff call 0xffa01444
1b: 49 89 c5 mov %rax,%r13
1e: 48 8d 68 28 lea 0x28(%rax),%rbp
22: 48 89 e8 mov %rbp,%rax
25: 48 c1 e8 03 shr $0x3,%rax
* 29: 42 80 3c 20 00 cmpb $0x0,(%rax,%r12,1) <-- trapping instruction
2e: 74 08 je 0x38
30: 48 89 ef mov %rbp,%rdi
33: e8 6c 7b 7b ff call 0xff7b7ba4
38: 4c 8b 75 00 mov 0x0(%rbp),%r14
3c: 48 rex.W
3d: 8d .byte 0x8d
3e: 7b .byte 0x7b


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

Edward Adam Davis

unread,
Nov 2, 2024, 9:37:47 PM11/2/24
to syzbot+f51a2a...@syzkaller.appspotmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
add a check for new bh
#syz test

diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index fa66a09e496a..d7a464eace81 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -40,6 +40,9 @@ static int bfs_move_block(unsigned long from, unsigned long to,
if (!bh)
return -EIO;
new = sb_getblk(sb, to);
+ if (!new)
+ return -ENOMEM;
+
memcpy(new->b_data, bh->b_data, bh->b_size);
mark_buffer_dirty(new);
bforget(bh);

syzbot

unread,
Nov 2, 2024, 9:57:06 PM11/2/24
to ead...@qq.com, linux-...@vger.kernel.org, syzkall...@googlegroups.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: 6436 at fs/buffer.c:1177 mark_buffer_dirty+0x2e5/0x520 fs/buffer.c:1177
Modules linked in:
CPU: 0 UID: 0 PID: 6436 Comm: syz.0.76 Not tainted 6.12.0-rc5-syzkaller-00299-g11066801dd4b-dirty #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:mark_buffer_dirty+0x2e5/0x520 fs/buffer.c:1177
Code: 89 df e8 fe 82 db ff 48 8b 3b be 20 00 00 00 5b 41 5e 41 5f 5d e9 fb e8 fb ff e8 26 c4 71 ff e9 73 ff ff ff e8 1c c4 71 ff 90 <0f> 0b 90 e9 61 fd ff ff e8 0e c4 71 ff 90 0f 0b 90 e9 88 fd ff ff
RSP: 0018:ffffc9000d30eb50 EFLAGS: 00010293
RAX: ffffffff82231604 RBX: ffff8880459fea01 RCX: ffff88803d044880
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffff82231361 R09: 1ffff11003542579
R10: dffffc0000000000 R11: ffffed100354257a R12: 000000000000000a
R13: dffffc0000000000 R14: ffff88801aa12bc8 R15: ffff88804553b200
FS: 00007fda86b986c0(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f0fe3329fe4 CR3: 000000004a36e000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
bfs_move_block fs/bfs/file.c:47 [inline]
bfs_move_blocks fs/bfs/file.c:60 [inline]
bfs_get_block+0x8be/0xb40 fs/bfs/file.c:129
__block_write_begin_int+0x50c/0x1a70 fs/buffer.c:2121
block_write_begin+0x8f/0x120 fs/buffer.c:2231
bfs_write_begin+0x35/0xd0 fs/bfs/file.c:182
generic_perform_write+0x344/0x6d0 mm/filemap.c:4054
generic_file_write_iter+0xae/0x310 mm/filemap.c:4181
__kernel_write_iter+0x42a/0x940 fs/read_write.c:616
__kernel_write+0x120/0x180 fs/read_write.c:636
__dump_emit+0x237/0x360 fs/coredump.c:807
writenote+0x221/0x3b0 fs/binfmt_elf.c:1463
write_note_info fs/binfmt_elf.c:1941 [inline]
elf_core_dump+0x37ba/0x4770 fs/binfmt_elf.c:2108
do_coredump+0x2162/0x2ec0 fs/coredump.c:758
get_signal+0x13fc/0x1740 kernel/signal.c:2902
arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:337
exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
irqentry_exit_to_user_mode+0x79/0x280 kernel/entry/common.c:231
exc_page_fault+0x590/0x8c0 arch/x86/mm/fault.c:1542
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623
RIP: 0033:0x7fda85d7e721
Code: 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 83 c8 ff c3 66 2e 0f 1f
RSP: 002b:ffffffffffffffe0 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 00007fda85f36058 RCX: 00007fda85d7e719
RDX: 0000000000000000 RSI: ffffffffffffffe0 RDI: 0000000004008011
RBP: 00007fda85df132e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fda85f36058 R15: 00007ffe98382878
</TASK>


Tested on:

commit: 11066801 Merge tag 'linux_kselftest-fixes-6.12-rc6' of..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12280d5f980000
kernel config: https://syzkaller.appspot.com/x/.config?x=4aec7739e14231a7
dashboard link: https://syzkaller.appspot.com/bug?extid=f51a2a34984e4d8888fd
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=152e6987980000

Edward Adam Davis

unread,
Nov 3, 2024, 12:37:50 AM11/3/24
to syzbot+f51a2a...@syzkaller.appspotmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
add a check for new bh

#syz test

diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index fa66a09e496a..10287a1a5846 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -40,6 +40,11 @@ static int bfs_move_block(unsigned long from, unsigned long to,
if (!bh)
return -EIO;
new = sb_getblk(sb, to);
+ if (!new) {
+ bforget(bh);
+ return -ENOMEM;
+ }

syzbot

unread,
Nov 3, 2024, 12:53:05 AM11/3/24
to ead...@qq.com, linux-...@vger.kernel.org, syzkall...@googlegroups.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: 5982 at fs/buffer.c:1177 mark_buffer_dirty+0x2e5/0x520 fs/buffer.c:1177
Modules linked in:
CPU: 0 UID: 0 PID: 5982 Comm: syz.0.15 Not tainted 6.12.0-rc5-syzkaller-00308-g3e5e6c9900c3-dirty #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:mark_buffer_dirty+0x2e5/0x520 fs/buffer.c:1177
Code: 89 df e8 fe 82 db ff 48 8b 3b be 20 00 00 00 5b 41 5e 41 5f 5d e9 fb e8 fb ff e8 26 c4 71 ff e9 73 ff ff ff e8 1c c4 71 ff 90 <0f> 0b 90 e9 61 fd ff ff e8 0e c4 71 ff 90 0f 0b 90 e9 88 fd ff ff
RSP: 0018:ffffc9000cecf848 EFLAGS: 00010293
RAX: ffffffff82231604 RBX: ffff8880474fa301 RCX: ffff8880363cc880
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffff82231361 R09: 1ffff11008e9f474
R10: dffffc0000000000 R11: ffffed1008e9f475 R12: ffff88804243f658
R13: dffffc0000000000 R14: ffff8880474fa3a0 R15: ffff8880516f1c00
FS: 00007fd80c3ae6c0(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f88016aa0a0 CR3: 0000000040b52000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
bfs_move_block fs/bfs/file.c:49 [inline]
bfs_move_blocks fs/bfs/file.c:62 [inline]
bfs_get_block+0x64e/0xb70 fs/bfs/file.c:131
__block_write_begin_int+0x50c/0x1a70 fs/buffer.c:2121
block_write_begin+0x8f/0x120 fs/buffer.c:2231
bfs_write_begin+0x35/0xd0 fs/bfs/file.c:184
generic_perform_write+0x344/0x6d0 mm/filemap.c:4054
generic_file_write_iter+0xae/0x310 mm/filemap.c:4181
new_sync_write fs/read_write.c:590 [inline]
vfs_write+0xaeb/0xd30 fs/read_write.c:683
ksys_write+0x183/0x2b0 fs/read_write.c:736
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fd80b57e719
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:00007fd80c3ae038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fd80b735f80 RCX: 00007fd80b57e719
RDX: 000000000000fecc RSI: 0000000020000100 RDI: 0000000000000005
RBP: 00007fd80b5f132e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fd80b735f80 R15: 00007ffd276927f8
</TASK>


Tested on:

commit: 3e5e6c99 Merge tag 'nfsd-6.12-3' of git://git.kernel.o..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1689ab40580000
kernel config: https://syzkaller.appspot.com/x/.config?x=4aec7739e14231a7
dashboard link: https://syzkaller.appspot.com/bug?extid=f51a2a34984e4d8888fd
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=15091aa7980000

Edward Adam Davis

unread,
Nov 3, 2024, 1:08:21 AM11/3/24
to syzbot+f51a2a...@syzkaller.appspotmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
add a check for new bh

#syz test

diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index fa66a09e496a..5fb6428d692d 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -40,6 +40,11 @@ static int bfs_move_block(unsigned long from, unsigned long to,
if (!bh)
return -EIO;
new = sb_getblk(sb, to);
+ if (!new || !buffer_uptodate(new)) {

syzbot

unread,
Nov 3, 2024, 1:28:04 AM11/3/24
to ead...@qq.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

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

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

Tested on:

commit: 3e5e6c99 Merge tag 'nfsd-6.12-3' of git://git.kernel.o..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11b13630580000
kernel config: https://syzkaller.appspot.com/x/.config?x=4aec7739e14231a7
dashboard link: https://syzkaller.appspot.com/bug?extid=f51a2a34984e4d8888fd
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=14613630580000

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

Edward Adam Davis

unread,
Nov 3, 2024, 9:08:40 AM11/3/24
to syzbot+f51a2a...@syzkaller.appspotmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
add a check for new bh

#syz test

diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index fa66a09e496a..983cc191d1e3 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -35,16 +35,28 @@ static int bfs_move_block(unsigned long from, unsigned long to,
struct super_block *sb)
{
struct buffer_head *bh, *new;
+ int err = 0;

bh = sb_bread(sb, from);
if (!bh)
return -EIO;
new = sb_getblk(sb, to);
+ if (!new) {
+ bforget(bh);
+ return -ENOMEM;
+ }
+
+ if (!buffer_uptodate(new)) {
+ err = -EIO;
+ goto out;
+ }
+
memcpy(new->b_data, bh->b_data, bh->b_size);
mark_buffer_dirty(new);
+out:
bforget(bh);
brelse(new);
- return 0;
+ return err;
}

static int bfs_move_blocks(struct super_block *sb, unsigned long start,
--
2.43.0


syzbot

unread,
Nov 3, 2024, 9:33:06 AM11/3/24
to ead...@qq.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

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

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

Tested on:

commit: 3e5e6c99 Merge tag 'nfsd-6.12-3' of git://git.kernel.o..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=120f6b40580000
kernel config: https://syzkaller.appspot.com/x/.config?x=4aec7739e14231a7
dashboard link: https://syzkaller.appspot.com/bug?extid=f51a2a34984e4d8888fd
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=17fcb630580000

Edward Adam Davis

unread,
Nov 3, 2024, 9:36:57 AM11/3/24
to syzbot+f51a2a...@syzkaller.appspotmail.com, aivazia...@gmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Syzbot reported a null-ptr-deref in bfs_move_block.
sb_getblk() can fail, so need to check its return value.
If returned buffer head is not uptodate, it is considered corrupt.

Reported-and-tested-by: syzbot+f51a2a...@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f51a2a34984e4d8888fd
Signed-off-by: Edward Adam Davis <ead...@qq.com>
---
fs/bfs/file.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

syzbot

unread,
Nov 15, 2024, 12:58:31 PM11/15/24
to aivazia...@gmail.com, ead...@qq.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: cfaaa7d010d1 Merge tag 'net-6.12-rc8' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=122b6b5f980000
kernel config: https://syzkaller.appspot.com/x/.config?x=d2aeec8c0b2e420c
dashboard link: https://syzkaller.appspot.com/bug?extid=f51a2a34984e4d8888fd
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=1293dcc0580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=162b6b5f980000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7feb34a89c2a/non_bootable_disk-cfaaa7d0.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/63eae0d3e67f/vmlinux-cfaaa7d0.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6495d9e4ddee/bzImage-cfaaa7d0.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/3d8024ecda8b/mount_0.gz

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

loop0: detected capacity change from 0 to 64
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000005: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f]
CPU: 0 UID: 0 PID: 5312 Comm: syz-executor160 Not tainted 6.12.0-rc7-syzkaller-00125-gcfaaa7d010d1 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
RIP: 0010:bfs_move_block fs/bfs/file.c:43 [inline]
RIP: 0010:bfs_move_blocks fs/bfs/file.c:57 [inline]
RIP: 0010:bfs_get_block+0xa75/0xb70 fs/bfs/file.c:126
Code: 00 41 8b 0f b8 77 7f ff ff 21 c1 81 c9 08 80 00 00 4c 89 ef 4c 89 f6 e8 d9 12 a0 ff 49 89 c5 48 8d 68 28 48 89 e8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 ef e8 3c 6f 7b ff 4c 8b 75 00 48 8d 7b
RSP: 0018:ffffc9000cfd7870 EFLAGS: 00010206
RAX: 0000000000000005 RBX: ffff8880479293a0 RCX: ffff88801f8c8000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000028 R08: ffffffff82236dd7 R09: 1ffffd400022314e
R10: dffffc0000000000 R11: fffff9400022314f R12: dffffc0000000000
R13: 0000000000000000 R14: 0000000000000054 R15: ffff8880008cce68
FS: 0000555570718380(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000043b1c000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__block_write_begin_int+0x50c/0x1a70 fs/buffer.c:2121
block_write_begin+0x8f/0x120 fs/buffer.c:2231
bfs_write_begin+0x35/0xd0 fs/bfs/file.c:179
generic_perform_write+0x344/0x6d0 mm/filemap.c:4054
generic_file_write_iter+0xae/0x310 mm/filemap.c:4181
new_sync_write fs/read_write.c:590 [inline]
vfs_write+0xaeb/0xd30 fs/read_write.c:683
ksys_write+0x183/0x2b0 fs/read_write.c:736
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f1355821db9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe17b1ddc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f135586b066 RCX: 00007f1355821db9
RDX: 000000000000fecc RSI: 0000000020000100 RDI: 0000000000000008
RBP: 00007f1355895610 R08: 00007ffe17b1df98 R09: 00007ffe17b1df98
R10: 00007ffe17b1df98 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffe17b1df88 R14: 0000000000000001 R15: 0000000000000001
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:bfs_move_block fs/bfs/file.c:43 [inline]
RIP: 0010:bfs_move_blocks fs/bfs/file.c:57 [inline]
RIP: 0010:bfs_get_block+0xa75/0xb70 fs/bfs/file.c:126
Code: 00 41 8b 0f b8 77 7f ff ff 21 c1 81 c9 08 80 00 00 4c 89 ef 4c 89 f6 e8 d9 12 a0 ff 49 89 c5 48 8d 68 28 48 89 e8 48 c1 e8 03 <42> 80 3c 20 00 74 08 48 89 ef e8 3c 6f 7b ff 4c 8b 75 00 48 8d 7b
RSP: 0018:ffffc9000cfd7870 EFLAGS: 00010206
RAX: 0000000000000005 RBX: ffff8880479293a0 RCX: ffff88801f8c8000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000028 R08: ffffffff82236dd7 R09: 1ffffd400022314e
R10: dffffc0000000000 R11: fffff9400022314f R12: dffffc0000000000
R13: 0000000000000000 R14: 0000000000000054 R15: ffff8880008cce68
FS: 0000555570718380(0000) GS:ffff88801fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 0000000043b1c000 CR4: 0000000000352ef0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 41 8b 0f mov (%r15),%ecx
3: b8 77 7f ff ff mov $0xffff7f77,%eax
8: 21 c1 and %eax,%ecx
a: 81 c9 08 80 00 00 or $0x8008,%ecx
10: 4c 89 ef mov %r13,%rdi
13: 4c 89 f6 mov %r14,%rsi
16: e8 d9 12 a0 ff call 0xffa012f4
1b: 49 89 c5 mov %rax,%r13
1e: 48 8d 68 28 lea 0x28(%rax),%rbp
22: 48 89 e8 mov %rbp,%rax
25: 48 c1 e8 03 shr $0x3,%rax
* 29: 42 80 3c 20 00 cmpb $0x0,(%rax,%r12,1) <-- trapping instruction
2e: 74 08 je 0x38
30: 48 89 ef mov %rbp,%rdi
33: e8 3c 6f 7b ff call 0xff7b6f74
38: 4c 8b 75 00 mov 0x0(%rbp),%r14
3c: 48 rex.W
3d: 8d .byte 0x8d
3e: 7b .byte 0x7b


---
Reply all
Reply to author
Forward
0 new messages