On Thu, Jun 22, 2023 at 05:42:54PM +0100, Catalin Marinas wrote: > On Thu, Jun 22, 2023 at 02:39:45PM +0100, Mark Brown wrote: > > - current->thread.tpidr2_el0 = tpidr2_el0; > > + write_sysreg_s(tpidr2_el0, SYS_TPIDR2_EL0); > I guess the other way around may also be true - the libc sets tpidr2_el0 > to something else and doesn't want the kernel to restore its original > value from sigcontext. > For tpidr_el0 we don't bother with sigcontext, not sure what the use for > tpidr2_el0 in signals is. If we assume the context saved is only > informative (like esr), we can simply ignore restoring it from the > signal stack. TPIDR2 is intended to go along with the thread stack, it's intended to be used to allow lazy save of the (rather large) ZA register state when a called function needs it rather than forcing it to be caller saved. TPIDR2 is used to point to memory allocated for managing this process, something that provides a new value should be making a deliberate decision to do so and editing the stack frame. > I guess we need to ask Szabolcs what his preference is. The current code > is wrong either way since current->thread.tpidr2_el0 would be overridden > at thread switch. Right.
Attachment:
signature.asc
Description: PGP signature