From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BED123644D4 for ; Sun, 2 Aug 2026 05:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785648759; cv=none; b=Ef1zrptHZOke//gcsONq0d0vBUvzbw7GG609h3Fd3pTV70KrW/OODPwE9zS3HeeNdJiUqivu7gIgur38c8jD9o/W009jPeDkK0XBgEcVzJnyvEAwMsTdMplqc/U1bWgINXC8B/eN7LEVUMOYgW8VziL21B6EmaR7Lrt8HMe7lGo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785648759; c=relaxed/simple; bh=RYwRxxTKeppZYcgis/kjMHl2/XDd66PfILfI7pH/5gU=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=AUxlG/cGJGVEu05KdttoOQZAqPkIEtptRyN3Y9OyIfgDMQnDorMirzO7OErgl4Aj30xZc7oyFJlyh+acY4LH5Unu/H0HyaUszY8uRGvNoRr9gGrC2c9i+02WZ5o8Mrdeq6eE+zc5wpeS3mEKVwxyZM2//jQ6dA9OfN6k6oNWnEs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.161.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-6ab0ed783aeso3067835eaf.1 for ; Sat, 01 Aug 2026 22:32:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785648756; x=1786253556; h=content-type:to:from:subject:message-id:in-reply-to:date :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=engFeE9wFfjKAzjjJf/rMOK56Q9MtuzB5JsUa7SLXvk=; b=YNfGL4Hfu3SbTlV7V4OKHRGHUxM/TaKbRE93bA/YlEPwwhLZX2YN1JXWHj5xMQrUmF IpiWmkXbIN7SA0kSqUrQHB4XU88yAeoz/hnm5/nfxYQV553PNThVMvqeRlj3qPaVG9/d 6Wox9s70HgjZKGfnqhh/QW8YT34HDqGq+mNMo199sQRkckA5gu21QENpo8rbvWOTEeX2 zsNImCk77F3eDMt6BCGN7QBD69/R/FdlxWjERjhq+reU+/vf2dBnqyOoXZGWCLKwmuj/ h0RYNAYOLlyCeLKKh90Zy1lCOZuNLq9EIjs1AN/8+UqwKXkB9zOAA17UkjAFZycpylxh divQ== X-Gm-Message-State: AOJu0YxVVy3Ri1mLryWp620OrXW54MS4A7GzMpT5pJsI0cGBXsqKk9OO OY7MIRXFHkfWGnxvtTiDFMp0+EWy+p24OHEE8vPbU5rQurUiXlbxGiJ/u/d+DCxNg2Tzi3sYYVS Mqi24z3sNxD4iqNHScZdusRMhp02dRTri86cSEPaAyLZNw5KgNp8e99o7gm4= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:a0e:b0:6a3:6f5d:4d6c with SMTP id 006d021491bc7-6ae382cbd9bmr9889743eaf.6.1785648756747; Sat, 01 Aug 2026 22:32:36 -0700 (PDT) Date: Sat, 01 Aug 2026 22:32:36 -0700 In-Reply-To: <69594c50.050a0220.a1b6.0374.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6a6ed674.1aa927e4.17d4bf.0016.GAE@google.com> Subject: Forwarded: Re: [syzbot] [kernfs?] INFO: task hung in do_rmdir (7) From: syzbot To: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org. *** Subject: Re: [syzbot] [kernfs?] INFO: task hung in do_rmdir (7) Author: matthias.goergens@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master From: Matthias Goergens Subject: [PATCH] ext4: stop retrying saturated xattr cache entries ext4_xattr_block_set() retries when a cache entry selected for reuse has a saturated reference count after taking the buffer lock. The retry returns to the mbcache lookup without making that entry ineligible, so it can select the same unusable entry indefinitely. A task spinning there can hold the parent directory's i_rwsem and leave concurrent rmdir callers blocked. Normally a reusable entry has a reference count below EXT4_XATTR_REFCOUNT_MAX because the count and MBE_REUSABLE_B are updated under the same buffer lock. A corrupted filesystem can violate that invariant. The syzbot reproducer reports allocator and xattr corruption before triggering this retry loop. Check the untrusted on-disk count before incrementing it, avoiding overflow, and clear MBE_REUSABLE_B when it is already saturated. The next lookup then skips the entry that was just proven unusable. This mirrors the normal transition at EXT4_XATTR_REFCOUNT_MAX; the release path marks the entry reusable again if the count later falls below the limit. Using the same QEMU harness and guest parameters, current unpatched Linux hung in 6 of 8 420-second trials with the do_rmdir signature; representative NMI backtraces caught the owner spinning in ext4_xattr_block_set(). The patched kernel completed 20 of 20 trials without a hung-task report. The final four trials exercised the reviewed overflow-safe form of the change. Reported-by: syzbot+e68dbebd9617a9250e8d@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=e68dbebd9617a9250e8d Fixes: 65f8b80053a1 ("ext4: fix race when reusing xattr blocks") Cc: stable@vger.kernel.org Signed-off-by: Matthias Goergens --- fs/ext4/xattr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 982a1f831e228..6f4215d4806de 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2075,12 +2075,13 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, * stable so we can check the additional * reference fits. */ - ref = le32_to_cpu(BHDR(new_bh)->h_refcount) + 1; - if (ref > EXT4_XATTR_REFCOUNT_MAX) { + ref = le32_to_cpu(BHDR(new_bh)->h_refcount); + if (ref >= EXT4_XATTR_REFCOUNT_MAX) { /* * Undo everything and check mbcache * again. */ + clear_bit(MBE_REUSABLE_B, &ce->e_flags); unlock_buffer(new_bh); dquot_free_block(inode, EXT4_C2B(EXT4_SB(sb), @@ -2091,6 +2092,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, new_bh = NULL; goto inserted; } + ref++; BHDR(new_bh)->h_refcount = cpu_to_le32(ref); if (ref == EXT4_XATTR_REFCOUNT_MAX) clear_bit(MBE_REUSABLE_B, &ce->e_flags);