* [merged] fs-binfmt_elf-refactor-load_elf_binary-function.patch removed from -mm tree
@ 2022-02-28 2:58 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2022-02-28 2:58 UTC (permalink / raw)
To: mm-commits, viro, lukas.bulwahn, lkp, keescook, ebiederm,
adobriyan, akirakawata1, akpm
The patch titled
Subject: fs/binfmt_elf: refactor load_elf_binary function
has been removed from the -mm tree. Its filename was
fs-binfmt_elf-refactor-load_elf_binary-function.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Akira Kawata <akirakawata1@gmail.com>
Subject: fs/binfmt_elf: refactor load_elf_binary function
I delete load_addr because it is not used anymore. And I rename
load_addr_set to first_pt_load because it is used only to capture the
first iteration of the loop.
Link: https://lkml.kernel.org/r/20211212232414.1402199-3-akirakawata1@gmail.com
Signed-off-by: Akira Kawata <akirakawata1@gmail.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: kernel test robot <lkp@intel.com>
Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/binfmt_elf.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
--- a/fs/binfmt_elf.c~fs-binfmt_elf-refactor-load_elf_binary-function
+++ a/fs/binfmt_elf.c
@@ -823,8 +823,8 @@ static int parse_elf_properties(struct f
static int load_elf_binary(struct linux_binprm *bprm)
{
struct file *interpreter = NULL; /* to shut gcc up */
- unsigned long load_addr, load_bias = 0, phdr_addr = 0;
- int load_addr_set = 0;
+ unsigned long load_bias = 0, phdr_addr = 0;
+ int first_pt_load = 1;
unsigned long error;
struct elf_phdr *elf_ppnt, *elf_phdata, *interp_elf_phdata = NULL;
struct elf_phdr *elf_property_phdata = NULL;
@@ -1074,12 +1074,12 @@ out_free_interp:
vaddr = elf_ppnt->p_vaddr;
/*
- * The first time through the loop, load_addr_set is false:
+ * The first time through the loop, first_pt_load is true:
* layout will be calculated. Once set, use MAP_FIXED since
* we know we've already safely mapped the entire region with
* MAP_FIXED_NOREPLACE in the once-per-binary logic following.
*/
- if (load_addr_set) {
+ if (!first_pt_load) {
elf_flags |= MAP_FIXED;
} else if (elf_ex->e_type == ET_EXEC) {
/*
@@ -1139,10 +1139,10 @@ out_free_interp:
/*
* Calculate the entire size of the ELF mapping (total_size).
- * (Note that load_addr_set is set to true later once the
+ * (Note that first_pt_load is set to false later once the
* initial mapping is performed.)
*/
- if (!load_addr_set) {
+ if (first_pt_load) {
total_size = total_mapping_size(elf_phdata,
elf_ex->e_phnum);
if (!total_size) {
@@ -1159,13 +1159,11 @@ out_free_interp:
goto out_free_dentry;
}
- if (!load_addr_set) {
- load_addr_set = 1;
- load_addr = (elf_ppnt->p_vaddr - elf_ppnt->p_offset);
+ if (first_pt_load) {
+ first_pt_load = 0;
if (elf_ex->e_type == ET_DYN) {
load_bias += error -
ELF_PAGESTART(load_bias + vaddr);
- load_addr += load_bias;
reloc_func_desc = load_bias;
}
}
_
Patches currently in -mm which might be from akirakawata1@gmail.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-28 2:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 2:58 [merged] fs-binfmt_elf-refactor-load_elf_binary-function.patch removed from -mm tree Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).