From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Subject: Re: [PATCH] btrfs: raid56: fix a out-of-boundary access for sub-page systems
Date: Fri, 14 Nov 2025 08:27:24 +1030 [thread overview]
Message-ID: <0962852b-61f5-4f3f-9258-ef2625e581f8@suse.com> (raw)
In-Reply-To: <bbd1a41c70c0f37da9e3e82aa89784e831b0e889.1763069997.git.wqu@suse.com>
在 2025/11/14 08:09, Qu Wenruo 写道:
> [BUG]
> There is a bug report from IBM that on Power11 the test case btrfs/023
> crashed.
>
> The call trace itself is not useful as this particular case is a wild
> memory write, which corrupted the SLUB system.
>
> [CAUSE]
> Inside index_stripe_sectors() we will update rbio->stripe_paddrs[] array
> to reflect the latest stripe_pages[].
>
> We use the physical address of the corresponding page, add an offset
> inside the page to represent the sector.
>
> However in patch "btrfs: raid56: remove sector_ptr structure", the
> offset is added to the stripe_pages[] array, not the result of
> page_to_phys().
>
> This makes the stripe_paddrs[] to be hugely incorrect for subpage
> systems.
>
> [FIX]
> Fix the calculation by adding the offset after page_to_phys().
>
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> The fix will be folded into the offending patch.
> ---
> fs/btrfs/raid56.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
> index ad3d5e789158..7cb756ac19ba 100644
> --- a/fs/btrfs/raid56.c
> +++ b/fs/btrfs/raid56.c
> @@ -331,8 +331,8 @@ static void index_stripe_sectors(struct btrfs_raid_bio *rbio)
> if (!rbio->stripe_pages[page_index])
> continue;
>
> - rbio->stripe_paddrs[i] = page_to_phys(rbio->stripe_pages[page_index] +
> - offset_in_page(offset));
> + rbio->stripe_paddrs[i] = page_to_phys(rbio->stripe_pages[page_index]) +
> + offset_in_page(offset);
The folded version will have one less indent, so that offset_in_page()
is having the same indent at page_to_phys().
Thanks,
Qu
> }
> }
>
next prev parent reply other threads:[~2025-11-13 21:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 21:39 [PATCH] btrfs: raid56: fix a out-of-boundary access for sub-page systems Qu Wenruo
2025-11-13 21:57 ` Qu Wenruo [this message]
2025-11-14 4:52 ` Venkat Rao Bagalkote
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=0962852b-61f5-4f3f-9258-ef2625e581f8@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=venkat88@linux.ibm.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