* [syzbot] [ext4?] general protection fault in __block_commit_write
@ 2024-02-05 9:01 syzbot
2024-05-20 1:52 ` syzbot
` (5 more replies)
0 siblings, 6 replies; 12+ messages in thread
From: syzbot @ 2024-02-05 9:01 UTC (permalink / raw)
To: adilger.kernel, linux-ext4, linux-fsdevel, linux-kernel,
syzkaller-bugs, tytso
Hello,
syzbot found the following issue on:
HEAD commit: 56897d51886f Merge tag 'trace-v6.8-rc2' of git://git.kerne..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1550b18fe80000
kernel config: https://syzkaller.appspot.com/x/.config?x=b60b985eda147877
dashboard link: https://syzkaller.appspot.com/bug?extid=18df508cf00a0598d9a6
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=166f7aa8180000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1c0cc47da79d/disk-56897d51.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ef9122f0ce05/vmlinux-56897d51.xz
kernel image: https://storage.googleapis.com/syzbot-assets/8e2856cfcf95/bzImage-56897d51.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/5175bbf40ca7/mount_0.gz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+18df508cf00a0598d9a6@syzkaller.appspotmail.com
loop0: detected capacity change from 0 to 2048
general protection fault, probably for non-canonical address 0xdffffc0000000004: 0000 [#1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000020-0x0000000000000027]
CPU: 0 PID: 6860 Comm: syz-executor.0 Not tainted 6.8.0-rc2-syzkaller-00397-g56897d51886f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
RIP: 0010:__block_commit_write+0x61/0x270 fs/buffer.c:2165
Code: ea 03 80 3c 02 00 0f 85 16 02 00 00 48 8b 44 24 18 4c 8b 78 28 48 b8 00 00 00 00 00 fc ff df 49 8d 7f 20 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 e4 01 00 00 41 8b 47 20 4c 89 fb 45 31 f6 31 ed
RSP: 0018:ffffc90008947918 EFLAGS: 00010212
RAX: dffffc0000000000 RBX: ffffea00019b1180 RCX: ffffffff82086d31
RDX: 0000000000000004 RSI: ffffffff820823e4 RDI: 0000000000000020
RBP: 0000000000000040 R08: 0000000000000004 R09: 0000000000000040
R10: 0000000000000040 R11: 0000000000000003 R12: 0000000000000000
R13: 0000000000000040 R14: 0000000000000040 R15: 0000000000000000
FS: 00007f6f6a4016c0(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020007640 CR3: 0000000015340000 CR4: 0000000000350ef0
Call Trace:
<TASK>
block_write_end+0xc8/0x250 fs/buffer.c:2251
ext4_write_end+0x277/0xed0 fs/ext4/inode.c:1287
ext4_da_write_end+0xa64/0xce0 fs/ext4/inode.c:3020
generic_perform_write+0x33b/0x620 mm/filemap.c:3941
ext4_buffered_write_iter+0x11f/0x3d0 fs/ext4/file.c:299
ext4_file_write_iter+0x819/0x1960 fs/ext4/file.c:698
call_write_iter include/linux/fs.h:2085 [inline]
new_sync_write fs/read_write.c:497 [inline]
vfs_write+0x6e1/0x1110 fs/read_write.c:590
ksys_write+0x12f/0x260 fs/read_write.c:643
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xd8/0x270 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x6f/0x77
RIP: 0033:0x7f6f6967dda9
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:00007f6f6a4010c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f6f697abf80 RCX: 00007f6f6967dda9
RDX: 0000000000000040 RSI: 0000000020002ac0 RDI: 0000000000000005
RBP: 00007f6f696ca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f6f697abf80 R15: 00007ffc14067c28
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__block_commit_write+0x61/0x270 fs/buffer.c:2165
Code: ea 03 80 3c 02 00 0f 85 16 02 00 00 48 8b 44 24 18 4c 8b 78 28 48 b8 00 00 00 00 00 fc ff df 49 8d 7f 20 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 e4 01 00 00 41 8b 47 20 4c 89 fb 45 31 f6 31 ed
RSP: 0018:ffffc90008947918 EFLAGS: 00010212
RAX: dffffc0000000000 RBX: ffffea00019b1180 RCX: ffffffff82086d31
RDX: 0000000000000004 RSI: ffffffff820823e4 RDI: 0000000000000020
RBP: 0000000000000040 R08: 0000000000000004 R09: 0000000000000040
R10: 0000000000000040 R11: 0000000000000003 R12: 0000000000000000
R13: 0000000000000040 R14: 0000000000000040 R15: 0000000000000000
FS: 00007f6f6a4016c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f9a064f7000 CR3: 0000000015340000 CR4: 0000000000350ef0
----------------
Code disassembly (best guess), 1 bytes skipped:
0: 03 80 3c 02 00 0f add 0xf00023c(%rax),%eax
6: 85 16 test %edx,(%rsi)
8: 02 00 add (%rax),%al
a: 00 48 8b add %cl,-0x75(%rax)
d: 44 24 18 rex.R and $0x18,%al
10: 4c 8b 78 28 mov 0x28(%rax),%r15
14: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
1b: fc ff df
1e: 49 8d 7f 20 lea 0x20(%r15),%rdi
22: 48 89 fa mov %rdi,%rdx
25: 48 c1 ea 03 shr $0x3,%rdx
* 29: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2d: 0f 85 e4 01 00 00 jne 0x217
33: 41 8b 47 20 mov 0x20(%r15),%eax
37: 4c 89 fb mov %r15,%rbx
3a: 45 31 f6 xor %r14d,%r14d
3d: 31 ed xor %ebp,%ebp
---
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.
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] 12+ messages in thread* Re: [syzbot] [ext4?] general protection fault in __block_commit_write 2024-02-05 9:01 [syzbot] [ext4?] general protection fault in __block_commit_write syzbot @ 2024-05-20 1:52 ` syzbot 2024-07-01 8:29 ` [syzbot] [PATCH] handle EFSCORRUPTED, drop EXT4_STATE_MAY_INLINE_DATA sanity check syzbot ` (4 subsequent siblings) 5 siblings, 0 replies; 12+ messages in thread From: syzbot @ 2024-05-20 1:52 UTC (permalink / raw) To: adilger.kernel, linux-ext4, linux-fsdevel, linux-kernel, syzkaller-bugs, tytso syzbot has found a reproducer for the following issue on: HEAD commit: fda5695d692c Merge branch 'for-next/core' into for-kernelci git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci console output: https://syzkaller.appspot.com/x/log.txt?x=1624be58980000 kernel config: https://syzkaller.appspot.com/x/.config?x=95dc1de8407c7270 dashboard link: https://syzkaller.appspot.com/bug?extid=18df508cf00a0598d9a6 compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 userspace arch: arm64 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12bef634980000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10b68242980000 Downloadable assets: disk image: https://storage.googleapis.com/syzbot-assets/07f3214ff0d9/disk-fda5695d.raw.xz vmlinux: https://storage.googleapis.com/syzbot-assets/70e2e2c864e8/vmlinux-fda5695d.xz kernel image: https://storage.googleapis.com/syzbot-assets/b259942a16dc/Image-fda5695d.gz.xz mounted in repro #1: https://storage.googleapis.com/syzbot-assets/5853ffd99deb/mount_0.gz mounted in repro #2: https://storage.googleapis.com/syzbot-assets/8d78b07027fb/mount_5.gz IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+18df508cf00a0598d9a6@syzkaller.appspotmail.com Unable to handle kernel paging request at virtual address dfff800000000004 KASAN: null-ptr-deref in range [0x0000000000000020-0x0000000000000027] Mem abort info: ESR = 0x0000000096000005 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x05: level 1 translation fault Data abort info: ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [dfff800000000004] address between user and kernel address ranges Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP Modules linked in: CPU: 1 PID: 20274 Comm: syz-executor185 Not tainted 6.9.0-rc7-syzkaller-gfda5695d692c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __block_commit_write+0x64/0x2b0 fs/buffer.c:2167 lr : __block_commit_write+0x3c/0x2b0 fs/buffer.c:2160 sp : ffff8000a1957600 x29: ffff8000a1957610 x28: dfff800000000000 x27: ffff0000e30e34b0 x26: 0000000000000000 x25: dfff800000000000 x24: dfff800000000000 x23: fffffdffc397c9e0 x22: 0000000000000020 x21: 0000000000000020 x20: 0000000000000040 x19: fffffdffc397c9c0 x18: 1fffe000367bd196 x17: ffff80008eead000 x16: ffff80008ae89e3c x15: 00000000200000c0 x14: 1fffe0001cbe4e04 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000001 x10: 0000000000ff0100 x9 : 0000000000000000 x8 : 0000000000000004 x7 : 0000000000000000 x6 : 0000000000000000 x5 : fffffdffc397c9c0 x4 : 0000000000000020 x3 : 0000000000000020 x2 : 0000000000000040 x1 : 0000000000000020 x0 : fffffdffc397c9c0 Call trace: __block_commit_write+0x64/0x2b0 fs/buffer.c:2167 block_write_end+0xb4/0x104 fs/buffer.c:2253 ext4_da_do_write_end fs/ext4/inode.c:2955 [inline] ext4_da_write_end+0x2c4/0xa40 fs/ext4/inode.c:3028 generic_perform_write+0x394/0x588 mm/filemap.c:3985 ext4_buffered_write_iter+0x2c0/0x4ec fs/ext4/file.c:299 ext4_file_write_iter+0x188/0x1780 call_write_iter include/linux/fs.h:2110 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0x968/0xc3c fs/read_write.c:590 ksys_write+0x15c/0x26c fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:652 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Code: 97f85911 f94002da 91008356 d343fec8 (38796908) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: 97f85911 bl 0xffffffffffe16444 4: f94002da ldr x26, [x22] 8: 91008356 add x22, x26, #0x20 c: d343fec8 lsr x8, x22, #3 * 10: 38796908 ldrb w8, [x8, x25] <-- trapping instruction --- 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. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [syzbot] [PATCH] handle EFSCORRUPTED, drop EXT4_STATE_MAY_INLINE_DATA sanity check 2024-02-05 9:01 [syzbot] [ext4?] general protection fault in __block_commit_write syzbot 2024-05-20 1:52 ` syzbot @ 2024-07-01 8:29 ` syzbot 2024-07-01 8:34 ` [syzbot] Test head for issue syzbot ` (3 subsequent siblings) 5 siblings, 0 replies; 12+ messages in thread From: syzbot @ 2024-07-01 8:29 UTC (permalink / raw) To: linux-kernel, syzkaller-bugs For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] handle EFSCORRUPTED, drop EXT4_STATE_MAY_INLINE_DATA sanity check Author: wojciech.gladysz@infogain.com #syz test: https://linux.googlesource.com/linux/kernel/git/torvalds/linux --- fs/buffer.c | 5 ++++- fs/ext4/inode.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index 4f73d23c2c46..10514fa9851c 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2163,7 +2163,10 @@ static void __block_commit_write(struct folio *folio, size_t from, size_t to) unsigned blocksize; struct buffer_head *bh, *head; - bh = head = folio_buffers(folio); + head = folio_buffers(folio); + if (!head) + return; + bh = head; blocksize = bh->b_size; block_start = 0; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 537803250ca9..e7a6958025ee 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2948,6 +2948,11 @@ static int ext4_da_do_write_end(struct address_space *mapping, bool disksize_changed = false; loff_t new_i_size; + if (unlikely(!folio_buffers(folio))) { + folio_unlock(folio); + folio_put(folio); + return -EIO; + } /* * block_write_end() will mark the inode as dirty with I_DIRTY_PAGES * flag, which all that's needed to trigger page writeback. -- 2.35.3 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [syzbot] Test head for issue 2024-02-05 9:01 [syzbot] [ext4?] general protection fault in __block_commit_write syzbot 2024-05-20 1:52 ` syzbot 2024-07-01 8:29 ` [syzbot] [PATCH] handle EFSCORRUPTED, drop EXT4_STATE_MAY_INLINE_DATA sanity check syzbot @ 2024-07-01 8:34 ` syzbot 2024-07-01 8:45 ` [syzbot] [PATCH] handle EFSCORRUPTED, drop EXT4_STATE_MAY_INLINE_DATA sanity check syzbot ` (2 subsequent siblings) 5 siblings, 0 replies; 12+ messages in thread From: syzbot @ 2024-07-01 8:34 UTC (permalink / raw) To: linux-kernel, syzkaller-bugs For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: Test head for issue Author: wojciech.gladysz@infogain.com #syz test: ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [syzbot] [PATCH] handle EFSCORRUPTED, drop EXT4_STATE_MAY_INLINE_DATA sanity check 2024-02-05 9:01 [syzbot] [ext4?] general protection fault in __block_commit_write syzbot ` (2 preceding siblings ...) 2024-07-01 8:34 ` [syzbot] Test head for issue syzbot @ 2024-07-01 8:45 ` syzbot 2024-07-01 8:46 ` [syzbot] Test head for issue syzbot 2024-07-03 7:01 ` [PATCH] kernel/ext4: sanity check for NULL pointer after ext4_force_shutdown Wojciech Gładysz 5 siblings, 0 replies; 12+ messages in thread From: syzbot @ 2024-07-01 8:45 UTC (permalink / raw) To: linux-kernel, syzkaller-bugs For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] handle EFSCORRUPTED, drop EXT4_STATE_MAY_INLINE_DATA sanity check Author: wojciech.gladysz@infogain.com #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master --- fs/buffer.c | 5 ++++- fs/ext4/inode.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index 4f73d23c2c46..10514fa9851c 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2163,7 +2163,10 @@ static void __block_commit_write(struct folio *folio, size_t from, size_t to) unsigned blocksize; struct buffer_head *bh, *head; - bh = head = folio_buffers(folio); + head = folio_buffers(folio); + if (!head) + return; + bh = head; blocksize = bh->b_size; block_start = 0; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 537803250ca9..e7a6958025ee 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2948,6 +2948,11 @@ static int ext4_da_do_write_end(struct address_space *mapping, bool disksize_changed = false; loff_t new_i_size; + if (unlikely(!folio_buffers(folio))) { + folio_unlock(folio); + folio_put(folio); + return -EIO; + } /* * block_write_end() will mark the inode as dirty with I_DIRTY_PAGES * flag, which all that's needed to trigger page writeback. -- 2.35.3 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [syzbot] Test head for issue 2024-02-05 9:01 [syzbot] [ext4?] general protection fault in __block_commit_write syzbot ` (3 preceding siblings ...) 2024-07-01 8:45 ` [syzbot] [PATCH] handle EFSCORRUPTED, drop EXT4_STATE_MAY_INLINE_DATA sanity check syzbot @ 2024-07-01 8:46 ` syzbot 2024-07-03 7:01 ` [PATCH] kernel/ext4: sanity check for NULL pointer after ext4_force_shutdown Wojciech Gładysz 5 siblings, 0 replies; 12+ messages in thread From: syzbot @ 2024-07-01 8:46 UTC (permalink / raw) To: linux-kernel, syzkaller-bugs For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: Test head for issue Author: wojciech.gladysz@infogain.com #syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] kernel/ext4: sanity check for NULL pointer after ext4_force_shutdown 2024-02-05 9:01 [syzbot] [ext4?] general protection fault in __block_commit_write syzbot ` (4 preceding siblings ...) 2024-07-01 8:46 ` [syzbot] Test head for issue syzbot @ 2024-07-03 7:01 ` Wojciech Gładysz 2024-07-11 2:35 ` Theodore Ts'o 5 siblings, 1 reply; 12+ messages in thread From: Wojciech Gładysz @ 2024-07-03 7:01 UTC (permalink / raw) To: syzbot+18df508cf00a0598d9a6 Cc: adilger.kernel, linux-ext4, linux-fsdevel, linux-kernel, syzkaller-bugs, tytso, Wojciech Gładysz Test case: 2 threads write short inline data to a file. In ext4_page_mkwrite the resulting inline data is converted. Handling ext4_grp_locked_error with description "block bitmap and bg descriptor inconsistent: X vs Y free clusters" calls ext4_force_shutdown. The conversion clears EXT4_STATE_MAY_INLINE_DATA but fails for ext4_destroy_inline_data_nolock and ext4_mark_iloc_dirty due to ext4_forced_shutdown. The restoration of inline data fails for the same reason not setting EXT4_STATE_MAY_INLINE_DATA. Without the flag set a regular process path in ext4_da_write_end follows trying to dereference page folio private pointer that has not been set. The fix calls early return with -EIO error shall the pointer to private be NULL. Sample crash report: Unable to handle kernel paging request at virtual address dfff800000000004 KASAN: null-ptr-deref in range [0x0000000000000020-0x0000000000000027] Mem abort info: ESR = 0x0000000096000005 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x05: level 1 translation fault Data abort info: ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [dfff800000000004] address between user and kernel address ranges Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP Modules linked in: CPU: 1 PID: 20274 Comm: syz-executor185 Not tainted 6.9.0-rc7-syzkaller-gfda5695d692c #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __block_commit_write+0x64/0x2b0 fs/buffer.c:2167 lr : __block_commit_write+0x3c/0x2b0 fs/buffer.c:2160 sp : ffff8000a1957600 x29: ffff8000a1957610 x28: dfff800000000000 x27: ffff0000e30e34b0 x26: 0000000000000000 x25: dfff800000000000 x24: dfff800000000000 x23: fffffdffc397c9e0 x22: 0000000000000020 x21: 0000000000000020 x20: 0000000000000040 x19: fffffdffc397c9c0 x18: 1fffe000367bd196 x17: ffff80008eead000 x16: ffff80008ae89e3c x15: 00000000200000c0 x14: 1fffe0001cbe4e04 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000001 x10: 0000000000ff0100 x9 : 0000000000000000 x8 : 0000000000000004 x7 : 0000000000000000 x6 : 0000000000000000 x5 : fffffdffc397c9c0 x4 : 0000000000000020 x3 : 0000000000000020 x2 : 0000000000000040 x1 : 0000000000000020 x0 : fffffdffc397c9c0 Call trace: __block_commit_write+0x64/0x2b0 fs/buffer.c:2167 block_write_end+0xb4/0x104 fs/buffer.c:2253 ext4_da_do_write_end fs/ext4/inode.c:2955 [inline] ext4_da_write_end+0x2c4/0xa40 fs/ext4/inode.c:3028 generic_perform_write+0x394/0x588 mm/filemap.c:3985 ext4_buffered_write_iter+0x2c0/0x4ec fs/ext4/file.c:299 ext4_file_write_iter+0x188/0x1780 call_write_iter include/linux/fs.h:2110 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0x968/0xc3c fs/read_write.c:590 ksys_write+0x15c/0x26c fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:652 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Code: 97f85911 f94002da 91008356 d343fec8 (38796908) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: 97f85911 bl 0xffffffffffe16444 4: f94002da ldr x26, [x22] 8: 91008356 add x22, x26, #0x20 c: d343fec8 lsr x8, x22, #3 * 10: 38796908 ldrb w8, [x8, x25] <-- trapping instruction Reported-by: syzbot+18df508cf00a0598d9a6@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=18df508cf00a0598d9a6 Link: https://lore.kernel.org/all/000000000000f19a1406109eb5c5@google.com/T/ Signed-off-by: Wojciech Gładysz <wojciech.gladysz@infogain.com> --- fs/buffer.c | 5 ++++- fs/ext4/inode.c | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index 8c19e705b9c3..0d87d1f037e6 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2186,7 +2186,10 @@ static void __block_commit_write(struct folio *folio, size_t from, size_t to) unsigned blocksize; struct buffer_head *bh, *head; - bh = head = folio_buffers(folio); + head = folio_buffers(folio); + if (!head) + return; + bh = head; blocksize = bh->b_size; block_start = 0; diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 4bae9ccf5fe0..f14e77c4a6de 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2945,6 +2945,11 @@ static int ext4_da_do_write_end(struct address_space *mapping, bool disksize_changed = false; loff_t new_i_size; + if (unlikely(!folio_buffers(folio))) { + folio_unlock(folio); + folio_put(folio); + return -EIO; + } /* * block_write_end() will mark the inode as dirty with I_DIRTY_PAGES * flag, which all that's needed to trigger page writeback. -- 2.35.3 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] kernel/ext4: sanity check for NULL pointer after ext4_force_shutdown 2024-07-03 7:01 ` [PATCH] kernel/ext4: sanity check for NULL pointer after ext4_force_shutdown Wojciech Gładysz @ 2024-07-11 2:35 ` Theodore Ts'o 0 siblings, 0 replies; 12+ messages in thread From: Theodore Ts'o @ 2024-07-11 2:35 UTC (permalink / raw) To: syzbot+18df508cf00a0598d9a6, Wojciech Gładysz Cc: Theodore Ts'o, adilger.kernel, linux-ext4, linux-fsdevel, linux-kernel, syzkaller-bugs On Wed, 03 Jul 2024 09:01:12 +0200, Wojciech Gładysz wrote: > Test case: 2 threads write short inline data to a file. > In ext4_page_mkwrite the resulting inline data is converted. > Handling ext4_grp_locked_error with description "block bitmap > and bg descriptor inconsistent: X vs Y free clusters" calls > ext4_force_shutdown. The conversion clears > EXT4_STATE_MAY_INLINE_DATA but fails for > ext4_destroy_inline_data_nolock and ext4_mark_iloc_dirty due > to ext4_forced_shutdown. The restoration of inline data fails > for the same reason not setting EXT4_STATE_MAY_INLINE_DATA. > Without the flag set a regular process path in ext4_da_write_end > follows trying to dereference page folio private pointer that has > not been set. The fix calls early return with -EIO error shall the > pointer to private be NULL. > > [...] Applied, thanks! [1/1] kernel/ext4: sanity check for NULL pointer after ext4_force_shutdown commit: 83f4414b8f84249d538905825b088ff3ae555652 Best regards, -- Theodore Ts'o <tytso@mit.edu> ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <20240701082944.17441-1-wojciech.gladysz@infogain.com>]
* Re: [syzbot] [ext4?] general protection fault in __block_commit_write [not found] <20240701082944.17441-1-wojciech.gladysz@infogain.com> @ 2024-07-01 8:54 ` syzbot 0 siblings, 0 replies; 12+ messages in thread From: syzbot @ 2024-07-01 8:54 UTC (permalink / raw) To: linux-kernel, syzkaller-bugs, wojciech.gladysz Hello, syzbot tried to test the proposed patch but the build/boot failed: failed to checkout kernel repo https://linux.googlesource.com/linux/kernel/git/torvalds/linux/---: failed to run ["git" "fetch" "--force" "5efaa37364b8874e2c0b1d9108beeed3d23b6a7c" "---"]: exit status 129 error: unknown option `-' usage: git fetch [<options>] [<repository> [<refspec>...]] or: git fetch [<options>] <group> or: git fetch --multiple [<options>] [(<repository> | <group>)...] or: git fetch --all [<options>] -v, --verbose be more verbose -q, --quiet be more quiet --all fetch from all remotes --set-upstream set upstream for git pull/fetch -a, --append append to .git/FETCH_HEAD instead of overwriting --atomic use atomic transaction to update references --upload-pack <path> path to upload pack on remote end -f, --force force overwrite of local reference -m, --multiple fetch from multiple remotes -t, --tags fetch all tags and associated objects -n do not fetch all tags (--no-tags) -j, --jobs <n> number of submodules fetched in parallel --prefetch modify the refspec to place all refs within refs/prefetch/ -p, --prune prune remote-tracking branches no longer on remote -P, --prune-tags prune local tags no longer on remote and clobber changed tags --recurse-submodules[=<on-demand>] control recursive fetching of submodules --dry-run dry run --write-fetch-head write fetched references to the FETCH_HEAD file -k, --keep keep downloaded pack -u, --update-head-ok allow updating of HEAD ref --progress force progress reporting --depth <depth> deepen history of shallow clone --shallow-since <time> deepen history of shallow repository based on time --shallow-exclude <revision> deepen history of shallow clone, excluding rev --deepen <n> deepen history of shallow clone --unshallow convert to a complete repository --refetch re-fetch without negotiating common commits --update-shallow accept refs that update .git/shallow --refmap <refmap> specify fetch refmap -o, --server-option <server-specific> option to transmit -4, --ipv4 use IPv4 addresses only -6, --ipv6 use IPv6 addresses only --negotiation-tip <revision> report that we have only objects reachable from this object --negotiate-only do not fetch a packfile; instead, print ancestors of negotiation tips --filter <args> object filtering --auto-maintenance run 'maintenance --auto' after fetching --auto-gc run 'maintenance --auto' after fetching --show-forced-updates check for forced-updates on all updated branches --write-commit-graph write the commit-graph after fetching --stdin accept refspecs from stdin Tested on: commit: [unknown git tree: https://linux.googlesource.com/linux/kernel/git/torvalds/linux --- kernel config: https://syzkaller.appspot.com/x/.config?x=95dc1de8407c7270 dashboard link: https://syzkaller.appspot.com/bug?extid=18df508cf00a0598d9a6 compiler: userspace arch: arm64 patch: https://syzkaller.appspot.com/x/patch.diff?x=14a45512980000 ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <20240701083435.19182-1-wojciech.gladysz@infogain.com>]
* Re: [syzbot] [ext4?] general protection fault in __block_commit_write [not found] <20240701083435.19182-1-wojciech.gladysz@infogain.com> @ 2024-07-01 11:18 ` syzbot 0 siblings, 0 replies; 12+ messages in thread From: syzbot @ 2024-07-01 11:18 UTC (permalink / raw) To: linux-kernel, syzkaller-bugs, wojciech.gladysz Hello, syzbot has tested the proposed patch but the reproducer is still triggering an issue: BUG: unable to handle kernel paging request in __block_commit_write Unable to handle kernel paging request at virtual address dfff800000000004 KASAN: null-ptr-deref in range [0x0000000000000020-0x0000000000000027] Mem abort info: ESR = 0x0000000096000005 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x05: level 1 translation fault Data abort info: ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [dfff800000000004] address between user and kernel address ranges Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 13196 Comm: syz-executor.2 Not tainted 6.10.0-rc5-syzkaller-00071-g8fcad59bb267 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __block_commit_write+0x64/0x2b0 fs/buffer.c:2190 lr : __block_commit_write+0x3c/0x2b0 fs/buffer.c:2183 sp : ffff800098a87600 x29: ffff800098a87610 x28: dfff800000000000 x27: ffff0000df462ab0 x26: 0000000000000000 x25: dfff800000000000 x24: dfff800000000000 x23: fffffdffc3a94620 x22: 0000000000000020 x21: 0000000000000020 x20: 0000000000000040 x19: fffffdffc3a94600 x18: ffff800098a06dc0 x17: 0000000000022b0f x16: ffff80008aefdd0c x15: 00000000200000c0 x14: 1fffe0001d4a3004 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000001 x10: 0000000000ff0100 x9 : 0000000000000000 x8 : 0000000000000004 x7 : 0000000000000000 x6 : 0000000000000000 x5 : fffffdffc3a94600 x4 : 0000000000000020 x3 : 0000000000000020 x2 : 0000000000000040 x1 : 0000000000000020 x0 : fffffdffc3a94600 Call trace: __block_commit_write+0x64/0x2b0 fs/buffer.c:2190 block_write_end+0xb4/0x104 fs/buffer.c:2276 ext4_da_do_write_end fs/ext4/inode.c:2952 [inline] ext4_da_write_end+0x2bc/0xa34 fs/ext4/inode.c:3025 generic_perform_write+0x394/0x588 mm/filemap.c:4026 ext4_buffered_write_iter+0x2c0/0x4ec fs/ext4/file.c:299 ext4_file_write_iter+0x188/0x1780 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x828/0xc78 fs/read_write.c:590 ksys_write+0x15c/0x26c fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:652 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Code: 97f851e1 f94002da 91008356 d343fec8 (38796908) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: 97f851e1 bl 0xffffffffffe14784 4: f94002da ldr x26, [x22] 8: 91008356 add x22, x26, #0x20 c: d343fec8 lsr x8, x22, #3 * 10: 38796908 ldrb w8, [x8, x25] <-- trapping instruction Tested on: commit: 8fcad59b Merge remote-tracking branch 'tglx/devmsi-arm.. git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci console output: https://syzkaller.appspot.com/x/log.txt?x=157b91c6980000 kernel config: https://syzkaller.appspot.com/x/.config?x=d259bfe15c04340f dashboard link: https://syzkaller.appspot.com/bug?extid=18df508cf00a0598d9a6 compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 userspace arch: arm64 Note: no patches were applied. ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <20240701084553.24215-1-wojciech.gladysz@infogain.com>]
* Re: [syzbot] [ext4?] general protection fault in __block_commit_write [not found] <20240701084553.24215-1-wojciech.gladysz@infogain.com> @ 2024-07-01 11:32 ` syzbot 0 siblings, 0 replies; 12+ messages in thread From: syzbot @ 2024-07-01 11:32 UTC (permalink / raw) To: linux-kernel, syzkaller-bugs, wojciech.gladysz Hello, syzbot has tested the proposed patch and the reproducer did not trigger any issue: Reported-and-tested-by: syzbot+18df508cf00a0598d9a6@syzkaller.appspotmail.com Tested on: commit: 22a40d14 Linux 6.10-rc6 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=1508f869980000 kernel config: https://syzkaller.appspot.com/x/.config?x=f85e95b525c28b48 dashboard link: https://syzkaller.appspot.com/bug?extid=18df508cf00a0598d9a6 compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 userspace arch: arm64 patch: https://syzkaller.appspot.com/x/patch.diff?x=110d6885980000 Note: testing is done by a robot and is best-effort only. ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <20240701084542.24151-1-wojciech.gladysz@infogain.com>]
* Re: [syzbot] [ext4?] general protection fault in __block_commit_write [not found] <20240701084542.24151-1-wojciech.gladysz@infogain.com> @ 2024-07-01 11:46 ` syzbot 0 siblings, 0 replies; 12+ messages in thread From: syzbot @ 2024-07-01 11:46 UTC (permalink / raw) To: linux-kernel, syzkaller-bugs, wojciech.gladysz Hello, syzbot has tested the proposed patch but the reproducer is still triggering an issue: BUG: unable to handle kernel paging request in __block_commit_write Unable to handle kernel paging request at virtual address dfff800000000004 KASAN: null-ptr-deref in range [0x0000000000000020-0x0000000000000027] Mem abort info: ESR = 0x0000000096000005 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x05: level 1 translation fault Data abort info: ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [dfff800000000004] address between user and kernel address ranges Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP Modules linked in: CPU: 1 PID: 10062 Comm: syz-executor Not tainted 6.10.0-rc6-syzkaller-g22a40d14b572 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __block_commit_write+0x64/0x2b0 fs/buffer.c:2190 lr : __block_commit_write+0x3c/0x2b0 fs/buffer.c:2183 sp : ffff800098507600 x29: ffff800098507610 x28: dfff800000000000 x27: ffff0000dfe252b0 x26: 0000000000000000 x25: dfff800000000000 x24: dfff800000000000 x23: fffffdffc3a7e460 x22: 0000000000000020 x21: 0000000000000020 x20: 0000000000000040 x19: fffffdffc3a7e440 x18: 1fffe000367b23de x17: ffff80008efed000 x16: ffff80008af20c64 x15: 00000000200000c0 x14: 1fffe0001d3f2204 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000001 x10: 0000000000ff0100 x9 : 0000000000000000 x8 : 0000000000000004 x7 : 0000000000000000 x6 : 0000000000000000 x5 : fffffdffc3a7e440 x4 : 0000000000000020 x3 : 0000000000000020 x2 : 0000000000000040 x1 : 0000000000000020 x0 : fffffdffc3a7e440 Call trace: __block_commit_write+0x64/0x2b0 fs/buffer.c:2190 block_write_end+0xb4/0x104 fs/buffer.c:2276 ext4_da_do_write_end fs/ext4/inode.c:2952 [inline] ext4_da_write_end+0x2c4/0xa40 fs/ext4/inode.c:3025 generic_perform_write+0x394/0x588 mm/filemap.c:4026 ext4_buffered_write_iter+0x2c0/0x4ec fs/ext4/file.c:299 ext4_file_write_iter+0x188/0x1780 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x828/0xc78 fs/read_write.c:590 ksys_write+0x15c/0x26c fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:652 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:131 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:150 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Code: 97f8507d f94002da 91008356 d343fec8 (38796908) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: 97f8507d bl 0xffffffffffe141f4 4: f94002da ldr x26, [x22] 8: 91008356 add x22, x26, #0x20 c: d343fec8 lsr x8, x22, #3 * 10: 38796908 ldrb w8, [x8, x25] <-- trapping instruction Tested on: commit: 22a40d14 Linux 6.10-rc6 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=135d71c6980000 kernel config: https://syzkaller.appspot.com/x/.config?x=f85e95b525c28b48 dashboard link: https://syzkaller.appspot.com/bug?extid=18df508cf00a0598d9a6 compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40 userspace arch: arm64 Note: no patches were applied. ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-07-11 2:36 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-05 9:01 [syzbot] [ext4?] general protection fault in __block_commit_write syzbot
2024-05-20 1:52 ` syzbot
2024-07-01 8:29 ` [syzbot] [PATCH] handle EFSCORRUPTED, drop EXT4_STATE_MAY_INLINE_DATA sanity check syzbot
2024-07-01 8:34 ` [syzbot] Test head for issue syzbot
2024-07-01 8:45 ` [syzbot] [PATCH] handle EFSCORRUPTED, drop EXT4_STATE_MAY_INLINE_DATA sanity check syzbot
2024-07-01 8:46 ` [syzbot] Test head for issue syzbot
2024-07-03 7:01 ` [PATCH] kernel/ext4: sanity check for NULL pointer after ext4_force_shutdown Wojciech Gładysz
2024-07-11 2:35 ` Theodore Ts'o
[not found] <20240701082944.17441-1-wojciech.gladysz@infogain.com>
2024-07-01 8:54 ` [syzbot] [ext4?] general protection fault in __block_commit_write syzbot
[not found] <20240701083435.19182-1-wojciech.gladysz@infogain.com>
2024-07-01 11:18 ` syzbot
[not found] <20240701084553.24215-1-wojciech.gladysz@infogain.com>
2024-07-01 11:32 ` syzbot
[not found] <20240701084542.24151-1-wojciech.gladysz@infogain.com>
2024-07-01 11:46 ` syzbot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox