Commit 6339a388 authored by Philipp Rudo's avatar Philipp Rudo Committed by Martin Schwidefsky

s390/kexec_file: Fix potential segment overlap in ELF loader

When loading an ELF image via kexec_file the segment alignment is ignored
in the calculation for the load address of the next segment. When there are
multiple segments this can lead to segment overlap and thus load failure.
Signed-off-by: default avatarPhilipp Rudo <prudo@linux.ibm.com>
Fixes: 8be01882 ("s390/kexec_file: Add ELF loader")
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent f3df44e7
...@@ -53,7 +53,7 @@ static int kexec_file_add_elf_kernel(struct kimage *image, ...@@ -53,7 +53,7 @@ static int kexec_file_add_elf_kernel(struct kimage *image,
if (ret) if (ret)
return ret; return ret;
data->memsz += buf.memsz; data->memsz = ALIGN(data->memsz, phdr->p_align) + buf.memsz;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment