Lines Matching +full:1 +full:- +full:47

1 // SPDX-License-Identifier: GPL-2.0-or-later
8 * Copyright 2003-2009 Red Hat Inc.
21 #include <linux/elf-randomize.h>
28 .flags = -1,
44 if (current->flags & PF_RANDOMIZE) { in stack_maxrandom_size()
45 max = (-1UL) & __STACK_RND_MASK(task_size == task_size_32bit()); in stack_maxrandom_size()
64 if (current->personality & ADDR_COMPAT_LAYOUT) in mmap_is_legacy()
65 return 1; in mmap_is_legacy()
72 if (!(current->flags & PF_RANDOMIZE)) in arch_rnd()
74 return (get_random_long() & ((1UL << rndbits) - 1)) << PAGE_SHIFT; in arch_rnd()
85 unsigned long gap = rlim_stack->rlim_cur; in mmap_base()
105 return PAGE_ALIGN(task_size - gap - rnd); in mmap_base()
132 clear_bit(MMF_TOPDOWN, &mm->flags); in arch_pick_mmap_layout()
134 set_bit(MMF_TOPDOWN, &mm->flags); in arch_pick_mmap_layout()
136 arch_pick_mmap_base(&mm->mmap_base, &mm->mmap_legacy_base, in arch_pick_mmap_layout()
143 * syscall type (64-bit or compat). This applies for 64bit in arch_pick_mmap_layout()
147 arch_pick_mmap_base(&mm->mmap_compat_base, &mm->mmap_compat_legacy_base, in arch_pick_mmap_layout()
155 struct mm_struct *mm = current->mm; in get_mmap_base()
159 return is_legacy ? mm->mmap_compat_legacy_base in get_mmap_base()
160 : mm->mmap_compat_base; in get_mmap_base()
163 return is_legacy ? mm->mmap_legacy_base : mm->mmap_base; in get_mmap_base()
167 * mmap_address_hint_valid - Validate the address hint of mmap
175 * On 64bit with 5-level page tables another sanity check is required
176 * because mappings requested by mmap(@addr, 0) which cross the 47-bit
180 * is below the border of the 47-bit address space and @addr + @len is
183 * With 4-level paging this request succeeds, but the resulting mapping
184 * address will always be within the 47-bit virtual address space, because
187 * addresses above 47-bit work correctly.
189 * With 5-level paging this request would be granted and result in a
190 * mapping which crosses the border of the 47-bit virtual address
191 * space. If the application cannot handle addresses above 47-bit this
195 * the 47-bit virtual address boundary.
198 * different. The request with @addr < 47-bit and @addr + @len > 47-bit
199 * fails on a 4-level paging machine but succeeds on a 5-level paging
206 if (TASK_SIZE - len < addr) in mmap_address_hint_valid()
215 return addr + count - 1 <= __pa(high_memory - 1); in valid_phys_addr_range()
223 return phys_addr_valid(addr + count - 1); in valid_mmap_phys_addr_range()