fs/ntfs3: Fix shift-out-of-bounds in ntfs_fill_super
PATCH 1/1 fs/ntfs3: Fix shift-out-of-bounds in ntfs_fill_super
From 2a433fb910874180a57199f31cf01f65e27dcb00 Mon Sep 17 00:00:00 2001
From: Konstantin Komarov <[email protected]>
Date: Fri, 30 Jun 2023 16:25:25 +0400
Subject: [PATCH 5.15.y] fs/ntfs3: Fix shift-out-of-bounds in ntfs_fill_super
commit 91a4b1ee78cb ("fs/ntfs3: Fix shift-out-of-bounds in ntfs_fill_super")
This patch is a backport and fixes an UBSAN warning about shift-out-of-bounds in ntfs_fill_super() function of the NTFS3 driver. The original code incorrectly calculated MFT record size, causing undefined behavior when performing bit shifts with values that exceed type limits.
The fix has been verified by executing the syzkaller reproducer test case. After applying this patch, the system successfully handles the test case without kernel panic or UBSAN warnings.
--- fs/ntfs3/ntfs_fs.h | 2 ++ fs/ntfs3/super.c | 63 +++++++++++++++++++++++++++++++++++----------- 2 files changed, 50 insertions(+), 15 deletions(-)
fs/ntfs3/ntfs_fs.h +2 -0
@@ -43,9 +43,11 @@ enum utf16_endian;#define MINUS_ONE_T ((size_t)(-1))/* Biggest MFT / smallest cluster */ #define MAXIMUM_BYTES_PER_MFT 4096 +#define MAXIMUM_SHIFT_BYTES_PER_MFT 12#define NTFS_BLOCKS_PER_MFT_RECORD (MAXIMUM_BYTES_PER_MFT / 512)#define MAXIMUM_BYTES_PER_INDEX 4096 +#define MAXIMUM_SHIFT_BYTES_PER_INDEX 12#define NTFS_BLOCKS_PER_INODE (MAXIMUM_BYTES_PER_INDEX / 512)/* NTFS specific error code when fixup failed. */
fs/ntfs3/super.c +48 -15
114 lines not on this page · raw message
Signature · 1 line
2.34.1
Sasha Levin
maintainer[ Sasha's backport helper bot ]
Hi,
Summary of potential issues:
⚠️ Found matching upstream commit but patch is missing proper reference to it
Found matching upstream commit: 91a4b1ee78cb100b19b70f077c247f211110348f
WARNING: Author mismatch between patch and found commit:
Backport author: Miguel =?iso-8859-1?Q?Garc=EDa?=<[email protected]> Commit author: Konstantin Komarov<[email protected]>
Status in newer kernel trees:
6.13.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1) 6.1.y | Not found 5.4.y | Not found
Note: The patch differs from the upstream commit:
---
1: 91a4b1ee78cb1 < -: ------------- fs/ntfs3: Fix shift-out-of-bounds in ntfs_fill_super -: ------------- > 1: da31bbdbd8964 fs/ntfs3: Fix shift-out-of-bounds in ntfs_fill_super
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.15.y | Success | Success |