summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Rudo <prudo@linux.ibm.com>2019-04-01 12:13:42 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2019-04-29 10:43:43 +0200
commit6339a3889ad4d0dd930ed7a1e873fb81d3e690f7 (patch)
treeb3732ebceab3c5d5a05c0f045156760c6f75c6ac
parentf3df44e7c9869b7691a4a0b57fa39ca47060b424 (diff)
downloadlinux-6339a3889ad4d0dd930ed7a1e873fb81d3e690f7.tar.gz
linux-6339a3889ad4d0dd930ed7a1e873fb81d3e690f7.tar.bz2
linux-6339a3889ad4d0dd930ed7a1e873fb81d3e690f7.zip
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: Philipp Rudo <prudo@linux.ibm.com> Fixes: 8be018827154 ("s390/kexec_file: Add ELF loader") Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/kernel/kexec_elf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/s390/kernel/kexec_elf.c b/arch/s390/kernel/kexec_elf.c
index 5a286b012043..1d1c77c647d2 100644
--- a/arch/s390/kernel/kexec_elf.c
+++ b/arch/s390/kernel/kexec_elf.c
@@ -53,7 +53,7 @@ static int kexec_file_add_elf_kernel(struct kimage *image,
if (ret)
return ret;
- data->memsz += buf.memsz;
+ data->memsz = ALIGN(data->memsz, phdr->p_align) + buf.memsz;
}
return 0;