Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] mm/vmalloc: take vmap_purge_lock in shrinker" failed to apply to 6.12-stable tree
@ 2026-05-03 11:49 gregkh
  2026-05-08 19:10 ` [PATCH 6.12.y] mm/vmalloc: take vmap_purge_lock in shrinker Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: gregkh @ 2026-05-03 11:49 UTC (permalink / raw)
  To: urezki, akpm, baoquan.he, chenyichong, stable; +Cc: stable


The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x ec05f51f1e65bce95528543eb73fda56fd201d94
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026050349-operation-curled-2359@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From ec05f51f1e65bce95528543eb73fda56fd201d94 Mon Sep 17 00:00:00 2001
From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Date: Mon, 13 Apr 2026 21:26:46 +0200
Subject: [PATCH] mm/vmalloc: take vmap_purge_lock in shrinker

decay_va_pool_node() can be invoked concurrently from two paths:
__purge_vmap_area_lazy() when pools are being purged, and the shrinker via
vmap_node_shrink_scan().

However, decay_va_pool_node() is not safe to run concurrently, and the
shrinker path currently lacks serialization, leading to races and possible
leaks.

Protect decay_va_pool_node() by taking vmap_purge_lock in the shrinker
path to ensure serialization with purge users.

Link: https://lore.kernel.org/20260413192646.14683-1-urezki@gmail.com
Fixes: 7679ba6b36db ("mm: vmalloc: add a shrinker to drain vmap pools")
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Reviewed-by: Baoquan He <baoquan.he@linux.dev>
Cc: chenyichong <chenyichong@uniontech.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 61caa55a4402..676851d5cfe7 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -5416,6 +5416,7 @@ vmap_node_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 {
 	struct vmap_node *vn;
 
+	guard(mutex)(&vmap_purge_lock);
 	for_each_vmap_node(vn)
 		decay_va_pool_node(vn, true);
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 6.12.y] mm/vmalloc: take vmap_purge_lock in shrinker
  2026-05-03 11:49 FAILED: patch "[PATCH] mm/vmalloc: take vmap_purge_lock in shrinker" failed to apply to 6.12-stable tree gregkh
@ 2026-05-08 19:10 ` Sasha Levin
  2026-07-06 16:37   ` Heiko Stübner
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2026-05-08 19:10 UTC (permalink / raw)
  To: stable
  Cc: Uladzislau Rezki (Sony), Baoquan He, chenyichong, Andrew Morton,
	Sasha Levin

From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

[ Upstream commit ec05f51f1e65bce95528543eb73fda56fd201d94 ]

decay_va_pool_node() can be invoked concurrently from two paths:
__purge_vmap_area_lazy() when pools are being purged, and the shrinker via
vmap_node_shrink_scan().

However, decay_va_pool_node() is not safe to run concurrently, and the
shrinker path currently lacks serialization, leading to races and possible
leaks.

Protect decay_va_pool_node() by taking vmap_purge_lock in the shrinker
path to ensure serialization with purge users.

Link: https://lore.kernel.org/20260413192646.14683-1-urezki@gmail.com
Fixes: 7679ba6b36db ("mm: vmalloc: add a shrinker to drain vmap pools")
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Reviewed-by: Baoquan He <baoquan.he@linux.dev>
Cc: chenyichong <chenyichong@uniontech.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
[ kept index-based loop instead of for_each_vmap_node() helper ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 mm/vmalloc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 1d2262fb54185..d4a42980b4d02 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -5204,6 +5204,7 @@ vmap_node_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 {
 	int i;
 
+	guard(mutex)(&vmap_purge_lock);
 	for (i = 0; i < nr_vmap_nodes; i++)
 		decay_va_pool_node(&vmap_nodes[i], true);
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 6.12.y] mm/vmalloc: take vmap_purge_lock in shrinker
  2026-05-08 19:10 ` [PATCH 6.12.y] mm/vmalloc: take vmap_purge_lock in shrinker Sasha Levin
@ 2026-07-06 16:37   ` Heiko Stübner
  2026-07-07  8:50     ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Heiko Stübner @ 2026-07-06 16:37 UTC (permalink / raw)
  To: stable, Sasha Levin
  Cc: Uladzislau Rezki (Sony), Baoquan He, chenyichong, Andrew Morton,
	Sasha Levin

Hi,

Am Freitag, 8. Mai 2026, 21:10:50 Mitteleuropäische Sommerzeit schrieb Sasha Levin:
> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
> 
> [ Upstream commit ec05f51f1e65bce95528543eb73fda56fd201d94 ]
> 
> decay_va_pool_node() can be invoked concurrently from two paths:
> __purge_vmap_area_lazy() when pools are being purged, and the shrinker via
> vmap_node_shrink_scan().
> 
> However, decay_va_pool_node() is not safe to run concurrently, and the
> shrinker path currently lacks serialization, leading to races and possible
> leaks.
> 
> Protect decay_va_pool_node() by taking vmap_purge_lock in the shrinker
> path to ensure serialization with purge users.
> 
> Link: https://lore.kernel.org/20260413192646.14683-1-urezki@gmail.com
> Fixes: 7679ba6b36db ("mm: vmalloc: add a shrinker to drain vmap pools")
> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Reviewed-by: Baoquan He <baoquan.he@linux.dev>
> Cc: chenyichong <chenyichong@uniontech.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> [ kept index-based loop instead of for_each_vmap_node() helper ]
> Signed-off-by: Sasha Levin <sashal@kernel.org>

it seems this fell through the cracks?

Because I don't see an applied message and couldn't find it in a 6.12
release up to now as well.

Would be nice to have in 6.12 though :-)


Thanks
Heiko

> ---
>  mm/vmalloc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 1d2262fb54185..d4a42980b4d02 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -5204,6 +5204,7 @@ vmap_node_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
>  {
>  	int i;
>  
> +	guard(mutex)(&vmap_purge_lock);
>  	for (i = 0; i < nr_vmap_nodes; i++)
>  		decay_va_pool_node(&vmap_nodes[i], true);
>  
> 





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 6.12.y] mm/vmalloc: take vmap_purge_lock in shrinker
  2026-07-06 16:37   ` Heiko Stübner
@ 2026-07-07  8:50     ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2026-07-07  8:50 UTC (permalink / raw)
  To: stable
  Cc: Sasha Levin, Uladzislau Rezki (Sony), Baoquan He, chenyichong,
	Andrew Morton, Heiko Stübner

> it seems this fell through the cracks?
> 
> Because I don't see an applied message and couldn't find it in a 6.12
> release up to now as well.
> 
> Would be nice to have in 6.12 though :-)

It did indeed, sorry about that. Queued for 6.12, thanks for the ping.

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-07  8:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-03 11:49 FAILED: patch "[PATCH] mm/vmalloc: take vmap_purge_lock in shrinker" failed to apply to 6.12-stable tree gregkh
2026-05-08 19:10 ` [PATCH 6.12.y] mm/vmalloc: take vmap_purge_lock in shrinker Sasha Levin
2026-07-06 16:37   ` Heiko Stübner
2026-07-07  8:50     ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox