Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Marco Elver <elver@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>,
	Uladzislau Rezki <urezki@gmail.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kasan-dev@googlegroups.com, Vitaly Wool <vitaly.wool@konsulko.se>,
	stable@vger.kernel.org, "Harry Yoo (Oracle)" <harry@kernel.org>
Subject: Re: [PATCH] vmalloc: fix buffer overflow in vrealloc_node_align()
Date: Fri, 24 Apr 2026 06:56:17 -0700	[thread overview]
Message-ID: <20260424065617.5de5751ec5a5c91910d45a28@linux-foundation.org> (raw)
In-Reply-To: <20260420114805.3572606-2-elver@google.com>

On Mon, 20 Apr 2026 13:47:26 +0200 Marco Elver <elver@google.com> wrote:

> Commit 4c5d3365882d ("mm/vmalloc: allow to set node and align in
> vrealloc") added the ability to force a new allocation if the current
> pointer is on the wrong NUMA node, or if an alignment constraint is not
> met, even if the user is shrinking the allocation.
> 
> On this path (need_realloc), the code allocates a new object of 'size'
> bytes and then memcpy()s 'old_size' bytes into it. If the request is to
> shrink the object (size < old_size), this results in an out-of-bounds
> write on the new buffer.
> 
> Fix this by bounding the copy length by the new allocation size.

AI review is asking questions about the nearby code:
	https://sashiko.dev/#/patchset/20260420114805.3572606-2-elver@google.com

  parent reply	other threads:[~2026-04-24 13:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 11:47 [PATCH] vmalloc: fix buffer overflow in vrealloc_node_align() Marco Elver
2026-04-20 12:17 ` Uladzislau Rezki
2026-04-20 12:21 ` Vlastimil Babka (SUSE)
2026-04-20 13:04 ` Harry Yoo (Oracle)
2026-04-24 13:56 ` Andrew Morton [this message]
2026-04-27 11:02   ` Marco Elver

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=20260424065617.5de5751ec5a5c91910d45a28@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=elver@google.com \
    --cc=harry@kernel.org \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=stable@vger.kernel.org \
    --cc=urezki@gmail.com \
    --cc=vbabka@kernel.org \
    --cc=vitaly.wool@konsulko.se \
    /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