Re: [PATCH] ptrace/x86: introduce TS_COMPAT_RESTART to fix get_nr_restart_syscall()

From: Andy Lutomirski
Date: Thu Nov 28 2019 - 16:13:39 EST




>> On Nov 28, 2019, at 11:25 AM, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>>
>> ïOn Thu, Nov 28, 2019 at 7:36 AM Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
>> You misunderstood my question, I do not see a good place for the code
>> above. So I am going to uglify */signal.[ch] files.
>
> Ahh, ok, I thought that was kind of understood.
>
>> --- a/arch/x86/include/asm/signal.h
>> +++ b/arch/x86/include/asm/signal.h
>> @@ -5,6 +5,10 @@
>> #ifndef __ASSEMBLY__
>> #include <linux/linkage.h>
>> +struct restart_block;
>> +extern void arch_set_restart_data(struct restart_block *);
>> +#define arch_set_restart_data arch_set_restart_data
>
> I'd just replace this with
>
> /* We need to save TS_COMPAT at the time of the call */
> #define arch_set_restart_data(blk) (blk)->arch_data =
> current_thread_info()->status
>
> or something like that.

I think this doesnât work for x32. Letâs either save the result of syscall_get_arch() or just actually calculate and save the restart_syscall nr here.

Before we commit to this, Kees, do you think we can manage to just renumber restart_syscall()? Thatâs a much better solution if we can pull it off.

>
> Linus