Re: [PATCH v4 22/29] x86/asm: Move 'status' from struct thread_info to struct thread_struct

From: Andy Lutomirski
Date: Sun Jun 26 2016 - 20:40:47 EST


On Sun, Jun 26, 2016 at 5:36 PM, Brian Gerst <brgerst@xxxxxxxxx> wrote:
> On Sun, Jun 26, 2016 at 8:23 PM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>> On Sun, Jun 26, 2016 at 4:55 PM, Brian Gerst <brgerst@xxxxxxxxx> wrote:
>>> On Sun, Jun 26, 2016 at 5:55 PM, Andy Lutomirski <luto@xxxxxxxxxx> wrote:
>>>> --- a/arch/x86/kernel/asm-offsets.c
>>>> +++ b/arch/x86/kernel/asm-offsets.c
>>>> @@ -30,7 +30,6 @@
>>>> void common(void) {
>>>> BLANK();
>>>> OFFSET(TI_flags, thread_info, flags);
>>>> - OFFSET(TI_status, thread_info, status);
>>>
>>> TI_status can be deleted. It's last users were removed in commit ee08c6bd.
>>
>> Indeed.
>>
>> Just to double-check: are you saying that this patch is okay?
>
> It looks OK to me, but I haven't tested it. Another suggestion is to
> change the compat flag to a bitfield, since there is only one TS_*
> flag now and it's not referenced from asm.

That could also work.

As a silly alternative thought: we just might be able to get away with
shoving the "is ia32" flag into one of the high bits of
pt_regs->orig_ax. It wouldn't break any 32-bit ptrace users because
they can't see the high bits. It wouldn't break most 64-bit ptrace
users because they use the silly PTRACE_GETREGSET API that doesn't
show the high bits if the tracee is "32-bit". It would change
behavior when a 64-bit tracer traces a 64-bit process that does int
$0x80, but at least strace already gets that case completely wrong.

Of course, this proposal has all kinds of problems.

--Andy