From: Kees Cook <kees@kernel.org>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: "Ryan Roberts" <ryan.roberts@arm.com>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
Linux-MM <linux-mm@kvack.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: BUG: vdso changes expose elf mapping issue
Date: Fri, 25 Apr 2025 15:48:27 -0700 [thread overview]
Message-ID: <202504251546.FC8A40CB98@keescook> (raw)
In-Reply-To: <202504251158.D3D342410@keescook>
On Fri, Apr 25, 2025 at 12:56:21PM -0700, Kees Cook wrote:
> For fixing the former, the below change might work (totally untested yet,
> I just wanted to reply with my thoughts as I start testing this). Pardon
> the goofy code style, I wanted a minimal diff here:
>
> diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
> index 7e2afe3220f7..9290a29ede28 100644
> --- a/fs/binfmt_elf.c
> +++ b/fs/binfmt_elf.c
> @@ -1284,7 +1284,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
> mm->end_data = end_data;
> mm->start_stack = bprm->p;
>
> - if ((current->flags & PF_RANDOMIZE) && (snapshot_randomize_va_space > 1)) {
> + {
> /*
> * For architectures with ELF randomization, when executing
> * a loader directly (i.e. no interpreter listed in ELF
> @@ -1299,7 +1299,9 @@ static int load_elf_binary(struct linux_binprm *bprm)
> /* Otherwise leave a gap between .bss and brk. */
> mm->brk = mm->start_brk = mm->brk + PAGE_SIZE;
> }
> + }
>
> + if ((current->flags & PF_RANDOMIZE) && (snapshot_randomize_va_space > 1)) {
> mm->brk = mm->start_brk = arch_randomize_brk(mm);
> #ifdef compat_brk_randomized
> current->brk_randomized = 1;
Unsurprisingly, this patch was broken, but the idea appears to be
valid. This new patch works for me so far, though I haven't finished
getting Ubuntu 22.04 installed in an arm64 VM. Please let me know if
this fixes it:
https://lore.kernel.org/lkml/20250425224502.work.520-kees@kernel.org/
--
Kees Cook
prev parent reply other threads:[~2025-04-25 22:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-25 12:41 Ryan Roberts
2025-04-25 18:37 ` Catalin Marinas
2025-04-25 19:56 ` Kees Cook
2025-04-25 22:48 ` Kees Cook [this message]
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=202504251546.FC8A40CB98@keescook \
--to=kees@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryan.roberts@arm.com \
--cc=thomas.weissschuh@linutronix.de \
/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