From nobody Thu Apr 2 20:28:04 2026 Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) (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 00C263FF8B7 for ; Thu, 26 Mar 2026 14:50:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774536655; cv=none; b=DLlJq8AuvY5p3RX7u4nFHU9cTIPsnbT79qmy+47ZrNvvLHMErBk11g5vg/tI95ibzIXGn4aKAVBEXA02EWUVSYg80XyFwNGF8e5hq00HlnEUDYDgbOlfWTPxmgJrq17jLCYhU5rhbNHN22MXTCGjwMpSOMsHT3ANe4DAEFC5Rns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774536655; c=relaxed/simple; bh=pEa+scq47s2B6xCeJeACs/6O4FwGPISeMM8AVTRV2I8=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=V03e29+ZxP0dFPw7QNKNv78+TTzdkGU7cmJA0p3hw9Z10HLJV3iiYG+2lpFpJvdsgPfYcBkPNVwlygRN7A/zrnZztqV/qWCaKTu54YaK/iO25X/Kg+nlPBgRX2LDaQrkvm7rM4XlNKA6+149zDWXO7H5MBVOEkZjSWfou2Dgaso= 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.72 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-f72.google.com with SMTP id 006d021491bc7-67e0f16975dso1721568eaf.0 for ; Thu, 26 Mar 2026 07:50:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774536652; x=1775141452; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cU6FvXKdDqZyRL1pY5WGKk8z30idUsvQdtdjFbLFyGw=; b=Y8yRBlV7LulVNL3PIJpETC7DGs1ijVY4ZZDH/H8+Rvp4nEonIQfG9+W2D1zQvml0Gv EaSnqINYLx2ASQnAtgMYVa9hW8CCTrMVLJ0g2uB6/UY3Q55hQUndtltl6MhYWezJfH4/ uxMLvA9v1QBNjHv9bQJb0vbyWRZoCi1hov20KA1rhkLjrK/VquQTSuaoh4Uqw2g9hron uxgWAbrzWEQmhmU49IKI4K+43/vvNrWZulZSEX1QQKJUUolsvPFKMUv9XDKS1tMU0xUW yzjstNCUp+7sU0Bebh6FY5ZK9c+G2wx0qc7YQ6QQG8MIbPFgm3eubGLnsI2b4bzwwQx3 2cPA== X-Gm-Message-State: AOJu0YwSHyQqqgoDuAxJWRWrPQM2UqGyuQ3AxPDDZoV88/qc0jw6GWxD 7xgXqXKvzck1nfpEaQFnOCkEghznofI468l7eNJc5LIWR0d9EavtjEMhzqT4/Q5P2mr5/Y3g3hF fVar5z+gxTklGBaJ7MoGtH5o+x5bSiOjGsKk84VIxZmDQ6Ul/9DyAWUkBrU0= 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:4dc2:b0:67d:f902:ef6a with SMTP id 006d021491bc7-67dff37be60mr4096168eaf.7.1774536652694; Thu, 26 Mar 2026 07:50:52 -0700 (PDT) Date: Thu, 26 Mar 2026 07:50:52 -0700 In-Reply-To: <699b9b6f.a70a0220.2c38d7.0189.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69c547cc.a70a0220.3d5e5.0004.GAE@google.com> Subject: Forwarded: [PATCH] ext4: fix bounds check in check_xattrs() to account for IS_LAST_ENTRY() read From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] ext4: fix bounds check in check_xattrs() to account for IS= _LAST_ENTRY() read Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master The bounds check for the next xattr entry in check_xattrs() uses (void *)next >=3D end, which allows next to point within sizeof(u32) bytes of end. On the next iteration, IS_LAST_ENTRY() reads 4 bytes from next via *(__u32 *)(entry), which can overrun the valid xattr region and access freed memory. This is triggered when mounting a corrupted ext4 filesystem where the inode's i_extra_isize leaves insufficient space for inline xattr entries. The ACL permission check calls ext4_get_acl() -> ext4_xattr_ibody_get() -> xattr_find_entry(), which reads past the inode buffer. Fix this by changing the check to (void *)next + sizeof(u32) > end, ensuring there is always enough space for the IS_LAST_ENTRY() read on the subsequent iteration. Reported-by: syzbot+fb32afec111a7d61b939@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3Dfb32afec111a7d61b939 Link: https://lore.kernel.org/all/20260224231429.31361-1-kartikey406@gmail.= com/T/ [v1] Signed-off-by: Deepanshu Kartikey --- v2: Move the fix to check_xattrs() as suggested by Ted Ts'o, instead of adding a separate check in ext4_xattr_ibody_get(). --- fs/ext4/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 7bf9ba19a89d..c6205b405efe 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -226,7 +226,7 @@ check_xattrs(struct inode *inode, struct buffer_head *b= h, /* Find the end of the names list */ while (!IS_LAST_ENTRY(e)) { struct ext4_xattr_entry *next =3D EXT4_XATTR_NEXT(e); - if ((void *)next >=3D end) { + if ((void *)next + sizeof(u32) > end) { err_str =3D "e_name out of bounds"; goto errout; } --=20 2.43.0