[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrWTjUJQVXmbhnAfpg=J1kV8XZnWrjR7Yt+a1Dd2GSTr5A@mail.gmail.com>
Date: Tue, 26 Nov 2019 21:46:14 -0800
From: Andy Lutomirski <luto@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Oleg Nesterov <oleg@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...nel.org>,
Jan Kratochvil <jan.kratochvil@...hat.com>,
Pedro Alves <palves@...hat.com>, Peter Anvin <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"the arch/x86 maintainers" <x86@...nel.org>
Subject: Re: [PATCH] ptrace/x86: introduce TS_COMPAT_RESTART to fix get_nr_restart_syscall()
On Tue, Nov 26, 2019 at 8:04 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> On Tue, Nov 26, 2019 at 3:08 AM Oleg Nesterov <oleg@...hat.com> wrote:
> >
> > Alternatively we could add ->compat_restart into struct restart_block,
> > logically this is the same thing.
>
> That sounds like the better model to me. That's what the restart_block
> is about: it's supposed to contain the restart information.
>
> I'd much rather see the system call number added into the restart
> block (or just the "compat bit" - but we have that X32 case too, so
> why not put it all there). And then the get_nr_restart_syscall() hack
> goes away and is just "set state from the restart block".
>
> How painful would that be? I guess right now we always just set all
> the restart_block info manually in all the restart cases, and that
> could make it a bit painful to add this kind of architecture-specific
> flag, but it _sounds_ conceptually like the right thing to do.
How about we rename restart_block::fn to __fn, add fields
restart_syscall_nr and restart_syscall_arch, and do:
long restart_block_activate(long (*fn)(struct restart_block *))
{
current->restart_block.__fn = fn;
arch_restart_block_activate();
return -ERESTART_RESTARTBLOCK;
current->restart_block.syscall_nr
}
IMO the ideal solution would be to add a new syscall nr to restart a
syscall and make it the same on all architectures. This has
unfortunate interactions with seccomp, though.
--Andy
Powered by blists - more mailing lists