public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
	Jan Kratochvil <jan.kratochvil@redhat.com>,
	Pedro Alves <palves@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>, X86 ML <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] get_nr_restart_syscall() should return __NR_ia32_restart_syscall if __USER32_CS
Date: Thu, 30 Mar 2017 17:28:48 +0200	[thread overview]
Message-ID: <20170330152848.GA27171@redhat.com> (raw)
In-Reply-To: <CALCETrXrTTrGU_ttG9m-SLkhHmrCs7O01-avEgOxadiGnCKiyA@mail.gmail.com>

On 03/29, Andy Lutomirski wrote:
>
> On Wed, Mar 29, 2017 at 8:05 AM, Oleg Nesterov <oleg@redhat.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...

> 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.

Oleg.

  reply	other threads:[~2017-03-30 15:29 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 14:54 [PATCH 0/1] get_nr_restart_syscall() should return __NR_ia32_restart_syscall if __USER32_CS Oleg Nesterov
2017-03-28 14:54 ` [PATCH 1/1] " Oleg Nesterov
2017-03-28 15:03   ` Andy Lutomirski
2017-03-28 16:27     ` Oleg Nesterov
2017-03-28 17:10       ` Andy Lutomirski
2017-03-29 15:05       ` Oleg Nesterov
2017-03-29 16:59         ` Andy Lutomirski
2017-03-30 15:28           ` Oleg Nesterov [this message]
2017-03-30 18:36             ` Andy Lutomirski
2017-03-29 16:33 ` syscall_get_error() && TS_ checks Oleg Nesterov
2017-03-29 16:45   ` Linus Torvalds
2017-03-29 16:55     ` Oleg Nesterov
2017-03-29 16:59       ` Linus Torvalds
2017-03-29 17:04         ` Oleg Nesterov
2017-03-29 17:16           ` Linus Torvalds
2017-03-29 18:50             ` Oleg Nesterov
2017-03-29 18:56               ` Linus Torvalds
2017-03-30 13:51                 ` Oleg Nesterov
2017-03-30 15:49                   ` Oleg Nesterov
2017-03-30 17:46                     ` Linus Torvalds
2017-03-30 18:23                       ` Andy Lutomirski
2017-03-30 18:35                         ` Linus Torvalds
2017-03-30 18:59                           ` Andy Lutomirski
2017-03-30 19:11                             ` Linus Torvalds
2017-03-30 19:21                               ` Andy Lutomirski
2017-03-30 19:29                                 ` Linus Torvalds
2017-03-29 16:56     ` Andy Lutomirski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170330152848.GA27171@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jan.kratochvil@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=palves@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox