From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Philipp Rudo <prudo@linux.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Sasha Levin <sashal@kernel.org>,
linux-s390@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 314/671] s390/kexec_file: Fix potential segment overlap in ELF loader
Date: Thu, 16 Jan 2020 11:59:12 -0500 [thread overview]
Message-ID: <20200116170509.12787-51-sashal@kernel.org> (raw)
In-Reply-To: <20200116170509.12787-1-sashal@kernel.org>
From: Philipp Rudo <prudo@linux.ibm.com>
[ Upstream commit 6339a3889ad4d0dd930ed7a1e873fb81d3e690f7 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/s390/kernel/kexec_elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/kernel/kexec_elf.c b/arch/s390/kernel/kexec_elf.c
index 602e7cc26d11..5cf340b778f1 100644
--- a/arch/s390/kernel/kexec_elf.c
+++ b/arch/s390/kernel/kexec_elf.c
@@ -58,7 +58,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;
--
2.20.1
next parent reply other threads:[~2020-01-16 17:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200116170509.12787-1-sashal@kernel.org>
2020-01-16 16:59 ` Sasha Levin [this message]
2020-01-16 17:01 ` [PATCH AUTOSEL 4.19 422/671] net/af_iucv: build proper skbs for HiperTransport Sasha Levin
2020-01-16 17:01 ` [PATCH AUTOSEL 4.19 423/671] net/af_iucv: always register net_device notifier Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 586/671] s390/qeth: Fix error handling during VNICC initialization Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 587/671] s390/qeth: Fix initialization of vnicc cmd masks during set online Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 593/671] net/smc: receive returns without data Sasha Levin
2020-01-16 17:03 ` [PATCH AUTOSEL 4.19 594/671] net/smc: receive pending data after RCV_SHUTDOWN Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200116170509.12787-51-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=prudo@linux.ibm.com \
--cc=schwidefsky@de.ibm.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox