stackprotector.h 532 B

123456789101112131415161718192021
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_SH_STACKPROTECTOR_H
  3. #define __ASM_SH_STACKPROTECTOR_H
  4. extern unsigned long __stack_chk_guard;
  5. /*
  6. * Initialize the stackprotector canary value.
  7. *
  8. * NOTE: this must only be called from functions that never return,
  9. * and it must always be inlined.
  10. */
  11. static __always_inline void boot_init_stack_canary(void)
  12. {
  13. unsigned long canary = get_random_canary();
  14. current->stack_canary = canary;
  15. __stack_chk_guard = current->stack_canary;
  16. }
  17. #endif /* __ASM_SH_STACKPROTECTOR_H */