• Sumanth Korikkar's avatar
    s390/module: fix rela calculation for R_390_GOTENT · 11458e2b
    Sumanth Korikkar authored
    During  module load, module layout allocation occurs by initially
    allowing the architecture to frob the sections. This is performed via
    module_frob_arch_sections().
    
    However, the size of each module memory types like text,data,rodata etc
    are updated correctly only after layout_sections().
    
    After calculation of required module memory sizes for each types,
    move_module() is responsible for allocating the module memory for each
    type from modules vaddr range.
    
    Considering the sequence above, module_frob_arch_sections() updates the
    module mod_arch_specific got_offset before module memory text type size
    is fully updated in layout_sections().  Hence mod_arch_specific
    got_offset points to currently zero.
    
    As per s390 ABI,
    R_390_GOTENT :  (G + O + A - P) >> 1
    where
    G=me->mem[MOD_TEXT].base+me->arch.got_offset
    O=info->got_offset
    A=rela->r_addend
    P=loc
    
    fix R_390_GOTENT calculation in apply_rela().
    
    Note: currently this doesn't break anything because me->arch.got_offset
    is zero.  However, reordering of functions in the future could break it.
    Signed-off-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
    Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
    Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
    11458e2b
module.c 17.4 KB