Fix duplicate atomic_t typedef conflicting with types.h
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_STACKPROTECTOR_H
|
||||
#define _LINUX_STACKPROTECTOR_H 1
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/random.h>
|
||||
|
||||
/*
|
||||
* On 64-bit architectures, protect against non-terminated C string overflows
|
||||
* by zeroing out the first byte of the canary; this leaves 56 bits of entropy.
|
||||
*/
|
||||
#ifdef CONFIG_64BIT
|
||||
# ifdef __LITTLE_ENDIAN
|
||||
# define CANARY_MASK 0xffffffffffffff00UL
|
||||
# else /* big endian, 64 bits: */
|
||||
# define CANARY_MASK 0x00ffffffffffffffUL
|
||||
# endif
|
||||
#else /* 32 bits: */
|
||||
# define CANARY_MASK 0xffffffffUL
|
||||
#endif
|
||||
|
||||
static inline unsigned long get_random_canary(void)
|
||||
{
|
||||
return get_random_long() & CANARY_MASK;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_STACKPROTECTOR) || defined(CONFIG_ARM64_PTR_AUTH)
|
||||
# include <asm/stackprotector.h>
|
||||
#else
|
||||
static inline void boot_init_stack_canary(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user