public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: David Laight <David.Laight@aculab.com>
Cc: Christoph Hellwig <hch@lst.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: in_compat_syscall() on x86
Date: Mon, 4 Jan 2021 16:58:27 +0000	[thread overview]
Message-ID: <20210104165827.GJ3579531@ZenIV.linux.org.uk> (raw)
In-Reply-To: <e817cfdc2df3433bb7fb357db89d4d48@AcuMS.aculab.com>

On Mon, Jan 04, 2021 at 12:16:56PM +0000, David Laight wrote:
> On x86 in_compat_syscall() is defined as:
>     in_ia32_syscall() || in_x32_syscall()
> 
> Now in_ia32_syscall() is a simple check of the TS_COMPAT flag.
> However in_x32_syscall() is a horrid beast that has to indirect
> through to the original %eax value (ie the syscall number) and
> check for a bit there.
> 
> So on a kernel with x32 support (probably most distro kernels)
> the in_compat_syscall() check is rather more expensive than
> one might expect.
> 
> It would be muck better if both checks could be done together.
> I think this would require the syscall entry code to set a
> value in both the 64bit and x32 entry paths.
> (Can a process make both 64bit and x32 system calls?)

Yes, it bloody well can.

And I see no benefit in pushing that logics into syscall entry,
since anything that calls in_compat_syscall() more than once
per syscall execution is doing the wrong thing.  Moreover,
in quite a few cases we don't call the sucker at all, and for
all of those pushing that crap into syscall entry logics is
pure loss.

What's the point, really?

  parent reply	other threads:[~2021-01-04 16:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 12:16 in_compat_syscall() on x86 David Laight
2021-01-04 16:46 ` David Laight
2021-01-04 16:58 ` Al Viro [this message]
2021-01-04 20:41   ` Eric W. Biederman
2021-01-04 22:34     ` David Laight
2021-01-04 23:04       ` Andy Lutomirski
2021-01-05  0:47         ` Eric W. Biederman
2021-01-05  0:57           ` Al Viro
2021-01-06  0:03             ` Eric W. Biederman
2021-01-06  0:11               ` Bernd Petrovitsch
2021-01-06  0:30               ` Al Viro
2021-01-05  9:53         ` David Laight
2021-01-05 17:35           ` Andy Lutomirski
2021-01-06  9:42             ` David Laight

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=20210104165827.GJ3579531@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=David.Laight@aculab.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.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