Skip to content

Commit f01703b

Browse files
thule-vincenzoKAGA-KOKO
authored andcommitted
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
1 parent 1e3f17f commit f01703b

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎arch/arm64/include/asm/vdso.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#ifndef __ASSEMBLY__
1818

1919
#include <generated/vdso-offsets.h>
20+
#ifdef CONFIG_COMPAT_VDSO
21+
#include <generated/vdso32-offsets.h>
22+
#endif
2023

2124
#define VDSO_SYMBOL(base, name) \
2225
({ \

‎arch/arm64/kernel/signal32.c‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <asm/traps.h>
1919
#include <linux/uaccess.h>
2020
#include <asm/unistd.h>
21+
#include <asm/vdso.h>
2122

2223
struct compat_vfp_sigframe {
2324
compat_ulong_t magic;
@@ -341,13 +342,38 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka,
341342
retcode = ptr_to_compat(ka->sa.sa_restorer);
342343
} else {
343344
/* Set up sigreturn pointer */
345+
#ifdef CONFIG_COMPAT_VDSO
346+
void *vdso_base = current->mm->context.vdso;
347+
void *vdso_trampoline;
348+
349+
if (ka->sa.sa_flags & SA_SIGINFO) {
350+
if (thumb) {
351+
vdso_trampoline = VDSO_SYMBOL(vdso_base,
352+
compat_rt_sigreturn_thumb);
353+
} else {
354+
vdso_trampoline = VDSO_SYMBOL(vdso_base,
355+
compat_rt_sigreturn_arm);
356+
}
357+
} else {
358+
if (thumb) {
359+
vdso_trampoline = VDSO_SYMBOL(vdso_base,
360+
compat_sigreturn_thumb);
361+
} else {
362+
vdso_trampoline = VDSO_SYMBOL(vdso_base,
363+
compat_sigreturn_arm);
364+
}
365+
}
366+
367+
retcode = ptr_to_compat(vdso_trampoline) + thumb;
368+
#else
344369
unsigned int idx = thumb << 1;
345370

346371
if (ka->sa.sa_flags & SA_SIGINFO)
347372
idx += 3;
348373

349374
retcode = (unsigned long)current->mm->context.vdso +
350375
(idx << 2) + thumb;
376+
#endif
351377
}
352378

353379
regs->regs[0] = usig;

0 commit comments

Comments
 (0)