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.
Unified · Split
| @@ -400,5 +400,3 @@ SYM_DATA_START(parmarea) · 399 unmodified lines | |||
| 400 | .byte 0 | 400 | .byte 0 |
| 401 | .org PARMAREA+__PARMAREA_SIZE | 401 | .org PARMAREA+__PARMAREA_SIZE |
| 402 | SYM_DATA_END(parmarea) | 402 | SYM_DATA_END(parmarea) |
| 403 | |||
| 404 | .org HEAD_END | ||
| @@ -11,7 +11,6 @@ · 10 unmodified lines | |||
| 11 | #include <linux/build_bug.h> | 11 | #include <linux/build_bug.h> |
| 12 | 12 | ||
| 13 | #define PARMAREA 0x10400 | 13 | #define PARMAREA 0x10400 |
| 14 | #define HEAD_END 0x11000 | ||
| 15 | 14 | ||
| 16 | /* | 15 | /* |
| 17 | * Machine features detected in early.c | 16 | * Machine features detected in early.c |
| @@ -227,7 +227,8 @@ void *kexec_file_add_components(struct kimage *image, · 226 unmodified lines | |||
| 227 | if (ret) | 227 | if (ret) |
| 228 | goto out; | 228 | goto out; |
| 229 | 229 | ||
| 230 | if (image->cmdline_buf_len >= ARCH_COMMAND_LINE_SIZE) { | 230 | if (image->kernel_buf_len < PARMAREA + sizeof(struct parmarea) || |
| 231 | image->cmdline_buf_len >= ARCH_COMMAND_LINE_SIZE) { | ||
| 231 | ret = -EINVAL; | 232 | ret = -EINVAL; |
| 232 | goto out; | 233 | goto out; |
| 233 | } | 234 | } |
| @@ -307,17 +308,3 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, · 73 unmodified lines | |||
| 307 | } | 308 | } |
| 308 | return 0; | 309 | return 0; |
| 309 | } | 310 | } |
| 310 | |||
| 311 | int arch_kexec_kernel_image_probe(struct kimage *image, void *buf, | ||
| 312 | unsigned long buf_len) | ||
| 313 | { | ||
| 314 | /* A kernel must be at least large enough to contain head.S. During | ||
| 315 | * load memory in head.S will be accessed, e.g. to register the next | ||
| 316 | * command line. If the next kernel were smaller the current kernel | ||
| 317 | * will panic at load. | ||
| 318 | */ | ||
| 319 | if (buf_len < HEAD_END) | ||
| 320 | return -ENOEXEC; | ||
| 321 | |||
| 322 | return kexec_image_probe_default(image, buf, buf_len); | ||
| 323 | } | ||