Re: [REGRESSION] x86/cpu fsgsbase breaks TLS in 32 bit rr tracees on a 64 bit system
From: Kyle Huey
Date: Tue Aug 25 2020 - 12:32:29 EST
On Tue, Aug 25, 2020 at 9:12 AM Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
> I don’t like this at all. Your behavior really shouldn’t depend on
> whether the new instructions are available. Also, some day I would
> like to change Linux to have the new behavior even if FSGSBASE
> instructions are not available, and this will break rr again. (The
> current !FSGSBASE behavior is an ugly optimization of dubious value.
> I would not go so far as to describe it as correct.)
Ok.
> I would suggest you do one of the following things:
>
> 1. Use int $0x80 directly to load 32-bit regs into a child. This
> might dramatically simplify your code and should just do the right
> thing.
I don't know what that means.
> 2. Something like your patch but make it unconditional.
>
> 3. Ask for, and receive, real kernel support for setting FS and GS in
> the way that 32-bit code expects.
I think the easiest way forward for us would be a PTRACE_GET/SETREGSET
like operation that operates on the regsets according to the
*tracee*'s bitness (rather than the tracer, as it works currently).
Does that sound workable?
- Kyle