blob: da0dbb7b6be3b8713ff8068fa51794415242746d [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Kees Cook2b68f6c2015-04-14 15:48:00 -07002#ifndef _ELF_RANDOMIZE_H
3#define _ELF_RANDOMIZE_H
4
Kees Cook204db6e2015-04-14 15:48:12 -07005struct mm_struct;
6
Kees Cook2b68f6c2015-04-14 15:48:00 -07007#ifndef CONFIG_ARCH_HAS_ELF_RANDOMIZE
8static inline unsigned long arch_mmap_rnd(void) { return 0; }
Kees Cook204db6e2015-04-14 15:48:12 -07009# if defined(arch_randomize_brk) && defined(CONFIG_COMPAT_BRK)
10# define compat_brk_randomized
11# endif
12# ifndef arch_randomize_brk
13# define arch_randomize_brk(mm) (mm->brk)
14# endif
Kees Cook2b68f6c2015-04-14 15:48:00 -070015#else
16extern unsigned long arch_mmap_rnd(void);
Kees Cook204db6e2015-04-14 15:48:12 -070017extern unsigned long arch_randomize_brk(struct mm_struct *mm);
18# ifdef CONFIG_COMPAT_BRK
19# define compat_brk_randomized
20# endif
Kees Cook2b68f6c2015-04-14 15:48:00 -070021#endif
22
23#endif