mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Daniel J Blueman <daniel@quora.org>, Qu Wenruo <wqu@suse.com>,
	David Sterba <dsterba@suse.com>, Chris Mason <clm@fb.com>,
	dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	kasan-dev@googlegroups.com
Subject: Re: [PATCH] btrfs: Fix BTRFS arm64 tagged KASAN false-positive
Date: Sat, 21 Mar 2026 14:20:03 +1030	[thread overview]
Message-ID: <83471b13-d179-4b8c-95ca-7534eb4c3d7f@gmx.com> (raw)
In-Reply-To: <CAMVG2stDsMQigJ4NhFH6+K+DO+OLGFHZzCk3S0KX6B9yBOU9cg@mail.gmail.com>



在 2026/3/21 13:09, Daniel J Blueman 写道:
> On Sat, 21 Mar 2026 at 06:27, Qu Wenruo <wqu@suse.com> wrote:
>> 在 2026/3/21 08:31, David Sterba 写道:
>>> On Thu, Mar 19, 2026 at 07:26:34PM +1030, Qu Wenruo wrote:
[...]
>>
>> There is the interface, page_kasan_tag_set()/page_kasan_tag_reset(), and
>> is already utilized inside MM.
>>
>> And the deeper problem is, if this is a false alert, shouldn't we fix
>> the sanitizer?
>>
>> Especially in this case I didn't see any problem accessing properly
>> allocated and physically adjacent pages.
> 
> I agree with this, however BTRFS doesn't have multi-page folios, thus
> these pages are from different allocations; from extent_io.c:
> 
> /* For now, we should only have single-page folios for btree inode. */
> ASSERT(folio_nr_pages(existing_folio) == 1);
> 
> The goal of the differing KASAN tags per allocation is to catch UAF
> and other lifecycle issues. If preferred, I can test and submit a
> patch to set the same KASAN tag in alloc_eb_folio_array()? This would
> be removed when multi-page folio support is added and is along the
> lines of:
> 
> for (int i = 1; i < num_pages; i++)
>    page_kasan_tag_set(page_array[i], page_kasan_tag(page_array[0]));

That's exactly what I expect.

> 
> It will be less minimal as won't implicitly be compiled out as per my
> previous patch.

To be honest, I think the above change is the minimal fix, as it doesn't 
inject kasan code into the main loop of folio allocation.

And it will be compiled out, as page_kasan_tag_set() is no-op if neither 
software nor hardware tag is selected, and I believe the compiler is 
definitely clever enough to remove a loop with no-op in it.

Thanks,
Qu

> 
> Thanks,
>    Dan


      reply	other threads:[~2026-03-21  3:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19  5:34 Daniel J Blueman
2026-03-19  8:56 ` Qu Wenruo
2026-03-20 22:01   ` David Sterba
2026-03-20 22:26     ` Qu Wenruo
2026-03-21  2:39       ` Daniel J Blueman
2026-03-21  3:50         ` Qu Wenruo [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=83471b13-d179-4b8c-95ca-7534eb4c3d7f@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=clm@fb.com \
    --cc=daniel@quora.org \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wqu@suse.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®