mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Schmaus <florian.schmaus@codasip.com>
To: "Liam R. Howlett" <liam@infradead.org>,
	Dimitris Charisis <dchar@cslab.ece.ntua.gr>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alice Ryhl <aliceryhl@google.com>,
	Andrew Ballance <andrewjballance@gmail.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Suren Baghdasaryan <surenb@google.com>,
	linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org,
	linux-mm@kvack.org
Subject: Re: [PATCH 0/3] maple_tree: fix two bugs when freeing RCU-mode trees
Date: Fri, 23 Oct 2026 15:46:16 +0200	[thread overview]
Message-ID: <46073a08-20fd-465e-86e8-9c358787f9b3@codasip.com> (raw)
In-Reply-To: <dtet2zelrbzt36i3jbwgsi5iv3nnwtlhtnhbgdvj3m3kzewcvs@vdgjqdivisf7>

On 22/10/2026 18.32, Liam R. Howlett wrote:
> On 26/10/15 05:11PM, Florian Schmaus wrote:
>> Destroying a non-allocation maple tree with MT_FLAGS_USE_RCU defers freeing
>> its nodes to mt_free_walk(). There are two independent bugs on that path,
>> both caused by the metadata that a maple_range_64 node may keep in its last
>> slot:
>>
>>   1. mt_free_walk() takes the metadata of a node with 15 children for a
>>      child node and dereferences it.
>>      Reproduced with: 2768 ranges / height 4
>>
>>   2. mt_destroy_walk() takes the last child of a full node for metadata
>>      and corrupts its pointer, so mt_free_walk() frees a bogus address.
>>      Reproduced with: 120 ranges / a full root
[...]
> Thanks, but did you see Dimitris' patch on the 5th for this [1]?

No, I missed it, sorry. As there is no in-tree user, I did not expect 
anyone else to run into this and did not look for existing fixes.


> I believe this should also resolve your issue.

It does. Dimitris' change to mt_free_walk() is identical to my patch 1, 
and removing mt_clear_meta() is probably the better fix for the second 
bug than my patch 2.

One thing that may still be worth having is my test case: the height-3 
case in his tests only hits the bug at the root (the one requiring 
mt_clear_meta() to be gone). The height-4 case from my patch 3 exercises 
the bug at a non-root node and is not yet covered in Dimitri's test case.

Dimitris, I can send the height-4 test case as a follow-up patch on top 
of your series, extending check_range64_in_rcu(). Or would you rather 
fold it into your patch? Both is fine with me.

Thanks,
Florian

1: 
https://lore.kernel.org/all/20261005-fix-maple-tree-range64-rcu-v3-0-ebe7fb278e20@cslab.ece.ntua.gr/

      reply	other threads:[~2026-10-23 13:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 15:11 Florian Schmaus
2026-10-15 15:11 ` [PATCH 1/3] maple_tree: do not descend into metadata in mt_free_walk() Florian Schmaus
2026-10-15 15:11 ` [PATCH 2/3] maple_tree: do not clear the metadata of a full dead node Florian Schmaus
2026-10-15 15:11 ` [PATCH 3/3] maple_tree: add a test for destroying RCU-mode trees Florian Schmaus
2026-10-22 16:32 ` [PATCH 0/3] maple_tree: fix two bugs when freeing " Liam R. Howlett
2026-10-23 13:46   ` Florian Schmaus [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=46073a08-20fd-465e-86e8-9c358787f9b3@codasip.com \
    --to=florian.schmaus@codasip.com \
    --cc=akpm@linux-foundation.org \
    --cc=aliceryhl@google.com \
    --cc=andrewjballance@gmail.com \
    --cc=dchar@cslab.ece.ntua.gr \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=surenb@google.com \
    --cc=willy@infradead.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 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®