mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mar Dominguez" <mar@talkjune.com>
To: "Viacheslav Dubeyko" <slava@dubeyko.com>,
	"John Paul Adrian Glaubitz" <glaubitz@physik.fu-berlin.de>,
	"Yangtao Li" <frank.li@vivo.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] hfs: fix writes to b-tree nodes larger than a page
Date: Fri, 04 Dec 2026 22:22:43 +0000	[thread overview]
Message-ID: <13C30uJftWBGcsLXeedCzRVIfMjV8yaRbGM4@talkjune.com> (raw)
In-Reply-To: <e2914a3111777fbc7cabd6e4aa9ddb68f0418017.camel@dubeyko.com>

On Fri, 2026-12-04 at 19:32 +0000, Viacheslav Dubeyko wrote:
> Please, correct me if I wrong. Have you implemented support of node
> size bigger than 512 bytes in HFS?

No, patch 1 didn't add a new feature.  hfs_btree_open() has accepted
any power-of-two node size since 2.6.12, and the read and node creation
paths already loop over the pages of a node, so patch 1 only made the
four write helpers do the same.

[...]
> So, we should support only 512 bytes node size. This a difference
> between HFS and HFS+. HFS supports only 512 bytes b-tree nodes and
> nodes share memory page. For the case of HFS+, b-tree node cannot be
> smaller than 4K, if I remember correctly. I assume that we could have
> issue in HFS b-tree nodes management code. But node size should be 512
> bytes always for the case of HFS.

Agreed, thanks for the spec references.  I've sent a v2 that replaces
the series with one patch: hfs_btree_open() now rejects any node size
other than 512 bytes, for both the catalog and the extents tree.  That
also closes the out-of-bounds write on crafted images, since a 512-byte
node never crosses a page boundary:

https://lore.kernel.org/linux-fsdevel/cqBIXnOxXx3ey7plxkEtHUghzAOub4g70HWj@talkjune.com/

v2 drops the KUnit patch, since its cases were for nodes larger than a
page.  If you'd like KUnit tests for the write helpers on 512-byte
nodes, I can send them as a separate patch.

Thanks,
Mar


      reply	other threads:[~2026-12-04 22:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  5:36 Mar Dominguez
2026-12-04  5:38 ` [PATCH 1/3] hfs: fix b-tree node writes past the first page Mar Dominguez
2026-12-04  5:41 ` [PATCH 2/3] hfs: check the b-tree node size range in hfs_btree_open() Mar Dominguez
2026-12-04  5:43 ` [PATCH 3/3] hfs: add KUnit tests for b-tree node operations Mar Dominguez
2026-12-04 19:31 ` [PATCH 0/3] hfs: fix writes to b-tree nodes larger than a page Viacheslav Dubeyko
2026-12-04 22:22   ` Mar Dominguez [this message]

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=13C30uJftWBGcsLXeedCzRVIfMjV8yaRbGM4@talkjune.com \
    --to=mar@talkjune.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=slava@dubeyko.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®