• Mark Rutland's avatar
    arm64: module: rework special section handling · bd8b21d3
    Mark Rutland authored
    When we load a module, we have to perform some special work for a couple
    of named sections. To do this, we iterate over all of the module's
    sections, and perform work for each section we recognize.
    
    To make it easier to handle the unexpected absence of a section, and to
    make the section-specific logic easer to read, let's factor the section
    search into a helper. Similar is already done in the core module loader,
    and other architectures (and ideally we'd unify these in future).
    
    If we expect a module to have an ftrace trampoline section, but it
    doesn't have one, we'll now reject loading the module. When
    ARM64_MODULE_PLTS is selected, any correctly built module should have
    one (and this is assumed by arm64's ftrace PLT code) and the absence of
    such a section implies something has gone wrong at build time.
    
    Subsequent patches will make use of the new helper.
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Reviewed-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Reviewed-by: default avatarTorsten Duwe <duwe@suse.de>
    Tested-by: default avatarAmit Daniel Kachhap <amit.kachhap@arm.com>
    Tested-by: default avatarTorsten Duwe <duwe@suse.de>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: James Morse <james.morse@arm.com>
    Cc: Will Deacon <will@kernel.org>
    bd8b21d3
module.c 13.4 KB