From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Bert Karwatzki <spasswolf@web.de>
Cc: "Liam R . Howlett" <Liam.Howlett@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 14/21] mm/mmap: Avoid zeroing vma tree in mmap_region()
Date: Fri, 4 Oct 2024 15:23:37 +0100 [thread overview]
Message-ID: <d07c85a3-d1b6-48e7-9e98-bb533bb73417@lucifer.local> (raw)
In-Reply-To: <20241004093546.3232-1-spasswolf@web.de>
On Fri, Oct 04, 2024 at 11:35:44AM +0200, Bert Karwatzki wrote:
> Here's the log procduced by this kernel:
>
> c9e7f76815d3 (HEAD -> maple_tree_debug_4) hack: set of info stuff v5
> 7e3bb072761a mm: correct error handling in mmap_region()
> 77df9e4bb222 (tag: next-20241001, origin/master, origin/HEAD, master) Add linux-next specific files for 20241001
>
> Again it took two attempts to trigger the bug.
>
> Bert Karwatzki
>
Hi Bert, please try the below fix.
It fails a couple tests in the test suite so this might not be stable but
it fixes my repro, be good to confirm it fixes the issue for you.
Thanks!
----8<----
From 07485683fcd3d8d22996d82bdbde0e3647f2349e Mon Sep 17 00:00:00 2001
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Date: Fri, 4 Oct 2024 15:18:58 +0100
Subject: [PATCH] fix
---
lib/maple_tree.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 37abf0fe380b..fc221a9f23f2 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -3527,6 +3527,7 @@ static bool mas_wr_walk(struct ma_wr_state *wr_mas)
return true;
}
+// Return whether the node actually contains entries at or greater than wr_mas->mas->index.
static bool mas_wr_walk_index(struct ma_wr_state *wr_mas)
{
struct ma_state *mas = wr_mas->mas;
@@ -3696,6 +3697,7 @@ static noinline void mas_wr_spanning_store(struct ma_wr_state *wr_mas)
struct maple_big_node b_node;
struct ma_state *mas;
unsigned char height;
+ bool r_populated;
/* Left and Right side of spanning store */
MA_STATE(l_mas, NULL, 0, 0);
@@ -3737,7 +3739,7 @@ static noinline void mas_wr_spanning_store(struct ma_wr_state *wr_mas)
r_mas.last++;
r_mas.index = r_mas.last;
- mas_wr_walk_index(&r_wr_mas);
+ r_populated = mas_wr_walk_index(&r_wr_mas);
r_mas.last = r_mas.index = mas->last;
/* Set up left side. */
@@ -3759,9 +3761,12 @@ static noinline void mas_wr_spanning_store(struct ma_wr_state *wr_mas)
memset(&b_node, 0, sizeof(struct maple_big_node));
/* Copy l_mas and store the value in b_node. */
+
mas_store_b_node(&l_wr_mas, &b_node, l_mas.end);
+
/* Copy r_mas into b_node. */
- if (r_mas.offset <= r_mas.end)
+
+ if (r_populated && r_mas.offset <= r_mas.end)
mas_mab_cp(&r_mas, r_mas.offset, r_mas.end,
&b_node, b_node.b_end + 1);
else
--
2.46.2
next prev parent reply other threads:[~2024-10-04 14:23 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 9:35 Bert Karwatzki
2024-10-04 9:58 ` Lorenzo Stoakes
2024-10-04 14:23 ` Lorenzo Stoakes [this message]
2024-10-04 14:26 ` Lorenzo Stoakes
2024-10-04 14:32 ` Lorenzo Stoakes
2024-10-04 14:58 ` Lorenzo Stoakes
2024-10-04 22:41 ` Lorenzo Stoakes
2024-10-05 0:56 ` Bert Karwatzki
2024-10-05 6:21 ` Lorenzo Stoakes
2024-10-05 8:57 ` Bert Karwatzki
2024-10-05 11:11 ` Lorenzo Stoakes
-- strict thread matches above, loose matches on Subject: below --
2024-10-13 22:35 Bert Karwatzki
2024-10-14 9:46 ` Lorenzo Stoakes
2024-10-16 10:28 ` Bert Karwatzki
2024-10-16 11:16 ` Lorenzo Stoakes
2024-10-16 14:13 ` Liam R. Howlett
2024-10-04 8:51 Bert Karwatzki
2024-10-04 8:59 ` Lorenzo Stoakes
2024-10-03 17:07 Bert Karwatzki
2024-10-03 17:24 ` Lorenzo Stoakes
2024-10-03 19:32 ` Lorenzo Stoakes
2024-10-04 8:36 ` Lorenzo Stoakes
2024-10-03 13:09 Bert Karwatzki
2024-10-03 13:34 ` Lorenzo Stoakes
2024-10-03 10:51 Bert Karwatzki
2024-10-03 11:17 ` Lorenzo Stoakes
2024-10-03 10:41 Bert Karwatzki
2024-10-03 10:46 ` Lorenzo Stoakes
2024-10-03 8:59 Bert Karwatzki
2024-10-03 9:04 ` Lorenzo Stoakes
2024-10-03 9:27 ` Lorenzo Stoakes
2024-10-02 22:58 Bert Karwatzki
2024-10-03 7:43 ` Lorenzo Stoakes
2024-10-02 22:57 Bert Karwatzki
2024-10-03 8:06 ` Lorenzo Stoakes
2024-10-02 21:58 Bert Karwatzki
2024-10-02 21:48 Bert Karwatzki
2024-10-02 21:41 Bert Karwatzki
[not found] <20241002105131.4545-1-spasswolf@web.de>
2024-10-02 11:19 ` Lorenzo Stoakes
2024-10-01 2:34 Bert Karwatzki
2024-10-01 8:02 ` Lorenzo Stoakes
2024-10-01 8:38 ` Bert Karwatzki
2024-10-01 8:49 ` Lorenzo Stoakes
2024-10-01 8:55 ` Bert Karwatzki
2024-10-01 8:59 ` Lorenzo Stoakes
2024-10-01 9:10 ` Bert Karwatzki
2024-10-01 9:20 ` Lorenzo Stoakes
2024-10-01 9:49 ` Lorenzo Stoakes
2024-10-01 9:57 ` Bert Karwatzki
2024-10-01 10:02 ` Lorenzo Stoakes
2024-10-01 10:22 ` Bert Karwatzki
2024-10-01 10:33 ` Lorenzo Stoakes
2024-10-01 10:42 ` Bert Karwatzki
2024-10-01 11:23 ` Lorenzo Stoakes
2024-10-01 11:56 ` Lorenzo Stoakes
2024-10-01 16:43 ` Bert Karwatzki
2024-10-01 18:01 ` Lorenzo Stoakes
2024-10-02 8:39 ` Lorenzo Stoakes
2024-10-02 8:48 ` Lorenzo Stoakes
2024-10-02 12:13 ` Lorenzo Stoakes
2024-10-02 13:23 ` Lorenzo Stoakes
2024-10-02 16:13 ` Bert Karwatzki
2024-10-02 17:19 ` Lorenzo Stoakes
2024-10-02 18:28 ` Lorenzo Stoakes
2024-10-02 18:54 ` Lorenzo Stoakes
2024-10-02 20:06 ` Bert Karwatzki
2024-10-02 20:22 ` Lorenzo Stoakes
2024-10-02 20:39 ` Bert Karwatzki
2024-10-02 20:44 ` Lorenzo Stoakes
2024-10-02 21:13 ` Lorenzo Stoakes
2024-08-30 4:00 [PATCH v8 00/21] Avoid MAP_FIXED gap exposure Liam R. Howlett
2024-08-30 4:00 ` [PATCH v8 14/21] mm/mmap: Avoid zeroing vma tree in mmap_region() Liam R. Howlett
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=d07c85a3-d1b6-48e7-9e98-bb533bb73417@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=spasswolf@web.de \
/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