WARNING in start_this_handle

Status: upstream: reported C repro on 2026/11/13 08:29
Subsystems: ext4
Labels: prio:low
[Documentation on labels]
Reported-by: syzbot+25d45c0bd716f2b794a7@syzkaller.appspotmail.com
First crash: 2h21m, last: 30m
✨ AI-generated root cause summary:

When setting a large extended attribute on an ext4 filesystem formatted with a 1KB block size, the ea_inode feature, and a minimum-sized JBD2 journal (1024 blocks), __ext4_xattr_set_credits() calculates a worst-case credit requirement of up to 341 blocks (accounting for creating a new ea_inode, dereferencing an old ea_inode, and metadata updates). However, for a 1024-block journal, jbd2_max_user_trans_buffers() limits transaction payload credits to 334 blocks. Because ext4 does not validate at mount time that the journal is large enough to support the ea_inode feature nor limits requested credits in ext4_xattr_set(), jbd2__journal_start() requests more credits than the journal allows, triggering a WARN_ON(1) in start_this_handle() and returning -ENOSPC.

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit 7e1392a42ea2:

Bug Analysis & Technical Explanation

Overview and Context

The reported kernel warning occurs in fs/jbd2/transaction.c:334 inside start_this_handle():

JBD2: syz.0.0 wants too many credits credits:341 rsv_credits:0 max:334
WARNING: fs/jbd2/transaction.c:334 at start_this_handle+0x1e3f/0x21f0 fs/jbd2/transaction.c:334

This warning is triggered when a subsystem attempts to start a JBD2 journal handle requesting more credits than the maximum transaction payload capacity (jbd2_max_user_trans_buffers(journal)).

Root Cause Mechanism

  1. Journal Size and Maximum Credits Computation (fs/jbd2/journal.c, fs/jbd2/transaction.c):

    • The filesystem was formatted with a 1024-byte block size and the minimum allowable JBD2 journal length: JBD2_MIN_JOURNAL_BLOCKS = 1024 blocks (include/linux/jbd2.h:66).
    • In JBD2, j_max_transaction_buffers is computed by jbd2_journal_get_max_txn_bufs() as: $$\lfloor (j_total_len - j_fc_wbufsize) / 3 \rfloor = \lfloor 1024 / 3 \rfloor = 341 \text{ blocks}$$
    • JBD2 further deducts transaction overhead buffers (1 commit block + transaction descriptor blocks): j_transaction_overhead_buffers = 7 blocks.
    • Consequently, jbd2_max_user_trans_buffers(journal) (fs/jbd2/transaction.c:191-195) is: $$341 - 7 = 334 \text{ blocks}$$
    • JBD2 enforces this as a hard invariant in start_this_handle() (fs/jbd2/transaction.c:328-336): if any handle requests blocks + rsv_blocks > jbd2_max_user_trans_buffers(journal), a warning is issued (WARN_ON(1)) and -ENOSPC is returned.
  2. Credit Calculation in __ext4_xattr_set_credits() (fs/ext4/xattr.c:950-1031):

    • In ext4_xattr_set() (fs/ext4/xattr.c:2552-2557), ext4_xattr_set_credits() calls __ext4_xattr_set_credits() to compute the required journal credits for a setxattr operation:
      • Base credits for owner inode and xattr block updates: 7 credits.
      • With the ea_inode feature enabled, storing a large extended attribute (value_len = 65296 bytes, near XATTR_SIZE_MAX = 65536) requires allocating a new ea_inode. For a 1KB block filesystem, blocks = ((value_len + blocksize - 1) >> blkbits) + 1 = 65. Credits allocated: 4 (metadata) + 65 * 2 (bitmaps & group descriptors) + 65 (data blocks) = 199 credits.
      • When flags does not specify XATTR_CREATE (is_create = false), ext4_xattr_set() must also account for dereferencing/freeing a potential old ea_inode of up to XATTR_SIZE_MAX: blocks = (65536 >> 10) + 1 = 65. Credits allocated: 4 + 65 * 2 = 134 credits.
      • Adding an additional credit for an existing referenced ea_inode or quota update yields: $$7 + 199 + 134 + 1 = 341 \text{ credits}$$
  3. The Defect:

    • __ext4_xattr_set_credits() calculates a valid worst-case credit requirement (341 credits) that strictly exceeds the maximum transaction size allowed by the journal (334 credits).
    • Ext4 does not validate during mount (fs/ext4/super.c) that the journal is sufficiently large to accommodate the worst-case transaction requirements of the enabled ea_inode feature on a 1KB block filesystem.
    • Nor does ext4_xattr_set() / __ext4_xattr_set_credits() check jbd2_max_user_trans_buffers() or split/cap large xattr journal transactions before calling ext4_journal_start().
    • As a result, ext4_journal_start() calls jbd2__journal_start(), which encounters 341 > 334 in start_this_handle(), triggering the WARN_ON(1).
▶ ▼ ✨ AI Jobs (1)
ID Workflow Result Correct Bug Created Started Finished Revision
5ec45171 assessment-security DenialOfService: ❌ Exploitable: ❌ FilesystemTrigger: ✅ FuzzingArtifact: ❌ MemoryCorruption: ❌ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ WARNING in start_this_handle 2026/11/13 06:38 2026/11/13 06:38 2026/11/13 07:13 26b2fee0
▶ ▼ Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 WARNING in start_this_handle origin:lts-only -1 syz, C error 7 9h26m 88d 0/3 upstream: reported C repro on 2026/08/17 06:22
linux-5.15 WARNING in start_this_handle origin:lts-only -1 syz, C error 9 9h00m 305d 0/3 upstream: reported C repro on 2026/01/11 16:02

Sample crash report:
ext4 filesystem being mounted at /0/file0 supports timestamps until 2038-01-19 (0x7fffffff)
JBD2: syz.0.17 wants too many credits credits:341 rsv_credits:0 max:334
------------[ cut here ]------------
1
WARNING: fs/jbd2/transaction.c:334 at start_this_handle+0x1e3f/0x21f0 fs/jbd2/transaction.c:334, CPU#0: syz.0.17/5590
Modules linked in:
CPU: 0 UID: 0 PID: 5590 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:start_this_handle+0x1e3f/0x21f0 fs/jbd2/transaction.c:334
Code: 8b 35 ed a2 2f 12 48 81 c6 20 09 00 00 48 c7 c7 c0 8c 48 8c 48 8b 94 24 90 00 00 00 48 8b 4c 24 38 41 89 d8 e8 62 c5 74 fe 90 <0f> 0b 90 b8 e4 ff ff ff e9 35 fe ff ff e8 8f 34 16 ff eb 05 e8 88
RSP: 0018:ffffc90001dc7500 EFLAGS: 00010246
RAX: 0000000000000047 RBX: 000000000000014e RCX: 0d7a67c029606f00
RDX: 0000000000000000 RSI: 8000000000000000 RDI: 0000000000000000
RBP: ffffc90001dc77e0 R08: ffffc90001dc7287 R09: 1ffff920003b8e50
R10: dffffc0000000000 R11: fffff520003b8e51 R12: 0000000000000000
R13: 0000000000000c40 R14: dffffc0000000000 R15: 0000000000000155
FS:  000055557077c500(0000) GS:ffff88808a9f6000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000013000 CR3: 0000000041ad4000 CR4: 0000000000352ef0
Call Trace:
 <TASK>
 jbd2__journal_start+0x2c0/0x5d0 fs/jbd2/transaction.c:502
 __ext4_journal_start_sb+0x205/0x780 fs/ext4/ext4_jbd2.c:126
 __ext4_journal_start fs/ext4/ext4_jbd2.h:238 [inline]
 ext4_xattr_set+0x221/0x340 fs/ext4/xattr.c:2557
 __vfs_setxattr+0x442/0x480 fs/xattr.c:223
 __vfs_setxattr_noperm+0x12a/0x660 fs/xattr.c:257
 vfs_setxattr+0x151/0x370 fs/xattr.c:344
 do_setxattr fs/xattr.c:662 [inline]
 filename_setxattr+0x296/0x630 fs/xattr.c:690
 path_setxattrat+0x408/0x450 fs/xattr.c:734
 __do_sys_setxattr fs/xattr.c:768 [inline]
 __se_sys_setxattr fs/xattr.c:764 [inline]
 __x64_sys_setxattr+0xbc/0xe0 fs/xattr.c:764
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f918c1a94d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff574286f8 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc
RAX: ffffffffffffffda RBX: 00007f918c425fa0 RCX: 00007f918c1a94d9
RDX: 0000200000003d00 RSI: 0000200000003cc0 RDI: 0000200000003c80
RBP: 00007f918c23804e R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000ff10 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f918c425fac R14: 00007f918c425fa0 R15: 00007f918c425fa0
 </TASK>

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/13 08:28 upstream 7e1392a42ea2 26b2fee0 .config console log report syz / log C [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci-snapshot-upstream-root WARNING in start_this_handle
2026/11/13 06:37 upstream 7e1392a42ea2 26b2fee0 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root WARNING in start_this_handle
* Struck through repros no longer work on HEAD.