[patch 03/18] entry: Provide [syscall_]enter_from_user_mode_randomize_stack()
Philippe Mathieu-Daudé
philmd at oss.qualcomm.com
Thu Jul 9 04:15:11 PDT 2026
On 7/7/26 21:06, Thomas Gleixner wrote:
> Randomizing the syscall stack can only happen after state is established
> via enter_from_user_mode() or syscall_enter_from_user_mode(). The earlier
> it happens the better.
>
> Provide two new macros to consolidate that:
>
> - enter_from_user_mode_randomize_stack()
> enter_from_user_mode();
> add_random_kstack_offset_irqsoff();
>
> - syscall_enter_from_user_mode_randomize_stack()
> enter_from_user_mode_randomize_stack();
> syscall_enter_from_user_mode_work();
>
> to reduce boiler plate code.
>
> Those are macros and not inline functions as the latter would limit the
> stack randomization scope to the inline function itself.
>
> Signed-off-by: Thomas Gleixner <tglx at kernel.org>
> ---
> include/linux/entry-common.h | 56 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 56 insertions(+)
Reviewed-by: Philippe Mathieu-Daudé <philmd at oss.qualcomm.com>
More information about the linux-riscv
mailing list