• Dave Martin's avatar
    arm64: ptrace: Flush user-RW TLS reg to thread_struct before reading · 936eb65c
    Dave Martin authored
    When reading current's user-writable TLS register (which occurs
    when dumping core for native tasks), it is possible that userspace
    has modified it since the time the task was last scheduled out.
    The new TLS register value is not guaranteed to have been written
    immediately back to thread_struct in this case.
    
    As a result, a coredump can capture stale data for this register.
    Reading the register for a stopped task via ptrace is unaffected.
    
    For native tasks, this patch explicitly flushes the TPIDR_EL0
    register back to thread_struct before dumping when operating on
    current, thus ensuring that coredump contents are up to date.  For
    compat tasks, the TLS register is not user-writable and so cannot
    be out of sync, so no flush is required in compat_tls_get().
    Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    936eb65c
process.c 10.1 KB