mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/1] hfs: discuss to add offset/length validation in hfs_brec_lenoff
@ 2025-08-18 14:17 Chenzhi Yang
  2025-08-18 14:17 ` [PATCH 1/1] hfs: validate record offset in hfsplus_bmap_alloc Chenzhi Yang
  2025-08-18 17:59 ` [PATCH 0/1] hfs: discuss to add offset/length validation in hfs_brec_lenoff Viacheslav Dubeyko
  0 siblings, 2 replies; 4+ messages in thread
From: Chenzhi Yang @ 2025-08-18 14:17 UTC (permalink / raw)
  To: slava, glaubitz, frank.li; +Cc: linux-fsdevel, linux-kernel, Yang Chenzhi

From: Yang Chenzhi <yang.chenzhi@vivo.com>

When running syzbot with a crafted HFS/HFS+ disk image containing
invalid record offsets or lengths, the filesystem may hang. For
example, in this case syzbot set the header’s second record offset
to 0x7f00 while node_size is 4096. HFS/HFS+ failed to detect this
fault, which eventually led to a crash.

Since HFS/HFS+ makes heavy use of hfs_brec_lenoff, adding manual
offset/length checks at every call site would be tedious and
error-prone.

Instead, it may be more robust to introduce validation directly
inside hfs_brec_lenoff (or at a similar central point), ensuring
that all callers can safely rely on the returned offset and length
without additional checks.

Yang Chenzhi (1):
  hfs: validate record offset in hfsplus_bmap_alloc

 fs/hfsplus/bnode.c      | 41 ----------------------------------------
 fs/hfsplus/btree.c      |  6 ++++++
 fs/hfsplus/hfsplus_fs.h | 42 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 41 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-18 17:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-18 14:17 [PATCH 0/1] hfs: discuss to add offset/length validation in hfs_brec_lenoff Chenzhi Yang
2025-08-18 14:17 ` [PATCH 1/1] hfs: validate record offset in hfsplus_bmap_alloc Chenzhi Yang
2025-08-18 17:57   ` Viacheslav Dubeyko
2025-08-18 17:59 ` [PATCH 0/1] hfs: discuss to add offset/length validation in hfs_brec_lenoff Viacheslav Dubeyko

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®