mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
UPSTREAM: arm64: compat: Get sigreturn trampolines from vDSO
When the compat vDSO is enabled, the sigreturn trampolines are not
anymore available through [sigpage] but through [vdso].
Add the relevant code the enable the feature.
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Shijith Thotton <sthotton@marvell.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>
Cc: linux-arch@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mips@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Peter Collingbourne <pcc@google.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Dmitry Safonov <0x7f454c46@gmail.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Huw Davies <huw@codeweavers.com>
Link: https://lkml.kernel.org/r/20190621095252.32307-15-vincenzo.frascino@arm.com
(cherry picked from commit f01703b3d2)
Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 154668398
Change-Id: Ie720baf6f5b2a023e1e0fd3def19614c12aba333
This commit is contained in:
committed by
Alistair Delva
parent
8d5e92df4d
commit
b312f08a44
@@ -28,6 +28,9 @@
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <generated/vdso-offsets.h>
|
||||
#ifdef CONFIG_COMPAT_VDSO
|
||||
#include <generated/vdso32-offsets.h>
|
||||
#endif
|
||||
|
||||
#define VDSO_SYMBOL(base, name) \
|
||||
({ \
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <asm/traps.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <asm/unistd.h>
|
||||
#include <asm/vdso.h>
|
||||
|
||||
struct compat_vfp_sigframe {
|
||||
compat_ulong_t magic;
|
||||
@@ -352,6 +353,30 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka,
|
||||
retcode = ptr_to_compat(ka->sa.sa_restorer);
|
||||
} else {
|
||||
/* Set up sigreturn pointer */
|
||||
#ifdef CONFIG_COMPAT_VDSO
|
||||
void *vdso_base = current->mm->context.vdso;
|
||||
void *vdso_trampoline;
|
||||
|
||||
if (ka->sa.sa_flags & SA_SIGINFO) {
|
||||
if (thumb) {
|
||||
vdso_trampoline = VDSO_SYMBOL(vdso_base,
|
||||
compat_rt_sigreturn_thumb);
|
||||
} else {
|
||||
vdso_trampoline = VDSO_SYMBOL(vdso_base,
|
||||
compat_rt_sigreturn_arm);
|
||||
}
|
||||
} else {
|
||||
if (thumb) {
|
||||
vdso_trampoline = VDSO_SYMBOL(vdso_base,
|
||||
compat_sigreturn_thumb);
|
||||
} else {
|
||||
vdso_trampoline = VDSO_SYMBOL(vdso_base,
|
||||
compat_sigreturn_arm);
|
||||
}
|
||||
}
|
||||
|
||||
retcode = ptr_to_compat(vdso_trampoline) + thumb;
|
||||
#else
|
||||
unsigned int idx = thumb << 1;
|
||||
|
||||
if (ka->sa.sa_flags & SA_SIGINFO)
|
||||
@@ -359,6 +384,7 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka,
|
||||
|
||||
retcode = (unsigned long)current->mm->context.vdso +
|
||||
(idx << 2) + thumb;
|
||||
#endif
|
||||
}
|
||||
|
||||
regs->regs[0] = usig;
|
||||
|
||||
Reference in New Issue
Block a user