]> Git Repo - linux.git/commitdiff
s390/kexec_file: move kernel image size check
authorSven Schnelle <[email protected]>
Thu, 30 Sep 2021 07:34:13 +0000 (09:34 +0200)
committerVasily Gorbik <[email protected]>
Tue, 26 Oct 2021 13:21:30 +0000 (15:21 +0200)
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 9a5131b87cac1 ("s390/boot: move sclp early buffer from fixed address
in asm to C") this is no longer required.

Signed-off-by: Sven Schnelle <[email protected]>
Reviewed-by: Heiko Carstens <[email protected]>
Signed-off-by: Vasily Gorbik <[email protected]>
arch/s390/boot/head.S
arch/s390/include/asm/setup.h
arch/s390/kernel/machine_kexec_file.c

index 7e843d8e794ec32ee3d41702ac6488b36c6cd435..5d3fc69a505c73a802254baffc9cc273555fe945 100644 (file)
@@ -400,5 +400,3 @@ SYM_DATA_START(parmarea)
        .byte   0
        .org    PARMAREA+__PARMAREA_SIZE
 SYM_DATA_END(parmarea)
-
-       .org    HEAD_END
index b6606ffd85d898ba7ae9593b27e0d5cc9aac4df0..121e1a8c41d73a0e9da5a41bdd3d851b9ccb2fee 100644 (file)
@@ -11,7 +11,6 @@
 #include <linux/build_bug.h>
 
 #define PARMAREA               0x10400
-#define HEAD_END               0x11000
 
 /*
  * Machine features detected in early.c
index f9e4baa64b675caa5ad5e1d9eccd3d01716fe721..55382ffde9d45feddf406488ee4addaf42ca23b3 100644 (file)
@@ -227,7 +227,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;
        }
@@ -307,17 +308,3 @@ 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);
-}
This page took 0.064599 seconds and 4 git commands to generate.