[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrX1L7fQ=UYpzJHAY4M_XQ5Ht5wOSfvKMtac8j=uO7cnzQ@mail.gmail.com>
Date: Thu, 30 Mar 2017 11:36:01 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andy Lutomirski <luto@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Denys Vlasenko <dvlasenk@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Jan Kratochvil <jan.kratochvil@...hat.com>,
Pedro Alves <palves@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>, X86 ML <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] get_nr_restart_syscall() should return
__NR_ia32_restart_syscall if __USER32_CS
On Thu, Mar 30, 2017 at 8:28 AM, Oleg Nesterov <oleg@...hat.com> wrote:
> On 03/29, Andy Lutomirski wrote:
>>
>> On Wed, Mar 29, 2017 at 8:05 AM, Oleg Nesterov <oleg@...hat.com> wrote:
>> > On 03/28, Oleg Nesterov wrote:
>> >>
>> >> On 03/28, Andy Lutomirski wrote:
>> >> >
>> >> > How about we store the syscall arch to be restored in task_struct
>> >> > along with restart_block?
>> >>
>> >> Yes, perhaps we will have to finally do this. Not really nice too.
>> >
>> > OK, how about the hack below?
>> >
>> > I do not want to a new member into task_struct/restart_block, so the
>> > patch below adds a sticky TS_COMPAT bit which logically is a member
>> > of "struct restart_block".
>>
>> Okay, but I'd much rather we just added a helper that's called in the
>> few places that actually write to restart_block.
>
> Oh, yes, I thought about this too. This obviously needs more changes, and
> every arch needs a dummy definition... I was thinking about
>
> static inline long setup_restart_block(void)
> {
> if (TS_COMPAT)
> set TS_COMPAT_XXX;
> else
> clear TS_COMPAT_XXX;
>
> return -ERESTART_RESTARTBLOCK;
> }
>
> so that we can do
>
> - ret = -ERESTART_RESTARTBLOCK;
> + ret = setup_restart_block();
>
> but I don't really like this... Do you strongly prefer it over the
> -ERESTART_RESTARTBLOCK check in syscall_return_slowpath? I agree it doesn't
> look nice too but it connects to other TS_ magic we do in arch/x86/entry/,
> perhaps it is not that bad...
How about:
struct restart_block *restart = set_syscall_restart_fn(do_whatever);
restart->other_stuff = blah.
I'd rather avoid adding stuff to the slow path that runs *that* rarely.
>
>> Or we just add the new syscall nr and see what breaks. The answer
>> could well be nothing at all.
>
> Well, strace knows about __NR_restart_syscall. It won't be really broken,
> but I guess it will report something like "unknown syscall" rather than
> restart_syscall(...).
>
> However, this still looks like a best solution to me, just I have no idea
> how much we can confuse user-space.
Me neither.
Powered by blists - more mailing lists