Skip to content

Commit 8e411be

Browse files
committed
arm64: compat: Always use sigpage for sigreturn trampoline
The 32-bit sigreturn trampoline in the compat sigpage matches the binary representation of the arch/arm/ sigpage exactly. This is important for debuggers (e.g. GDB) and unwinders (e.g. libunwind) since they rely on matching the instruction sequence in order to identify that they are unwinding through a signal. The same cannot be said for the sigreturn trampoline in the compat vDSO, which defeats the unwinder heuristics and instead attempts to use unwind directives for the unwinding. This is in contrast to arch/arm/, which never uses the vDSO for sigreturn. Ensure compatibility with arch/arm/ and existing unwinders by always using the sigpage for the sigreturn trampoline, regardless of the presence of the compat vDSO. Reviewed-by: Vincenzo Frascino <[email protected]> Reviewed-by: Ard Biesheuvel <[email protected]> Reviewed-by: Mark Rutland <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent a39060b commit 8e411be

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

arch/arm64/kernel/signal32.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -342,38 +342,13 @@ static void compat_setup_return(struct pt_regs *regs, struct k_sigaction *ka,
342342
retcode = ptr_to_compat(ka->sa.sa_restorer);
343343
} else {
344344
/* 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
369345
unsigned int idx = thumb << 1;
370346

371347
if (ka->sa.sa_flags & SA_SIGINFO)
372348
idx += 3;
373349

374350
retcode = (unsigned long)current->mm->context.sigpage +
375351
(idx << 2) + thumb;
376-
#endif
377352
}
378353

379354
regs->regs[0] = usig;

0 commit comments

Comments
 (0)