linux-stable/arch
Linus Torvalds 6b008640db mm: move 'mmap_min_addr' logic from callers into vm_unmapped_area()
Instead of having callers care about the mmap_min_addr logic for the
lowest valid mapping address (and some of them getting it wrong), just
move the logic into vm_unmapped_area() itself.  One less thing for various
architecture cases (and generic helpers) to worry about.

We should really try to make much more of this be common code, but baby
steps..

Without this, vm_unmapped_area() could return an address below
mmap_min_addr (because some caller forgot about that).  That then causes
the mmap machinery to think it has found a workable address, but then
later security_mmap_addr(addr) is unhappy about it and the mmap() returns
with a nonsensical error (EPERM).

The proper action is to either return ENOMEM (if the virtual address space
is exhausted), or try to find another address (ie do a bottom-up search
for free addresses after the top-down one failed).

See commit 2afc745f3e ("mm: ensure get_unmapped_area() returns higher
address than mmap_min_addr"), which fixed this for one call site (the
generic arch_get_unmapped_area_topdown() fallback) but left other cases
alone.

Link: https://lkml.kernel.org/r/20230418214009.1142926-1-Liam.Howlett@oracle.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Liam Howlett <liam.howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-04-21 14:52:05 -07:00
..
alpha alpha: fix lazy-FPU mis(merged/applied/whatnot) 2023-03-06 20:13:49 -05:00
arc mm: make arch_has_descending_max_zone_pfns() static 2023-04-18 16:29:42 -07:00
arm arm: reword ARCH_FORCE_MAX_ORDER prompt and help text 2023-04-18 16:29:43 -07:00
arm64 arm64: reword ARCH_FORCE_MAX_ORDER prompt and help text 2023-04-18 16:29:44 -07:00
csky csky: drop ARCH_FORCE_MAX_ORDER 2023-04-18 16:29:44 -07:00
hexagon VM_FAULT_RETRY fixes 2023-03-05 11:07:58 -08:00
ia64 ia64: don't allow users to override ARCH_FORCE_MAX_ORDER 2023-04-18 16:29:44 -07:00
loongarch mm/hugetlb_vmemmap: rename ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP 2023-04-18 16:30:09 -07:00
m68k m68k/mm: use correct bit number in _PAGE_SWP_EXCLUSIVE comment 2023-04-18 16:29:53 -07:00
microblaze VM_FAULT_RETRY fixes 2023-03-05 11:07:58 -08:00
mips mips: fix comment about pgtable_init() 2023-04-05 19:42:52 -07:00
nios2 nios2: drop ranges for definition of ARCH_FORCE_MAX_ORDER 2023-04-18 16:29:45 -07:00
openrisc VM_FAULT_RETRY fixes 2023-03-05 11:07:58 -08:00
parisc VM_FAULT_RETRY fixes 2023-03-05 11:07:58 -08:00
powerpc powerpc: drop ranges for definition of ARCH_FORCE_MAX_ORDER 2023-04-18 16:29:45 -07:00
riscv RISC-V Fixes for 6.3-rc4 2023-03-24 09:52:26 -07:00
s390 mm: move 'mmap_min_addr' logic from callers into vm_unmapped_area() 2023-04-21 14:52:05 -07:00
sh sh: drop ranges for definition of ARCH_FORCE_MAX_ORDER 2023-04-18 16:29:46 -07:00
sparc sparc/mm: don't unconditionally set HW writable bit when setting PTE dirty on 64bit 2023-04-18 16:30:00 -07:00
um mm, treewide: redefine MAX_ORDER sanely 2023-04-05 19:42:46 -07:00
x86 mm/hugetlb_vmemmap: rename ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP 2023-04-18 16:30:09 -07:00
xtensa xtensa: reword ARCH_FORCE_MAX_ORDER prompt and help text 2023-04-18 16:29:46 -07:00
.gitignore
Kconfig lazy tlb: shoot lazies, non-refcounting lazy tlb mm reference handling scheme 2023-03-28 16:20:08 -07:00