[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211209174052.370537-1-hjl.tools@gmail.com>
Date: Thu, 9 Dec 2021 09:40:52 -0800
From: "H.J. Lu" <hjl.tools@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Chris Kennelly <ckennelly@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Alexey Dobriyan <adobriyan@...il.com>,
Song Liu <songliubraving@...com>,
David Rientjes <rientjes@...gle.com>,
Ian Rogers <irogers@...gle.com>,
Hugh Dickens <hughd@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Sandeep Patil <sspatil@...gle.com>,
Fangrui Song <maskray@...gle.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Shuah Khan <shuah@...nel.org>
Subject: [PATCH] fs/binfmt_elf: use PT_LOAD p_align values for static PIE
Extend
commit ce81bb256a224259ab686742a6284930cbe4f1fa
Author: Chris Kennelly <ckennelly@...gle.com>
Date: Thu Oct 15 20:12:32 2020 -0700
fs/binfmt_elf: use PT_LOAD p_align values for suitable start address
which fixed PIE binaries built with -Wl,-z,max-page-size=0x200000, to
cover static PIE binaries. This fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=215275
Tested by verifying static PIE binaries with -Wl,-z,max-page-size=0x200000
loading.
Signed-off-by: H.J. Lu <hjl.tools@...il.com>
---
fs/binfmt_elf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index a813b70f594e..bd78587194dc 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1110,11 +1110,11 @@ static int load_elf_binary(struct linux_binprm *bprm)
* independently randomized mmap region (0 load_bias
* without MAP_FIXED).
*/
- if (interpreter) {
+ alignment = maximum_alignment(elf_phdata, elf_ex->e_phnum);
+ if (alignment > ELF_MIN_ALIGN) {
load_bias = ELF_ET_DYN_BASE;
if (current->flags & PF_RANDOMIZE)
load_bias += arch_mmap_rnd();
- alignment = maximum_alignment(elf_phdata, elf_ex->e_phnum);
if (alignment)
load_bias &= ~(alignment - 1);
elf_flags |= MAP_FIXED;
--
2.33.1
Powered by blists - more mailing lists