Skip to content

Commit 8ed2ef2

Browse files
committed
binfmt_elf: elf_bss no longer used by load_elf_binary()
With the BSS handled generically via the new filesz/memsz mismatch handling logic in elf_load(), elf_bss no longer needs to be tracked. Drop the variable. Cc: Eric Biederman <ebiederm@xmission.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Christian Brauner <brauner@kernel.org> Cc: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org Suggested-by: Eric Biederman <ebiederm@xmission.com> Tested-by: Pedro Falcato <pedro.falcato@gmail.com> Signed-off-by: Sebastian Ott <sebott@redhat.com> Link: https://lore.kernel.org/r/20230929032435.2391507-2-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org>
1 parent 585a018 commit 8ed2ef2

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

fs/binfmt_elf.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
854854
unsigned long error;
855855
struct elf_phdr *elf_ppnt, *elf_phdata, *interp_elf_phdata = NULL;
856856
struct elf_phdr *elf_property_phdata = NULL;
857-
unsigned long elf_bss, elf_brk;
857+
unsigned long elf_brk;
858858
int retval, i;
859859
unsigned long elf_entry;
860860
unsigned long e_entry;
@@ -1045,7 +1045,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
10451045
if (retval < 0)
10461046
goto out_free_dentry;
10471047

1048-
elf_bss = 0;
10491048
elf_brk = 0;
10501049

10511050
start_code = ~0UL;
@@ -1208,8 +1207,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
12081207

12091208
k = elf_ppnt->p_vaddr + elf_ppnt->p_filesz;
12101209

1211-
if (k > elf_bss)
1212-
elf_bss = k;
12131210
if ((elf_ppnt->p_flags & PF_X) && end_code < k)
12141211
end_code = k;
12151212
if (end_data < k)
@@ -1221,7 +1218,6 @@ static int load_elf_binary(struct linux_binprm *bprm)
12211218

12221219
e_entry = elf_ex->e_entry + load_bias;
12231220
phdr_addr += load_bias;
1224-
elf_bss += load_bias;
12251221
elf_brk += load_bias;
12261222
start_code += load_bias;
12271223
end_code += load_bias;

0 commit comments

Comments
 (0)