From: DaeMyung Kang <charsyam@gmail.com>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: Hyunchul Lee <hyc.lee@gmail.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
DaeMyung Kang <charsyam@gmail.com>
Subject: [PATCH v6 1/4] ntfs: reject non-resident records for resident-only attributes
Date: Tue, 9 Jun 2026 00:49:14 +0900 [thread overview]
Message-ID: <20260608154917.2703739-2-charsyam@gmail.com> (raw)
In-Reply-To: <20260608154917.2703739-1-charsyam@gmail.com>
The shared lookup-time attribute validator rejects non-resident
$FILE_NAME and $VOLUME_NAME records because their formats require
resident values and callers handle returned records as resident
attributes. Other resident-only attribute types still pass through the
generic non-resident mapping-pairs checks.
That leaves real resident/non-resident union confusion paths. Inode load
looks up $STANDARD_INFORMATION and then reads data.resident.value_offset
without checking a->non_resident. ntfs_inode_sync_standard_information()
does the same when updating the standard information value.
ntfs_write_volume_flags() also looks up $VOLUME_INFORMATION and reads
data.resident.value_offset directly. $INDEX_ROOT callers in dir.c and
index.c depend on the same lookup contract before consuming the resident
index root value.
Reject non-resident records for all resident-only attribute types in the
shared validator. Keep the existing $FILE_NAME and $VOLUME_NAME behavior,
but factor it through a helper and extend it to
$STANDARD_INFORMATION, $OBJECT_ID, $VOLUME_INFORMATION, $INDEX_ROOT, and
$EA_INFORMATION. For $OBJECT_ID and $EA_INFORMATION this is contract
hardening for resident-only formats; this patch only rejects the
non-resident form and does not add new resident value validation for
those types.
Signed-off-by: DaeMyung Kang <charsyam@gmail.com>
---
fs/ntfs/attrib.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index 5e1ad1cd0118..1254fbe7666e 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -596,6 +596,22 @@ static u32 ntfs_resident_attr_min_value_length(const __le32 type)
}
}
+static bool ntfs_attr_type_is_resident_only(const __le32 type)
+{
+ switch (type) {
+ case AT_STANDARD_INFORMATION:
+ case AT_FILE_NAME:
+ case AT_OBJECT_ID:
+ case AT_VOLUME_NAME:
+ case AT_VOLUME_INFORMATION:
+ case AT_INDEX_ROOT:
+ case AT_EA_INFORMATION:
+ return true;
+ default:
+ return false;
+ }
+}
+
static bool ntfs_file_name_attr_value_is_valid(const u8 *value, const u32 value_length)
{
const struct file_name_attr *fn;
@@ -666,7 +682,7 @@ static bool ntfs_attr_value_is_valid(struct ntfs_volume *vol,
u32 min_len;
if (a->non_resident) {
- if (a->type == AT_FILE_NAME || a->type == AT_VOLUME_NAME)
+ if (ntfs_attr_type_is_resident_only(a->type))
goto corrupt;
if (!ntfs_non_resident_attr_value_is_valid(a))
goto corrupt;
--
2.43.0
next prev parent reply other threads:[~2026-06-08 15:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 15:49 [PATCH v6 0/4] ntfs: finish resident attribute lookup validation DaeMyung Kang
2026-06-08 15:49 ` DaeMyung Kang [this message]
2026-06-08 23:56 ` [PATCH v6 1/4] ntfs: reject non-resident records for resident-only attributes Hyunchul Lee
2026-06-08 15:49 ` [PATCH v6 2/4] ntfs: grow index root value before reparent header update DaeMyung Kang
2026-06-08 23:56 ` Hyunchul Lee
2026-06-08 15:49 ` [PATCH v6 3/4] ntfs: update index root allocated size before shrink DaeMyung Kang
2026-06-08 23:57 ` Hyunchul Lee
2026-06-08 15:49 ` [PATCH v6 4/4] ntfs: validate resident index root values on lookup DaeMyung Kang
2026-06-08 23:58 ` Hyunchul Lee
2026-06-09 9:25 ` [PATCH v6 0/4] ntfs: finish resident attribute lookup validation Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260608154917.2703739-2-charsyam@gmail.com \
--to=charsyam@gmail.com \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox