Skip to content
Snippets Groups Projects
  • Tomasz Grabiec's avatar
    3409d13d
    elf: fix handling of R_X86_64_TPOFF64 relocation · 3409d13d
    Tomasz Grabiec authored
    
    This code seems obviously broken to me:
    
      tls_data().size
    
    there is no tls_data function, it is a struct. So this is creating
    temporary uninitialized struct and reads size field from it.
    
    What it meant instead is probably the TLS size, which is calculated by
    tls() function and returned in a tls_data structure.
    
    I am not able to actually test this change because I don't have any
    DSO which has R_X86_64_TPOFF64 relocations. Any idea how to test it?
    
    tls() is also broken, because it initializes file_size field instead
    of the size field. The file_size field was added at some point but
    this place wasn't updated. As it appears that tls() is not actually
    used anywhere, this patch gets rid of it.
    
    Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
    Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
    3409d13d
    History
    elf: fix handling of R_X86_64_TPOFF64 relocation
    Tomasz Grabiec authored
    
    This code seems obviously broken to me:
    
      tls_data().size
    
    there is no tls_data function, it is a struct. So this is creating
    temporary uninitialized struct and reads size field from it.
    
    What it meant instead is probably the TLS size, which is calculated by
    tls() function and returned in a tls_data structure.
    
    I am not able to actually test this change because I don't have any
    DSO which has R_X86_64_TPOFF64 relocations. Any idea how to test it?
    
    tls() is also broken, because it initializes file_size field instead
    of the size field. The file_size field was added at some point but
    this place wasn't updated. As it appears that tls() is not actually
    used anywhere, this patch gets rid of it.
    
    Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
    Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>