RISC-V: Shadow Stack / Landing Pad Support

Malhar Badve malharbadve2046@gmail.com
Fri Sep 4 06:55:15 GMT 2026


Hi Kito,

I'm Malhar Badve. I work with Umesh. Thank you for your reply.

As Umesh mentioned, we have been working on the software shadow stack and landing pad on RISC-V hardware.
We have also reviewed and tested the kcfi implementation by Kees Cook that you mentioned.

The implementation for software shadow stack is now complete in GCC.
We have tried to follow the LLVM implementation to make sure GCC aligns with LLVM.
We would like to send the patch upstream.

We would be grateful if you could look at it and share your feedback.

Thank you.

Kind regards,
Malhar Badve


________________________________
From: Kito Cheng <kito.cheng@gmail.com>
Sent: Monday, May 4, 2026 6:20 PM
To: Umesh Kalappa <ukalappa.mips@gmail.com>
Cc: kito.cheng@sifive.com <kito.cheng@sifive.com>; Jeff Law <jeffreyalaw@gmail.com>; malharbadve2046@gmail.com <malharbadve2046@gmail.com>; gcc-help@gcc.gnu.org <gcc-help@gcc.gnu.org>
Subject: Re: RISC-V: Shadow Stack / Landing Pad Support

LLVM has implement software shadow stack  and use gp as shadow stack pointer
https://clang.llvm.org/docs/ShadowCallStack.html

and there is -fsanitize=kcfi -fsanitize=cfi-icall and
-fsanitize=function on LLVM side as well, that is software landing
pad, the complexity is depend on how safe you want, like HW landing
pad we have unlabeled and function signature based (this is not
upstream yet, because it's not get stable...).

Kees Cook is working on KCFI supporting for gcc:
https://patchwork.sourceware.org/project/gcc/list/?series=56147 but I
didn't take too much closer look yet.

Umesh Kalappa <ukalappa.mips@gmail.com> 於 2026年5月4日週一 下午6:27寫道:
>
> Hi Kito,
>
> Regarding the subject, we are working with a RISC-V hardware platform that does not provide native support for landing pad or shadow stack features.
>
> As a result, we are exploring implementing (emulating) these mechanisms at the compiler (GCC) and runtime levels.
>
> Are you aware of any existing work, prior attempts, or ongoing efforts in this direction?
>
> Thank you and Good Day
>
> ~U


More information about the Gcc-help mailing list