linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* in_compat_syscall() on x86
@ 2021-01-04 12:16 David Laight
  2021-01-04 16:46 ` David Laight
  2021-01-04 16:58 ` Al Viro
  0 siblings, 2 replies; 14+ messages in thread
From: David Laight @ 2021-01-04 12:16 UTC (permalink / raw)
  To: Al Viro, Christoph Hellwig, linux-kernel

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?)

To do this sensible (probably) requires a byte be allocated
to hold the syscall type - rather than using flag bits
in the 'status' field.

Apart from the syscall entry, the exec code seems to change
the syscall type to that of the binary being executed.
I didn't spot anything else that changes the fields.

But I failed to find the full list of allocated bits for
the 'status' field.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-01-06  9:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).