blob: b5f0bda9472e0720d5d1abb9368cf2b5ae0f5478 [file] [log] [blame]
Kees Cook2b68f6c2015-04-14 15:48:00 -07001#ifndef _ELF_RANDOMIZE_H
2#define _ELF_RANDOMIZE_H
3
Kees Cook204db6e2015-04-14 15:48:12 -07004struct mm_struct;
5
Kees Cook2b68f6c2015-04-14 15:48:00 -07006#ifndef CONFIG_ARCH_HAS_ELF_RANDOMIZE
7static inline unsigned long arch_mmap_rnd(void) { return 0; }
Kees Cook204db6e2015-04-14 15:48:12 -07008# if defined(arch_randomize_brk) && defined(CONFIG_COMPAT_BRK)
9# define compat_brk_randomized
10# endif
11# ifndef arch_randomize_brk
12# define arch_randomize_brk(mm) (mm->brk)
13# endif
Kees Cook2b68f6c2015-04-14 15:48:00 -070014#else
15extern unsigned long arch_mmap_rnd(void);
Kees Cook204db6e2015-04-14 15:48:12 -070016extern unsigned long arch_randomize_brk(struct mm_struct *mm);
17# ifdef CONFIG_COMPAT_BRK
18# define compat_brk_randomized
19# endif
Kees Cook2b68f6c2015-04-14 15:48:00 -070020#endif
21
22#endif