From: Michal Suchanek <msuchanek@suse.de>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Michal Suchanek <msuchanek@suse.de>,
Sven Schnelle <svens@linux.ibm.com>,
Philipp Rudo <prudo@redhat.com>, Sasha Levin <sashal@kernel.org>,
Baoquan He <bhe@redhat.com>,
Alexander Egorenkov <egorenar@linux.ibm.com>,
linux-s390@vger.kernel.org (open list:S390)
Subject: [PATCH 5.15 1/6] s390/kexec_file: move kernel image size check
Date: Fri, 23 Sep 2022 19:10:29 +0200 [thread overview]
Message-ID: <e2869bb973f6b5fe350c52e4033fb171ef64aecd.1663951201.git.msuchanek@suse.de> (raw)
In-Reply-To: <cover.1663951201.git.msuchanek@suse.de>
From: Sven Schnelle <svens@linux.ibm.com>
commit 277c8389386e2ccb8417afe4e36f67fc5dcd735d upstream.
In preparation of adding support for command lines with variable
sizes on s390, the check whether the new kernel image is at least HEAD_END
bytes long isn't correct. Move the check to kexec_file_add_components()
so we can get the size of the parm area and check the size there.
The '.org HEAD_END' directive can now also be removed from head.S. This
was used in the past to reserve space for the early sccb buffer, but with
commit f1d3c5323772 ("s390/boot: move sclp early buffer from fixed address
in asm to C") this is no longer required.
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
arch/s390/boot/head.S | 2 --
arch/s390/include/asm/setup.h | 1 -
arch/s390/kernel/machine_kexec_file.c | 17 ++---------------
3 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/arch/s390/boot/head.S b/arch/s390/boot/head.S
index 40f4cff538b8..f3a8dba7dd5d 100644
--- a/arch/s390/boot/head.S
+++ b/arch/s390/boot/head.S
@@ -383,5 +383,3 @@ SYM_DATA_START(parmarea)
.byte 0
.org PARMAREA+__PARMAREA_SIZE
SYM_DATA_END(parmarea)
-
- .org HEAD_END
diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h
index b6606ffd85d8..121e1a8c41d7 100644
--- a/arch/s390/include/asm/setup.h
+++ b/arch/s390/include/asm/setup.h
@@ -11,7 +11,6 @@
#include <linux/build_bug.h>
#define PARMAREA 0x10400
-#define HEAD_END 0x11000
/*
* Machine features detected in early.c
diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c
index 3459362c54ac..29a9178ff0d4 100644
--- a/arch/s390/kernel/machine_kexec_file.c
+++ b/arch/s390/kernel/machine_kexec_file.c
@@ -243,7 +243,8 @@ void *kexec_file_add_components(struct kimage *image,
if (ret)
goto out;
- if (image->cmdline_buf_len >= ARCH_COMMAND_LINE_SIZE) {
+ if (image->kernel_buf_len < PARMAREA + sizeof(struct parmarea) ||
+ image->cmdline_buf_len >= ARCH_COMMAND_LINE_SIZE) {
ret = -EINVAL;
goto out;
}
@@ -333,20 +334,6 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
return 0;
}
-int arch_kexec_kernel_image_probe(struct kimage *image, void *buf,
- unsigned long buf_len)
-{
- /* A kernel must be at least large enough to contain head.S. During
- * load memory in head.S will be accessed, e.g. to register the next
- * command line. If the next kernel were smaller the current kernel
- * will panic at load.
- */
- if (buf_len < HEAD_END)
- return -ENOEXEC;
-
- return kexec_image_probe_default(image, buf, buf_len);
-}
-
int arch_kimage_file_post_load_cleanup(struct kimage *image)
{
vfree(image->arch.ipl_buf);
--
2.35.3
next prev parent reply other threads:[~2022-09-23 17:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-23 17:10 [PATCH 5.15 0/6] arm64: kexec_file: use more system keyrings to verify kernel image signature + dependencies Michal Suchanek
2022-09-23 17:10 ` Michal Suchanek [this message]
2022-09-23 17:10 ` [PATCH 5.15 2/6] kexec_file: drop weak attribute from functions Michal Suchanek
2022-09-23 17:10 ` [PATCH 5.15 3/6] kexec: " Michal Suchanek
2022-09-23 17:10 ` [PATCH 5.15 4/6] kexec: clean up arch_kexec_kernel_verify_sig Michal Suchanek
2022-09-23 17:10 ` [PATCH 5.15 5/6] kexec, KEYS: make the code in bzImage64_verify_sig generic Michal Suchanek
2022-09-23 17:10 ` [PATCH 5.15 6/6] arm64: kexec_file: use more system keyrings to verify kernel image signature Michal Suchanek
2022-09-23 19:03 ` [PATCH 5.15 0/6] arm64: kexec_file: use more system keyrings to verify kernel image signature + dependencies Mimi Zohar
2022-09-23 19:16 ` Michal Suchánek
2022-09-24 14:44 ` Michal Suchánek
2022-09-24 9:19 ` Greg Kroah-Hartman
2022-09-24 9:45 ` Michal Suchánek
2022-09-24 10:13 ` Greg Kroah-Hartman
2022-09-24 11:55 ` Michal Suchánek
2022-09-26 6:47 ` Greg Kroah-Hartman
2022-09-26 7:40 ` Michal Suchánek
2022-09-27 2:39 ` AKASHI Takahiro
2022-09-27 7:49 ` Michal Suchánek
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=e2869bb973f6b5fe350c52e4033fb171ef64aecd.1663951201.git.msuchanek@suse.de \
--to=msuchanek@suse.de \
--cc=agordeev@linux.ibm.com \
--cc=bhe@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=egorenar@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=prudo@redhat.com \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=svens@linux.ibm.com \
/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
all inboxes | Powered by JetHome®