From: Alexey Dobriyan <adobriyan@gmail.com>
To: Bradley Morgan <include@grrlz.net>
Cc: akpm@linux-foundation.org, gorcunov@openvz.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] prctl: fix PR_SET_MM_AUXV losing the forced AT_NULL terminator
Date: Mon, 10 Aug 2026 07:50:32 +0300 [thread overview]
Message-ID: <70ff6317-fea5-4f57-835f-007169ba5ffc@p183> (raw)
In-Reply-To: <20260809002901.32591-1-include@grrlz.net>
On Sun, Aug 09, 2026 at 12:29:01AM +0000, Bradley Morgan wrote:
> prctl_set_auxv() copies the user vector into a stack buffer, forces
> AT_NULL on the last two entries there, and then copies only len bytes
> into mm->saved_auxv. Which is fine until the vector is shorter than
> the buffer, because then the forced terminator sits past the end of
> the copy and never lands in saved_auxv at all.
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -2189,7 +2189,7 @@ static int prctl_set_auxv(struct mm_struct *mm, unsigned long addr,
> BUILD_BUG_ON(sizeof(user_auxv) != sizeof(mm->saved_auxv));
>
> task_lock(current);
> - memcpy(mm->saved_auxv, user_auxv, len);
> + memcpy(mm->saved_auxv, user_auxv, sizeof(user_auxv));
> task_unlock(current);
You're supposed to use prctl(PR_SET_MM_AUXV) with correct "len", yes.
This is userspace visible, warning could be added for another 14 years
and then line changed.
PR_ALEXEY
next prev parent reply other threads:[~2026-08-10 4:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-09 0:29 Bradley Morgan
2026-08-10 4:50 ` Alexey Dobriyan [this message]
2026-08-10 12:10 ` Bradley Morgan
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=70ff6317-fea5-4f57-835f-007169ba5ffc@p183 \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=gorcunov@openvz.org \
--cc=include@grrlz.net \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®