<div dir="ltr">interesting...<br>a simple cherry-pick does indeed not work properly ...<div><br></div><div>I've created a backport, that only adds a bit more context, content-wise it's the same</div><div><br></div><div>re-submit it soon as v2<br><br>(apologize)<br><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 17, 2022 at 2:05 PM Tim Gardner <<a href="mailto:tim.gardner@canonical.com">tim.gardner@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 2/17/22 1:47 AM, Krzysztof Kozlowski wrote:<br>
> On 17/02/2022 09:30, <a href="mailto:frank.heimes@canonical.com" target="_blank">frank.heimes@canonical.com</a> wrote:<br>
>> From: Sven Schnelle <<a href="mailto:svens@linux.ibm.com" target="_blank">svens@linux.ibm.com</a>><br>
>><br>
>> BugLink: <a href="https://bugs.launchpad.net/bugs/1959984" rel="noreferrer" target="_blank">https://bugs.launchpad.net/bugs/1959984</a><br>
>><br>
>> In preparation of adding support for command lines with variable<br>
>> sizes on s390, the check whether the new kernel image is at least HEAD_END<br>
>> bytes long isn't correct. Move the check to kexec_file_add_components()<br>
>> so we can get the size of the parm area and check the size there.<br>
>><br>
>> The '.org HEAD_END' directive can now also be removed from head.S. This<br>
>> was used in the past to reserve space for the early sccb buffer, but with<br>
>> commit 9a5131b87cac1 ("s390/boot: move sclp early buffer from fixed address<br>
>> in asm to C") this is no longer required.<br>
>><br>
>> Signed-off-by: Sven Schnelle <<a href="mailto:svens@linux.ibm.com" target="_blank">svens@linux.ibm.com</a>><br>
>> Reviewed-by: Heiko Carstens <<a href="mailto:hca@linux.ibm.com" target="_blank">hca@linux.ibm.com</a>><br>
>> Signed-off-by: Vasily Gorbik <<a href="mailto:gor@linux.ibm.com" target="_blank">gor@linux.ibm.com</a>><br>
>> (cherry picked from commit 277c8389386e2ccb8417afe4e36f67fc5dcd735d)<br>
<br>
This is a backport.<br>
<br>
>> Signed-off-by: Frank Heimes <<a href="mailto:frank.heimes@canonical.com" target="_blank">frank.heimes@canonical.com</a>><br>
>> ---<br>
>> arch/s390/boot/head.S | 2 --<br>
>> arch/s390/include/asm/setup.h | 1 -<br>
>> arch/s390/kernel/machine_kexec_file.c | 25 ++-----------------------<br>
>> 3 files changed, 2 insertions(+), 26 deletions(-)<br>
>><br>
>> diff --git a/arch/s390/boot/head.S b/arch/s390/boot/head.S<br>
>> index 40f4cff538b8..f3a8dba7dd5d 100644<br>
>> --- a/arch/s390/boot/head.S<br>
>> +++ b/arch/s390/boot/head.S<br>
>> @@ -383,5 +383,3 @@ SYM_DATA_START(parmarea)<br>
>> .byte 0<br>
>> .org PARMAREA+__PARMAREA_SIZE<br>
>> SYM_DATA_END(parmarea)<br>
>> -<br>
>> - .org HEAD_END<br>
>> diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h<br>
>> index b6606ffd85d8..121e1a8c41d7 100644<br>
>> --- a/arch/s390/include/asm/setup.h<br>
>> +++ b/arch/s390/include/asm/setup.h<br>
>> @@ -11,7 +11,6 @@<br>
>> #include <linux/build_bug.h><br>
>> <br>
>> #define PARMAREA 0x10400<br>
>> -#define HEAD_END 0x11000<br>
>> <br>
>> /*<br>
>> * Machine features detected in early.c<br>
>> diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c<br>
>> index a81d6c43b9b6..6944d9abee1e 100644<br>
>> --- a/arch/s390/kernel/machine_kexec_file.c<br>
>> +++ b/arch/s390/kernel/machine_kexec_file.c<br>
>> @@ -235,7 +235,8 @@ void *kexec_file_add_components(struct kimage *image,<br>
>> if (ret)<br>
>> goto out;<br>
>> <br>
>> - if (image->cmdline_buf_len >= ARCH_COMMAND_LINE_SIZE) {<br>
>> + if (image->kernel_buf_len < PARMAREA + sizeof(struct parmarea) ||<br>
>> + image->cmdline_buf_len >= ARCH_COMMAND_LINE_SIZE) {<br>
>> ret = -EINVAL;<br>
>> goto out;<br>
>> }<br>
>> @@ -324,25 +325,3 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi,<br>
>> }<br>
>> return 0;<br>
>> }<br>
>> -<br>
>> -int arch_kexec_kernel_image_probe(struct kimage *image, void *buf,<br>
>> - unsigned long buf_len)<br>
>> -{<br>
>> - /* A kernel must be at least large enough to contain head.S. During<br>
>> - * load memory in head.S will be accessed, e.g. to register the next<br>
>> - * command line. If the next kernel were smaller the current kernel<br>
>> - * will panic at load.<br>
>> - */<br>
>> - if (buf_len < HEAD_END)<br>
>> - return -ENOEXEC;<br>
>> -<br>
>> - return kexec_image_probe_default(image, buf, buf_len);<br>
>> -}<br>
>> -<br>
>> -int arch_kimage_file_post_load_cleanup(struct kimage *image)<br>
>> -{<br>
> <br>
> This should stay. It was not part of original commit.<br>
> <br>
>> - vfree(image->arch.ipl_buf);<br>
>> - image->arch.ipl_buf = NULL;<br>
>> -<br>
>> - return kexec_image_post_load_cleanup_default(image);<br>
>> -}<br>
> <br>
> <br>
> Best regards,<br>
> Krzysztof<br>
> <br>
<br>
-- <br>
-----------<br>
Tim Gardner<br>
Canonical, Inc<br>
</blockquote></div>