linux/arch/s390/include/asm
Gerald Schaefer 5f490a520b s390/mm: fix dynamic pagetable upgrade for hugetlbfs
Commit ee71d16d22 ("s390/mm: make TASK_SIZE independent from the number
of page table levels") changed the logic of TASK_SIZE and also removed the
arch_mmap_check() implementation for s390. This combination has a subtle
effect on how get_unmapped_area() for hugetlbfs pages works. It is now
possible that a user process establishes a hugetlbfs mapping at an address
above 4 TB, without triggering a dynamic pagetable upgrade from 3 to 4
levels.

This is because hugetlbfs mappings will not use mm->get_unmapped_area, but
rather file->f_op->get_unmapped_area, which currently is the generic
implementation of hugetlb_get_unmapped_area() that does not know about s390
dynamic pagetable upgrades, but with the new definition of TASK_SIZE, it
will now allow mappings above 4 TB.

Subsequent access to such a mapped address above 4 TB will result in a page
fault loop, because the CPU cannot translate such a large address with 3
pagetable levels. The fault handler will try to map in a hugepage at the
address, but due to the folded pagetable logic it will end up with creating
entries in the 3 level pagetable, possibly overwriting existing mappings,
and then it all repeats when the access is retried.

Apart from the page fault loop, this can have various nasty effects, e.g.
kernel panic from one of the BUG_ON() checks in memory management code,
or even data loss if an existing mapping gets overwritten.

Fix this by implementing HAVE_ARCH_HUGETLB_UNMAPPED_AREA support for s390,
providing an s390 version for hugetlb_get_unmapped_area() with pagetable
upgrade support similar to arch_get_unmapped_area(), which will then be
used instead of the generic version.

Fixes: ee71d16d22 ("s390/mm: make TASK_SIZE independent from the number of page table levels")
Cc: <stable@vger.kernel.org> # 4.12+
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2020-01-30 13:07:54 +01:00
..
fpu
trace
airq.h s390/airq: use DMA memory for adapter interrupts 2019-06-15 12:25:05 +02:00
alternative-asm.h
alternative.h s390/alternatives: make use of asm_inline 2019-10-31 17:20:51 +01:00
ap.h s390/zcrypt: Fix wrong dispatching for control domain CPRBs 2019-05-28 14:49:38 +02:00
appldata.h s390/appldata: pass parameter list pointer to appldata_asm 2018-10-09 11:20:50 +02:00
archrandom.h
asm-prototypes.h
atomic_ops.h s390/atomic,bitops: mark function(s) __always_inline 2019-10-04 16:37:33 +02:00
atomic.h locking/atomic, s390: Use s64 for atomic64 2019-06-03 12:32:56 +02:00
barrier.h
bitops.h kasan: support instrumented bitops combined with generic bitops 2019-11-07 13:15:39 +11:00
boot_data.h s390/ipl: read IPL report at early boot 2019-04-26 12:34:05 +02:00
bug.h s390: fix __EMIT_BUG() macro 2020-01-22 13:05:35 +01:00
bugs.h
cache.h
ccwdev.h s390/cio: add basic protected virtualization support 2019-06-15 12:25:00 +02:00
ccwgroup.h s390/ccwgroup: add get_ccwgroupdev_by_busid() 2018-10-08 09:09:59 +02:00
checksum.h
chpid.h
cio.h s390/cio: move struct node_descriptor to cio.h 2019-06-19 17:54:27 +02:00
clp.h
cmb.h
cmpxchg.h
compat.h asm-generic: Move common compat types to asm-generic/compat.h 2018-08-29 15:42:20 +02:00
cpacf.h s390: mark __cpacf_query() as __always_inline 2019-10-04 16:37:33 +02:00
cpcmd.h
cpu_mcf.h s390/cpum_cf_diag: Add support for s390 counter facility diagnostic trace 2019-02-22 09:19:56 +01:00
cpu_mf-insn.h s390/cpu_mf: add store cpu counter multiple instruction support 2019-02-22 09:19:52 +01:00
cpu_mf.h s390/cpum_sf: Replace function name in debug statements 2019-11-30 10:52:46 +01:00
cpu.h
cpufeature.h
cputime.h
crw.h
css_chars.h
ctl_reg.h s390/early: move control registers setup in C code 2019-11-20 12:58:12 +01:00
current.h
debug.h docs: s390: unify and update s390dbf kdocs at debug.c 2019-07-05 13:42:22 +02:00
delay.h
diag.h s390/kernel: introduce .dma sections 2019-04-29 10:47:10 +02:00
dis.h
dma.h
dwarf.h
eadm.h
ebcdic.h s390: fix clang -Wpointer-sign warnigns in boot code 2019-05-03 17:17:58 +02:00
elf.h s390: report new CPU capabilities 2019-04-25 15:34:10 +02:00
exec.h
extable.h s390/kernel: introduce .dma sections 2019-04-29 10:47:10 +02:00
extmem.h
facility.h s390: fix stfle zero padding 2019-06-19 17:54:27 +02:00
fcx.h
ftrace.h s390/ftrace: use HAVE_FUNCTION_GRAPH_RET_ADDR_PTR 2019-05-02 13:54:11 +02:00
futex.h
gmap.h s390/mm: use refcount_t for refcount 2019-08-21 12:41:43 +02:00
hardirq.h
hugetlb.h s390/mm: fix -Wunused-but-set-variable warnings 2019-10-04 16:37:33 +02:00
hw_irq.h
idals.h s390/idal: use struct_size() in kmalloc() 2019-06-04 15:03:18 +02:00
idle.h
io.h arch: rely on asm-generic/io.h for default ioremap_* definitions 2019-11-11 21:18:19 +01:00
ipl.h s390/kernel: introduce .dma sections 2019-04-29 10:47:10 +02:00
irq.h s390/pci: gather statistics for floating vs directed irqs 2019-04-29 10:47:01 +02:00
irqflags.h
isc.h KVM: s390: add gib_alert_irq_handler() 2019-02-05 14:29:23 +01:00
itcw.h
jump_label.h s390/jump_label: use "i" constraint for clang 2020-01-22 13:05:35 +01:00
kasan.h s390/kasan: add option for 4-level paging support 2018-10-09 11:21:29 +02:00
Kbuild Remove Mysterious Macro Intended to Obscure Weird Behaviours (mmiowb()) 2019-05-06 16:57:52 -07:00
kdebug.h
kexec.h s390/kernel: build a relocatable kernel 2019-04-29 10:47:10 +02:00
kprobes.h
kvm_host.h KVM: s390: count invalid yields 2019-10-10 13:18:38 +02:00
kvm_para.h
linkage.h s390/kernel: introduce .dma sections 2019-04-29 10:47:10 +02:00
livepatch.h livepatch: Remove klp_check_compiler_support() 2019-05-10 17:53:29 -04:00
lowcore.h s390: fix clang -Wpointer-sign warnigns in boot code 2019-05-03 17:17:58 +02:00
mem_detect.h s390/mem_detect: provide single get_mem_detect_end 2019-08-26 12:51:18 +02:00
mem_encrypt.h s390/mm: Remove sev_active() function 2019-08-09 22:52:11 +10:00
mmu_context.h s390/vdso: correct vdso mapping for compat tasks 2019-01-11 17:12:02 +01:00
mmu.h s390/vdso: avoid 64-bit vdso mapping for compat tasks 2018-09-20 13:20:29 +02:00
mmzone.h
module.h
nmi.h arch: replace _BITUL() in kernel-space headers with BIT() 2019-07-16 19:23:22 -07:00
nospec-branch.h
nospec-insn.h s390/nospec: rename assembler generated expoline thunks 2019-05-02 13:54:11 +02:00
numa.h
os_info.h
page-states.h
page.h s390/mm: fix dynamic pagetable upgrade for hugetlbfs 2020-01-30 13:07:54 +01:00
pci_clp.h PCI: Add PCI_STD_NUM_BARS for the number of standard BARs 2019-10-14 10:22:26 -05:00
pci_debug.h
pci_dma.h
pci_insn.h s390: fix setting of mio addressing control 2019-07-11 20:40:02 +02:00
pci_io.h s390/pci: move io address mapping code to pci_insn.c 2019-04-29 10:47:01 +02:00
pci.h s390/pci: Recover handle in clp_set_pci_fn() 2020-01-22 13:05:34 +01:00
percpu.h s390: enforce CONFIG_SMP 2019-06-07 10:09:37 +02:00
perf_event.h s390: implement perf_arch_fetch_caller_regs 2019-11-30 10:52:44 +01:00
pgalloc.h s390/mm: add mm_pxd_folded() checks to pxd_free() 2019-10-31 17:20:54 +01:00
pgtable.h s390/mm: properly clear _PAGE_NOEXEC bit when it is not supported 2019-10-31 17:20:54 +01:00
pkey.h s390/pkey: pkey cleanup: narrow in-kernel API, fix some variable types 2019-08-21 12:58:53 +02:00
pnet.h s390/net: move pnet constants 2019-02-07 18:06:18 -08:00
preempt.h sched/rt, s390: Use CONFIG_PREEMPTION 2019-12-08 14:37:35 +01:00
processor.h s390: always inline disabled_wait 2019-11-30 10:52:44 +01:00
ptrace.h arch: replace _BITUL() in kernel-space headers with BIT() 2019-07-16 19:23:22 -07:00
purgatory.h s390/purgatory: Remove duplicate variable definitions 2018-07-06 08:47:51 +02:00
qdio.h s390/qdio: move SSQD Sniffer mask definition 2019-10-31 17:20:52 +01:00
runtime_instr.h
schid.h
sclp.h s390/ipl: Fix detection of has_secure attribute 2019-07-11 20:40:02 +02:00
scsw.h
seccomp.h
sections.h locking/lockdep: check for freed initmem in static_obj() 2019-04-29 10:47:10 +02:00
serial.h
set_memory.h
setup.h s390: remove last diag 0x44 caller 2019-12-11 19:53:24 +01:00
shmparam.h
signal.h
sigp.h
smp.h s390: enforce CONFIG_HOTPLUG_CPU 2019-06-07 10:09:42 +02:00
sparsemem.h
spinlock_types.h
spinlock.h s390/alternatives: make use of asm_inline 2019-10-31 17:20:51 +01:00
stacktrace.h s390: fix register clobbering in CALL_ON_STACK 2019-11-30 10:52:47 +01:00
stp.h
string.h s390/kasan: provide uninstrumented __strlen 2019-08-21 12:58:52 +02:00
switch_to.h
syscall_wrapper.h s390: syscall_wrapper: avoid clang warning 2019-04-11 13:36:51 +02:00
syscall.h audit/stable-5.2 PR 20190507 2019-05-07 19:06:04 -07:00
sysinfo.h
termios.h
thread_info.h arch: replace _BITUL() in kernel-space headers with BIT() 2019-07-16 19:23:22 -07:00
timex.h s390/ftrace: fix endless recursion in function_graph tracer 2019-12-18 23:29:26 +01:00
tlb.h s390/tlb: Convert to generic mmu_gather 2019-04-03 10:32:57 +02:00
tlbflush.h s390: enforce CONFIG_SMP 2019-06-07 10:09:37 +02:00
topology.h
uaccess.h s390/uaccess: avoid (false positive) compiler warnings 2019-10-11 12:27:25 +02:00
unistd.h s390: wire up clone3 system call 2019-07-23 10:45:53 +02:00
unwind.h s390/unwind: start unwinding from reliable state 2019-11-30 10:52:48 +01:00
uprobes.h
user.h
uv.h s390/uv: use EOPNOTSUPP instead of ENOTSUPP 2019-12-11 19:53:24 +01:00
vdso.h s390/vdso: fix getcpu 2019-11-30 10:52:44 +01:00
vga.h
vmalloc.h mm/vmalloc: Add empty <asm/vmalloc.h> headers and use them from <linux/vmalloc.h> 2019-12-10 10:12:55 +01:00
vmlinux.lds.h s390: introduce .boot.preserved.data section 2019-04-10 17:47:09 +02:00
vtime.h
vtimer.h
vx-insn.h s390: add alignment hints to vector load and store 2019-02-07 11:57:10 +01:00
xor.h