1
0
Fork 0
alistair23-linux/arch/arm64
Dave Martin 35d0e6fb4d arm64: syscallno is secretly an int, make it official
The upper 32 bits of the syscallno field in thread_struct are
handled inconsistently, being sometimes zero extended and sometimes
sign-extended.  In fact, only the lower 32 bits seem to have any
real significance for the behaviour of the code: it's been OK to
handle the upper bits inconsistently because they don't matter.

Currently, the only place I can find where those bits are
significant is in calling trace_sys_enter(), which may be
unintentional: for example, if a compat tracer attempts to cancel a
syscall by passing -1 to (COMPAT_)PTRACE_SET_SYSCALL at the
syscall-enter-stop, it will be traced as syscall 4294967295
rather than -1 as might be expected (and as occurs for a native
tracer doing the same thing).  Elsewhere, reads of syscallno cast
it to an int or truncate it.

There's also a conspicuous amount of code and casting to bodge
around the fact that although semantically an int, syscallno is
stored as a u64.

Let's not pretend any more.

In order to preserve the stp x instruction that stores the syscall
number in entry.S, this patch special-cases the layout of struct
pt_regs for big endian so that the newly 32-bit syscallno field
maps onto the low bits of the stored value.  This is not beautiful,
but benchmarking of the getpid syscall on Juno suggests indicates a
minor slowdown if the stp is split into an stp x and stp w.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2017-08-07 09:58:33 +01:00
..
boot Allwinner fixes for 4.13 2017-08-04 13:04:42 +02:00
configs arm64: defconfig: enable missing HWSPINLOCK 2017-07-27 23:09:54 -05:00
crypto crypto: arm64/sha - avoid non-standard inline asm tricks 2017-05-18 13:19:52 +08:00
include arm64: syscallno is secretly an int, make it official 2017-08-07 09:58:33 +01:00
kernel arm64: syscallno is secretly an int, make it official 2017-08-07 09:58:33 +01:00
kvm KVM: arm/arm64: PMU: Fix overflow interrupt injection 2017-07-25 14:18:01 +01:00
lib arm64/lib: copy_page: use consistent prefetch stride 2017-07-25 10:04:42 +01:00
mm arm64: Fix potential race with hardware DBM in ptep_set_access_flags() 2017-08-04 13:26:11 +01:00
net arm64 updates for 4.13: 2017-07-05 17:09:27 -07:00
xen xen/privcmd: Add IOCTL_PRIVCMD_DM_OP 2017-02-14 15:13:43 -05:00
Kconfig include/linux/string.h: add the option of fortified string.h functions 2017-07-12 16:26:03 -07:00
Kconfig.debug arm64: relocation testing module 2017-04-04 17:03:32 +01:00
Kconfig.platforms ARM: SoC 64-bit changes 2017-07-04 14:53:26 -07:00
Makefile arm64: pass endianness info to sparse 2017-06-26 10:15:06 +01:00