From: liubaolin <liubaolin12138@163.com>
To: Namjae Jeon <linkinjeon@kernel.org>
Cc: hyc.lee@gmail.com, ntfs@lists.linux.dev,
linux-kernel@vger.kernel.org, Baolin Liu <liubaolin@kylinos.cn>
Subject: Re: [PATCH 1/2] ntfs: implement fileattr_get and fileattr_set
Date: Wed, 2 Sep 2026 14:44:45 +0800 [thread overview]
Message-ID: <9105aa5d-7390-490a-8336-5dba6b97895b@163.com> (raw)
In-Reply-To: <CAKYAXd94Hy-cEXAsfibh+B66774rg9wALwPWGfir91dqJWTtgg@mail.gmail.com>
在 2026/9/2 09:22, Namjae Jeon 写道:
> On Tue, Sep 1, 2026 at 6:15 PM Baolin Liu <liubaolin12138@163.com> wrote:
>>
>> From: Baolin Liu <liubaolin@kylinos.cn>
>>
>> Wire up the fileattr inode operations so that lsattr(1) and chattr(1)
>> work on ntfs.
>>
>> fileattr_get reports the compressed and encrypted state of the attribute
>> and the immutable and append-only flags, the same states ntfs_getattr()
>> already reports through STATX_ATTR_*.
>>
>> fileattr_set accepts only FS_IMMUTABLE_FL and FS_APPEND_FL. Compression
>> and encryption are rejected because changing them would require
>> rewriting the attribute data. Both accepted flags go to inode->i_flags,
>> so the VFS enforces them.
>>
>> Neither flag has an on-disk representation of its own, so a value set
>> through fileattr_set only lives for the lifetime of the mount. Note also
>> that S_IMMUTABLE is re-derived on every mount, from FILE_ATTR_SYSTEM when
>> mounted with sys_immutable and unconditionally for system files, so
>> clearing it on such a file does not survive a remount either.
> NTFS forces S_IMMUTABLE on system metadata files such as $MFT, but
> this patch allows userspace to clear that protection. The patch should
> reject clearing immutable for these files and for files made immutable
> by the sys_immutable mount option.
Hi Namjae,
You are right, that is a hole. The driver forces S_IMMUTABLE on those
files for a reason and userspace should not be able to clear it.
I will add the check and send a v2.
Thanks for the review.
Thanks,
Baolin
next prev parent reply other threads:[~2026-09-02 6:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 9:15 [PATCH 0/2] ntfs: wire up the fileattr API Baolin Liu
2026-09-01 9:15 ` [PATCH 1/2] ntfs: implement fileattr_get and fileattr_set Baolin Liu
2026-09-02 1:22 ` Namjae Jeon
2026-09-02 6:44 ` liubaolin [this message]
2026-09-02 2:00 ` Hyunchul Lee
2026-09-02 7:25 ` liubaolin
2026-09-01 9:15 ` [PATCH 2/2] ntfs: support the nodump flag Baolin Liu
2026-09-02 1:44 ` [PATCH 0/2] ntfs: wire up the fileattr API Namjae Jeon
2026-09-02 7:26 ` liubaolin
2026-09-08 8:31 ` liubaolin
2026-09-09 4:48 ` 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=9105aa5d-7390-490a-8336-5dba6b97895b@163.com \
--to=liubaolin12138@163.com \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liubaolin@kylinos.cn \
--cc=ntfs@lists.linux.dev \
/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
all inboxes | Powered by JetHome®