From: Viacheslav Dubeyko <slava@dubeyko.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
Yangtao Li <frank.li@vivo.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH] hfsplus: Verify inode mode when loading from disk
Date: Fri, 14 Nov 2025 11:29:39 -0800 [thread overview]
Message-ID: <a4fee92f0ae18fd66d32c2ffc6cf731d1a4d498d.camel@dubeyko.com> (raw)
In-Reply-To: <125c234e-9ffb-4372-bcc4-3a1fbc93825b@I-love.SAKURA.ne.jp>
On Sat, 2025-11-15 at 00:35 +0900, Tetsuo Handa wrote:
> Ping?
>
You checks the inode->i_mode in the patch. And logical place for this
check is hfsplus_get_perms() method [1] because all mode checks are
made there before assigning to inode->i_mode. So, you simply need to
add this check there and to check the return value of
hfsplus_get_perms() in hfsplus_cat_read_inode().
static void hfsplus_get_perms(struct inode *inode,
struct hfsplus_perm *perms, int dir)
{
struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);
u16 mode;
mode = be16_to_cpu(perms->mode);
<skipped>
if (dir) {
mode = mode ? (mode & S_IALLUGO) : (S_IRWXUGO & ~(sbi-
>umask));
mode |= S_IFDIR;
} else if (!mode)
mode = S_IFREG | ((S_IRUGO|S_IWUGO) & ~(sbi->umask));
<-- You simply can implement your check here.
inode->i_mode = mode;
<skipped>
}
It simple modification from my point of view. And I don't quite follow
to your difficulties to move your check into hfsplus_get_perms().
Thanks,
Slava.
[1]
https://elixir.bootlin.com/linux/v6.18-rc5/source/fs/hfsplus/inode.c#L183
> Now that BFS got
> https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/commit/?h=vfs.fixes&id=34ab4c75588c07cca12884f2bf6b0347c7a13872
> ,
> HFS+ became the last filesystem that has not come to an answer.
>
> On 2025/10/08 20:21, Tetsuo Handa wrote:
> > > As far as I can see, we operate by inode->i_mode here. But if
> > > inode
> > > mode has been corrupted on disk, then we assigned wrong value
> > > before.
> > > And HFS+ has hfsplus_get_perms() method that assigns perms->mode
> > > to
> > > inode->i_mode. So, I think we need to rework hfsplus_get_perms()
> > > for
> > > checking the correctness of inode mode before assigning it to
> > > inode->
> > > i_mode.
> >
> > Then, can you give us an authoritative explanation, with historical
> > part
> > fully understood?
next prev parent reply other threads:[~2025-11-14 19:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-04 13:34 [PATCH] hfsplus: Verify inode mode when loading from disk Tetsuo Handa
2025-10-07 14:22 ` Viacheslav Dubeyko
2025-10-08 11:21 ` Tetsuo Handa
2025-11-14 15:35 ` Tetsuo Handa
2025-11-14 19:29 ` Viacheslav Dubeyko [this message]
2025-11-15 9:18 ` [PATCH v2] " Tetsuo Handa
2025-11-17 22:52 ` Viacheslav Dubeyko
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=a4fee92f0ae18fd66d32c2ffc6cf731d1a4d498d.camel@dubeyko.com \
--to=slava@dubeyko.com \
--cc=frank.li@vivo.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/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;
as well as URLs for NNTP newsgroup(s).