• Jessica Yu's avatar
    arm64/module: use plt section indices for relocations · c8ebf64e
    Jessica Yu authored
    Instead of saving a pointer to the .plt and .init.plt sections to apply
    plt-based relocations, save and use their section indices instead.
    
    The mod->arch.{core,init}.plt pointers were problematic for livepatch
    because they pointed within temporary section headers (provided by the
    module loader via info->sechdrs) that would be freed after module load.
    Since livepatch modules may need to apply relocations post-module-load
    (for example, to patch a module that is loaded later), using section
    indices to offset into the section headers (instead of accessing them
    through a saved pointer) allows livepatch modules on arm64 to pass in
    their own copy of the section headers to apply_relocate_add() to apply
    delayed relocations.
    Reviewed-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Reviewed-by: default avatarMiroslav Benes <mbenes@suse.cz>
    Signed-off-by: default avatarJessica Yu <jeyu@kernel.org>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    c8ebf64e
module.c 12.5 KB