From: "George Vernon" <contact@gvernon.com>
To: "Tetsuo Handa" <penguin-kernel@i-love.sakura.ne.jp>,
"Viacheslav Dubeyko" <Slava.Dubeyko@ibm.com>
Cc: syzbot+97e301b4b82ae803d21b@syzkaller.appspotmail.com,
glaubitz@physik.fu-berlin.de, frank.li@vivo.com,
slava@dubeyko.com, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v4] hfs: Validate CNIDs in hfs_read_inode
Date: Thu, 19 Mar 2026 12:26:37 +0000 [thread overview]
Message-ID: <070d92639460b672a174d6a11b1e7d0b099b18cb@gvernon.com> (raw)
In-Reply-To: <f84ae595-a084-4ded-9f99-964752a69f7d@I-love.SAKURA.ne.jp>
March 19, 2026 at 9:57 AM, "Tetsuo Handa" <penguin-kernel@i-love.sakura.ne.jp mailto:penguin-kernel@i-love.sakura.ne.jp?to=%22Tetsuo%20Handa%22%20%3Cpenguin-kernel%40i-love.sakura.ne.jp%3E > wrote:
>
> On 2026/03/19 7:49, George Anthony Vernon wrote:
>
> >
> > Tetsuo, what do you think about doing your check inside
> > hfs_cat_find_brec? Something a bit like this:
> >
> Currently hfs_cat_find_brec() is called by only hfs_fill_super()
> with cnid == HFS_ROOT_CNID. Are you planning to add more callers?
>
> If no, my patch
>
> - if (rec.type != HFS_CDR_DIR)
> + if (rec.type != HFS_CDR_DIR || rec.dir.DirID != cpu_to_be32(HFS_ROOT_CNID))
>
> is sufficient.
I'm trying to write a patch Slava will accept, maybe I didn't fully understand what he wanted but I think he wanted to fix hfs_cat_find_brec() so it should not return an incorrect cat record.
>
> If yes, your
>
> >
> > + if (fd->entrylength > sizeof(rec)) {
> > + pr_err("Bad catalog entry size\n");
> > + return -EIO;
> > + }
> >
> part is not compatible with https://elixir.bootlin.com/linux/v7.0-rc4/source/fs/hfs/super.c#L359
> which requires that fd->entrylength is exactly 70 bytes in order to make sure that rec.dir is
> fully initialized.
>
> sizeof(struct hfs_cat_file) = 102
> sizeof(struct hfs_cat_dir) = 70
> sizeof(struct hfs_cat_thread) = 46
>
This can be changed.
> Even if you are planning to add more callers, my patch will be easier to apply to stable.
>
Yes your patch will be easier to backport, but then again HFS has had minimal churn in recent years, so I think this version will still be simple enough, only maybe the interface for debug prints has changed that I can think of.
Thanks,
George
next prev parent reply other threads:[~2026-03-19 12:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 21:13 George Anthony Vernon
2026-03-12 10:45 ` Tetsuo Handa
2026-03-12 23:13 ` Viacheslav Dubeyko
2026-03-13 11:03 ` Tetsuo Handa
2026-03-13 18:40 ` Viacheslav Dubeyko
2026-03-14 6:35 ` Tetsuo Handa
2026-03-16 21:50 ` Viacheslav Dubeyko
2026-03-18 0:37 ` George Anthony Vernon
2026-03-18 2:02 ` Viacheslav Dubeyko
2026-03-18 22:49 ` George Anthony Vernon
2026-03-19 9:57 ` Tetsuo Handa
2026-03-19 12:26 ` George Vernon [this message]
2026-03-20 0:32 ` Tetsuo Handa
2026-05-14 7:34 ` [PATCH v7] hfs: validate record ID against requested CNID in hfs_cat_find_brec() Tetsuo Handa
2026-05-15 21:10 ` Viacheslav Dubeyko
2026-05-16 6:17 ` Tetsuo Handa
2026-05-19 21:09 ` Viacheslav Dubeyko
2026-03-18 10:42 ` [PATCH v4] hfs: Validate CNIDs in hfs_read_inode Tetsuo Handa
2026-03-18 0:10 ` George Anthony Vernon
2026-03-18 8:16 ` Tetsuo Handa
2026-03-12 23:07 ` 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=070d92639460b672a174d6a11b1e7d0b099b18cb@gvernon.com \
--to=contact@gvernon.com \
--cc=Slava.Dubeyko@ibm.com \
--cc=frank.li@vivo.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=slava@dubeyko.com \
--cc=syzbot+97e301b4b82ae803d21b@syzkaller.appspotmail.com \
/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®