From: Christoph Hellwig <hch@lst.de>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: Carlos Maiolino <cem@kernel.org>, Christoph Hellwig <hch@lst.de>,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: fix out of bounds memory read error in symlink repair
Date: Wed, 12 Nov 2025 17:38:27 +0100 [thread overview]
Message-ID: <20251112163827.GA12284@lst.de> (raw)
In-Reply-To: <20251112163518.GY196370@frogsfrogsfrogs>
On Wed, Nov 12, 2025 at 08:35:18AM -0800, Darrick J. Wong wrote:
> On further analysis, I realized that the second parameter to min() is
> not correct. xfs_ifork::if_bytes is the size of the xfs_ifork::if_data
> buffer. if_bytes can be smaller than the data fork size because:
>
> (a) the forkoff code tries to keep the data area as large as possible
> (b) for symbolic links, if_bytes is the ondisk file size + 1
> (c) forkoff is always a multiple of 8.
>
> Case in point: for a single-byte symlink target, forkoff will be
> 8 but the buffer will only be 2 bytes long.
>
> In other words, the logic here is wrong and we walk off the end of the
> incore buffer. Fix that.
Yeah. Probably only saved by kmalloc usually aligning sizes up.
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
next prev parent reply other threads:[~2025-11-12 16:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 16:35 [PATCH] xfs: fix out of bounds memory read error in symlink repair Darrick J. Wong
2025-11-12 16:38 ` Christoph Hellwig [this message]
2025-11-22 10:09 ` Carlos Maiolino
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=20251112163827.GA12284@lst.de \
--to=hch@lst.de \
--cc=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.