[PATCH] arch/riscv: vdso: remove CFI landing pad from rt_sigreturn

Joel Stanley joel at jms.id.au
Mon Jun 29 00:38:02 PDT 2026


On Fri, 26 Jun 2026 at 03:33, Paul Walmsley <pjw at kernel.org> wrote:
>
> Hi Joel,
>
> On Tue, 23 Jun 2026, Aurelien Jarno wrote:
>
> > When CONFIG_RISCV_USER_CFI is enabled, the CFI version of the vDSO, has
> > a CFI landing pad instruction at the start of __vdso_rt_sigreturn. This
> > breaks libgcc's unwinding code which matches on the first two
> > instructions. Other unwinders that rely on similar instruction matching
> > may also be affected.
> >
> > Since __vdso_rt_sigreturn is reached as part of signal-return handling
> > rather than via an indirect call/jump from userspace, it does not need a
> > CFI landing pad. Remove it and restore the instruction sequence expected
> > by existing unwinding code.
> >
> > This matches what was done on arm64 in commit 9a964285572b ("arm64:
> > vdso: Don't prefix sigreturn trampoline with a BTI C instruction") for a
> > similar issue.
> >
> > Fixes: 37f57bd3faea ("arch/riscv: compile vdso with landing pad and shadow stack note")
> > Co-authored-by: Joel Stanley <joel at jms.id.au>
> > Signed-off-by: Aurelien Jarno <aurelien at aurel32.net>
>
> I'd like to take this one.   But since you're listed as the co-author, I
> probably need your Signed-off-by: as well.  Care to reply with it?

Signed-off-by: Joel Stanley <joel at jms.id.au>

Thanks Aurelien for working with me on this one. I saw CFI was
disabled in the debian kernel config and wondered why (failing glibc
backtrace tests with CFI enabled), and we got to the bottom of it.

This one should go to stable IMO.

Cheers,

Joel



More information about the linux-riscv mailing list