Re: [PATCH] powerpc/prom_init: Undo relocation before entering secure mode

From: Michael Ellerman
Date: Fri Oct 25 2019 - 07:03:56 EST


Thiago Jung Bauermann <bauerman@xxxxxxxxxxxxx> writes:
> The ultravisor will do an integrity check of the kernel image but we
> relocated it so the check will fail. Restore the original image by
> relocating it back to the kernel virtual base address.
>
> This works because during build vmlinux is linked with an expected virtual
> runtime address of KERNELBASE.
>
> Fixes: 6a9c930bd775 ("powerpc/prom_init: Add the ESM call to prom_init")
> Signed-off-by: Thiago Jung Bauermann <bauerman@xxxxxxxxxxxxx>
> ---
> arch/powerpc/include/asm/elf.h | 3 +++
> arch/powerpc/kernel/prom_init.c | 11 +++++++++++
> arch/powerpc/kernel/prom_init_check.sh | 3 ++-
> 3 files changed, 16 insertions(+), 1 deletion(-)

This breaks the build when CONFIG_RELOCATABLE=n:

prom_init.c:(.init.text+0x3160): undefined reference to `relocate'

See http://kisskb.ellerman.id.au/kisskb/buildresult/14004234/

cheers