]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: compat: Ensure upper 32 bits of x0 are zero on syscall return
authorWill Deacon <will@kernel.org>
Fri, 3 Jul 2020 11:08:42 +0000 (12:08 +0100)
committerWill Deacon <will@kernel.org>
Thu, 16 Jul 2020 10:41:31 +0000 (11:41 +0100)
commit65552fe7ef7d5f64b57916ed2aa9ea03377c63d0
tree7e7e6e911ca9ccbf33c0db2aaa54be3b59e022da
parente1314d7ba56e80c50ae05371f45b2154e5eea12e
arm64: compat: Ensure upper 32 bits of x0 are zero on syscall return

Although we zero the upper bits of x0 on entry to the kernel from an
AArch32 task, we do not clear them on the exception return path and can
therefore expose 64-bit sign extended syscall return values to userspace
via interfaces such as the 'perf_regs' ABI, which deal exclusively with
64-bit registers.

Explicitly clear the upper 32 bits of x0 on return from a compat system
call.

Cc: <stable@vger.kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Keno Fischer <keno@juliacomputing.com>
Cc: Luis Machado <luis.machado@linaro.org>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/syscall.h
arch/arm64/kernel/syscall.c