linux/arch/s390
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
..
appldata s390/appldata: remove power management callbacks 2022-12-02 18:25:04 +01:00
boot s390/ipl: add missing intersection check to ipl_report handling 2023-03-13 09:15:11 +01:00
configs s390: update defconfigs 2023-03-13 09:15:11 +01:00
crypto This update includes the following changes: 2023-02-21 18:10:50 -08:00
hypfs s390/hypfs: remove unused info_blk_hdr__pcpus() function 2022-11-23 16:24:07 +01:00
include mm: add PTE pointer parameter to flush_tlb_fix_spurious_fault() 2023-03-28 16:20:12 -07:00
kernel s390 updates for 6.3 merge window part 2 2023-03-03 09:38:01 -08:00
kvm * Two more V!=R patches 2023-02-15 12:35:26 -05:00
lib s390/kprobes: replace kretprobe with rethook 2023-01-22 18:42:35 +01:00
mm mm: move 'mmap_min_addr' logic from callers into vm_unmapped_area() 2023-04-21 14:52:05 -07:00
net s390/bpf: Implement bpf_jit_supports_kfunc_call() 2023-01-29 19:16:29 -08:00
pci PCI: s390: Fix use-after-free of PCI resources with per-function hotplug 2023-03-13 09:15:11 +01:00
purgatory s390/purgatory: Remove unused '-MD' and unnecessary '-c' flags 2023-01-26 12:43:05 +09:00
tools KVM: s390: Add facility 197 to the allow list 2022-07-13 15:25:25 +02:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig mm/hugetlb_vmemmap: rename ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP 2023-04-18 16:30:09 -07:00
Kconfig.debug s390/Kconfig.debug: fix indentation 2022-06-01 12:03:15 +02:00
Makefile s390: always build relocatable kernel 2022-11-08 19:32:32 +01:00