Message ID | 20240730185049.6244-2-dakr@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | (k)vrealloc (__GFP_ZERO) fixes | expand |
On Tue, 30 Jul 2024 20:49:41 +0200 Danilo Krummrich <dakr@kernel.org> wrote: > Disable KASAN accessibility checks when switching from a kmalloc buffer > to a vmalloc buffer. This text tells us "what", which was utterly evident from a cursory read of the code. Please tell us the "why". Completely. > Fixes: 923a26b4c679 ("mm: kvmalloc: align kvrealloc() with krealloc()") For those who are following along, this patch in mm-unstable so this patch will be squished into the above.
On Tue, Jul 30, 2024 at 02:15:08PM -0700, Andrew Morton wrote: > On Tue, 30 Jul 2024 20:49:41 +0200 Danilo Krummrich <dakr@kernel.org> wrote: > > > Disable KASAN accessibility checks when switching from a kmalloc buffer > > to a vmalloc buffer. > > This text tells us "what", which was utterly evident from a cursory > read of the code. > > Please tell us the "why". Completely. As mentioned in the other reply. Since this is a fixup series for stuff that's in mm-unstable already, and hence gets squashed in later on, I treated this more like the list of changes one would also append when sending the next version of a series. If you expect such fixup commits to have the same detail than regular ones, I'll surely add those details and resend. Please let me know. > > > Fixes: 923a26b4c679 ("mm: kvmalloc: align kvrealloc() with krealloc()") > > For those who are following along, this patch in mm-unstable so this > patch will be squished into the above. >
diff --git a/mm/util.c b/mm/util.c index 29ae93f6344f..bfb2d69b6434 100644 --- a/mm/util.c +++ b/mm/util.c @@ -753,7 +753,10 @@ void *kvrealloc_noprof(const void *p, size_t size, gfp_t flags) if (p) { /* We already know that `p` is not a vmalloc address. */ - memcpy(n, p, ksize(p)); + kasan_disable_current(); + memcpy(n, kasan_reset_tag(p), ksize(p)); + kasan_enable_current(); + kfree(p); } }
Disable KASAN accessibility checks when switching from a kmalloc buffer to a vmalloc buffer. Fixes: 923a26b4c679 ("mm: kvmalloc: align kvrealloc() with krealloc()") Signed-off-by: Danilo Krummrich <dakr@kernel.org> --- mm/util.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)