[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wi9YO5M-LHuTuczQbK6hBrweCoZHVEsiTak6jGuoFt2Sw@mail.gmail.com>
Date: Wed, 27 Nov 2019 09:21:44 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: 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 Wed, Nov 27, 2019 at 9:02 AM Oleg Nesterov <oleg@...hat.com> wrote:
>
> OK, lets add the new restart_block.nr_restart_syscall field, then we need
>
> void set_restart_block_fn(restart, fn)
> {
> restart->nr_restart_syscall = arch_get_nr_restart_syscall()
> restart->fn = fn;
> }
No, I'd suggest just adding an arch-specific "unsigned long" to the
restart data (and not force the naming to something like the system
call number - that's just an x86 detail), and then something like this
on x86:
void arch_set_restart_data(restart)
{
restart->arch_data = x86_get_restart_syscall();
}
#define arch_set_restart_data arch_set_restart_data
and then we'd have in generic code something like
#ifndef arch_set_restart_data
#define arch_set_restart_data(block) do { } while (0)
#endif
int set_restart_fn(fn)
{
struct restart_block *restart = ¤t->restart_blockl
arch_set_restart_data(restart);
restart->fn = fn;
return -ERESTART_RESTARTBLOCK;
}
or something like that, and we'd just convert the existing (there
aren't that many)
restart->fn = xyz
return -ERESTART_RESTARTBLOCK;
cases into
return set_restart_fn(fn);
and for bonus points, we probably should rename the "fn" field, but
that might be too much work.
It doesn't look *too* painful, because we just don't have all that
many restarting system calls
But the above is handwaving.
And yeah, I never understood why the compat and x32 cases should have
different system call numbers in the first place. The seccomp argument
is garbage, but probably historical stuff that we can no longer
change.
Linus
Powered by blists - more mailing lists