xref: /linux/include/linux/elf-randomize.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
22b68f6caSKees Cook #ifndef _ELF_RANDOMIZE_H
32b68f6caSKees Cook #define _ELF_RANDOMIZE_H
42b68f6caSKees Cook 
5204db6edSKees Cook struct mm_struct;
6204db6edSKees Cook 
72b68f6caSKees Cook #ifndef CONFIG_ARCH_HAS_ELF_RANDOMIZE
arch_mmap_rnd(void)82b68f6caSKees Cook static inline unsigned long arch_mmap_rnd(void) { return 0; }
9204db6edSKees Cook # if defined(arch_randomize_brk) && defined(CONFIG_COMPAT_BRK)
10204db6edSKees Cook #  define compat_brk_randomized
11204db6edSKees Cook # endif
12204db6edSKees Cook # ifndef arch_randomize_brk
13204db6edSKees Cook #  define arch_randomize_brk(mm)	(mm->brk)
14204db6edSKees Cook # endif
152b68f6caSKees Cook #else
162b68f6caSKees Cook extern unsigned long arch_mmap_rnd(void);
17204db6edSKees Cook extern unsigned long arch_randomize_brk(struct mm_struct *mm);
18204db6edSKees Cook # ifdef CONFIG_COMPAT_BRK
19204db6edSKees Cook #  define compat_brk_randomized
20204db6edSKees Cook # endif
212b68f6caSKees Cook #endif
222b68f6caSKees Cook 
232b68f6caSKees Cook #endif
24