From: Kees Cook <kees@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Kees Cook <kees@kernel.org>, Shung-Hsi Yu <shung-hsi.yu@suse.com>,
Eduard Zingerman <eddyz87@gmail.com>,
Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
Uladzislau Rezki <urezki@gmail.com>,
linux-mm@kvack.org, Erhard Furtner <erhard_f@mailbox.org>,
Danilo Krummrich <dakr@kernel.org>,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: [PATCH 1/2] mm: vmalloc: Actually use the in-place vrealloc region
Date: Thu, 15 May 2025 14:42:15 -0700 [thread overview]
Message-ID: <20250515214217.619685-1-kees@kernel.org> (raw)
In-Reply-To: <20250515214020.work.519-kees@kernel.org>
The refactoring to not build a new vmalloc region only actually worked
when shrinking. Actually return the resized area when it grows. Ugh.
Reported-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Closes: https://lore.kernel.org/all/20250515-bpf-verifier-slowdown-vwo2meju4cgp2su5ckj@6gi6ssxbnfqg
Tested-by: Eduard Zingerman <eddyz87@gmail.com>
Tested-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Fixes: a0309faf1cb0 ("mm: vmalloc: support more granular vrealloc() sizing")
Signed-off-by: Kees Cook <kees@kernel.org>
---
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Uladzislau Rezki <urezki@gmail.com>
Cc: <linux-mm@kvack.org>
---
mm/vmalloc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 2d7511654831..74bd00fd734d 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -4111,6 +4111,7 @@ void *vrealloc_noprof(const void *p, size_t size, gfp_t flags)
if (want_init_on_alloc(flags))
memset((void *)p + old_size, 0, size - old_size);
vm->requested_size = size;
+ return (void *)p;
}
/* TODO: Grow the vm_area, i.e. allocate and map additional pages. */
--
2.34.1
next prev parent reply other threads:[~2025-05-15 21:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 21:42 [PATCH 0/2] " Kees Cook
2025-05-15 21:42 ` Kees Cook [this message]
2025-05-15 21:42 ` [PATCH 2/2] mm: vmalloc: Only zero-init on vrealloc shrink Kees Cook
2025-05-16 6:02 ` [PATCH 0/2] mm: vmalloc: Actually use the in-place vrealloc region Shung-Hsi Yu
2025-05-16 6:32 ` Uladzislau Rezki
2025-05-16 8:28 ` Danilo Krummrich
2025-05-19 19:18 ` Kees Cook
2025-05-20 0:06 ` Andrew Morton
2025-05-20 16:06 ` Kees Cook
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=20250515214217.619685-1-kees@kernel.org \
--to=kees@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bpf@vger.kernel.org \
--cc=dakr@kernel.org \
--cc=eddyz87@gmail.com \
--cc=erhard_f@mailbox.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=shung-hsi.yu@suse.com \
--cc=urezki@gmail.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