Re: [PATCH v2 2/3] riscv/purgatory: do not link with string.o and its dependencies

From: Conor Dooley
Date: Wed Jul 26 2023 - 12:34:01 EST


On Wed, Jul 26, 2023 at 11:54:00AM +0200, Petr Tesarik wrote:
> From: Petr Tesarik <petr.tesarik.ext@xxxxxxxxxx>
>
> Linking with this object file makes kexec_file_load(2) fail because of
> multiple unknown relocation types:
>
> - R_RISCV_ADD16, R_RISCV_SUB16: used by alternatives in strcmp()
> - R_RISCV_GOT_HI20: used to resolve _ctype in strcasecmp()
>
> All this hassle is needed for one single call to memcmp() from
> verify_sha256_digest() to compare 32 bytes of SHA256 checksum.
>
> Simply replace this memcmp() call with an explicit loop over those 32 bytes
> and remove the need to link with string.o and all the other object files
> that provide undefined symbols from that object file.
>
> Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
> Signed-off-by: Petr Tesarik <petr.tesarik.ext@xxxxxxxxxx>

This version keeps the automation happy,
Acked-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>

Thanks,
Conor.

Attachment: signature.asc
Description: PGP signature