linux/arch/s390/kernel
Vasily Gorbik 42db5ed860 s390/kasan: add initialization code and enable it
Kasan needs 1/8 of kernel virtual address space to be reserved as the
shadow area. And eventually it requires the shadow memory offset to be
known at compile time (passed to the compiler when full instrumentation
is enabled).  Any value picked as the shadow area offset for 3-level
paging would eat up identity mapping on 4-level paging (with 1PB
shadow area size). So, the kernel sticks to 3-level paging when kasan
is enabled. 3TB border is picked as the shadow offset.  The memory
layout is adjusted so, that physical memory border does not exceed
KASAN_SHADOW_START and vmemmap does not go below KASAN_SHADOW_END.

Due to the fact that on s390 paging is set up very late and to cover
more code with kasan instrumentation, temporary identity mapping and
final shadow memory are set up early. The shadow memory mapping is
later carried over to init_mm.pgd during paging_init.

For the needs of paging structures allocation and shadow memory
population a primitive allocator is used, which simply chops off
memory blocks from the end of the physical memory.

Kasan currenty doesn't track vmemmap and vmalloc areas.

Current memory layout (for 3-level paging, 2GB physical memory).

---[ Identity Mapping ]---
0x0000000000000000-0x0000000000100000
---[ Kernel Image Start ]---
0x0000000000100000-0x0000000002b00000
---[ Kernel Image End ]---
0x0000000002b00000-0x0000000080000000        2G <- physical memory border
0x0000000080000000-0x0000030000000000     3070G PUD I
---[ Kasan Shadow Start ]---
0x0000030000000000-0x0000030010000000      256M PMD RW X  <- shadow for 2G memory
0x0000030010000000-0x0000037ff0000000   523776M PTE RO NX <- kasan zero ro page
0x0000037ff0000000-0x0000038000000000      256M PMD RW X  <- shadow for 2G modules
---[ Kasan Shadow End ]---
0x0000038000000000-0x000003d100000000      324G PUD I
---[ vmemmap Area ]---
0x000003d100000000-0x000003e080000000
---[ vmalloc Area ]---
0x000003e080000000-0x000003ff80000000
---[ Modules Area ]---
0x000003ff80000000-0x0000040000000000        2G

Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2018-10-09 11:21:20 +02:00
..
syscalls kbuild: do not redirect the first prerequisite for filechk 2018-07-28 10:34:10 +09:00
vdso32 s390/kasan: avoid vdso instrumentation 2018-10-09 11:21:16 +02:00
vdso64 s390/kasan: avoid vdso instrumentation 2018-10-09 11:21:16 +02:00
.gitignore s390: add various .gitignore files. 2012-05-16 14:42:41 +02:00
alternative.c s390: add automatic detection of the spectre defense 2018-03-28 08:38:24 +02:00
asm-offsets.c s390: add support for virtually mapped kernel stacks 2018-10-09 11:20:57 +02:00
audit.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
audit.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
base.S s390: add support for virtually mapped kernel stacks 2018-10-09 11:20:57 +02:00
cache.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
compat_audit.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
compat_linux.c mm: add ksys_readahead() helper; remove in-kernel calls to sys_readahead() 2018-04-02 20:16:12 +02:00
compat_linux.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
compat_ptrace.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
compat_signal.c s390/compat: fix setup_frame32 2018-04-10 07:38:54 +02:00
compat_wrapper.c s390: wire up rseq system call 2018-07-04 08:35:18 +02:00
cpcmd.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
crash_dump.c s390/kdump: Remove kzalloc_panic 2018-08-16 14:49:15 +02:00
debug.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
diag.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
dis.c s390: kernel: add SPDX identifiers to the remaining files 2017-11-24 15:37:12 +01:00
dumpstack.c s390: unify stack size definitions 2018-10-09 11:20:58 +02:00
early_nobss.c s390/kasan: add initialization code and enable it 2018-10-09 11:21:20 +02:00
early_printk.c s390/hibernate: fix error handling when suspend cpu != resume cpu 2018-09-20 13:20:23 +02:00
early.c s390: move ipl block and cmd line handling to early boot phase 2018-10-09 11:21:14 +02:00
ebcdic.c s390: ebcdic: convert comments to UTF-8 2018-08-23 18:48:43 -07:00
entry.h s390: add support for virtually mapped kernel stacks 2018-10-09 11:20:57 +02:00
entry.S s390: add support for virtually mapped kernel stacks 2018-10-09 11:20:57 +02:00
fpu.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ftrace.c s390/ftrace: Add -mfentry and -mnop-mcount support 2018-08-15 22:39:53 -04:00
guarded_storage.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2017-11-13 11:47:01 -08:00
head64.S s390: add support for virtually mapped kernel stacks 2018-10-09 11:20:57 +02:00
idle.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ipl_vmparm.c s390: move ipl block and cmd line handling to early boot phase 2018-10-09 11:21:14 +02:00
ipl.c s390: move ipl block and cmd line handling to early boot phase 2018-10-09 11:21:14 +02:00
irq.c s390: unify stack size definitions 2018-10-09 11:20:58 +02:00
jump_label.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kdebugfs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
kexec_elf.c s390/kexec_file: Add ELF loader 2018-04-16 09:10:23 +02:00
kexec_image.c s390/kexec_file: Add crash support to image loader 2018-04-16 09:10:22 +02:00
kprobes.c bpf/error-inject/kprobes: Clear current_kprobe and enable preempt in kprobe 2018-06-21 12:33:19 +02:00
lgr.c s390: kernel: add SPDX identifiers to the remaining files 2017-11-24 15:37:12 +01:00
machine_kexec_file.c s390/kexec_file: Add ELF loader 2018-04-16 09:10:23 +02:00
machine_kexec.c s390: add support for virtually mapped kernel stacks 2018-10-09 11:20:57 +02:00
Makefile s390/kasan: avoid instrumentation of early C code 2018-10-09 11:21:17 +02:00
mcount.S s390/ftrace: Add -mfentry and -mnop-mcount support 2018-08-15 22:39:53 -04:00
module.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
nmi.c headers: untangle kmemleak.h from mm.h 2018-04-05 21:36:27 -07:00
nospec-branch.c s390: detect etoken facility 2018-07-18 08:32:17 +02:00
nospec-sysfs.c s390: detect etoken facility 2018-07-18 08:32:17 +02:00
os_info.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
perf_cpum_cf_events.c treewide: kmalloc() -> kmalloc_array() 2018-06-12 16:19:22 -07:00
perf_cpum_cf.c s390: kernel: Remove redundant license text 2017-11-24 15:37:20 +01:00
perf_cpum_sf.c Merge branch 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2018-08-21 13:47:29 -07:00
perf_event.c s390: kernel: Remove redundant license text 2017-11-24 15:37:20 +01:00
perf_regs.c s390/perf: fix gcc 8 array-bounds warning 2018-07-02 11:24:54 +02:00
pgm_check.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
process.c s390: update sampling tag after task pid change 2018-04-23 07:57:17 +02:00
processor.c s390: run user space and KVM guests with modified branch prediction 2018-02-05 14:48:50 +01:00
ptrace.c s390/gs: add compat regset for the guarded storage broadcast control block 2017-11-28 17:33:15 +01:00
reipl.S s390/kernel: use expoline for indirect branches 2018-05-07 21:12:39 +02:00
relocate_kernel.S s390: assume diag308 set always works 2018-04-10 07:38:59 +02:00
runtime_instr.c s390/runtime_instrumentation: re-add signum system call parameter 2018-02-05 07:34:50 +01:00
setup.c s390/kasan: add initialization code and enable it 2018-10-09 11:21:20 +02:00
signal.c s390: wire up rseq system call 2018-07-04 08:35:18 +02:00
smp.c s390: unify stack size definitions 2018-10-09 11:20:58 +02:00
stacktrace.c s390: kernel: add SPDX identifiers to the remaining files 2017-11-24 15:37:12 +01:00
sthyi.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
suspend.c s390: unify linker symbols usage 2018-02-27 08:05:23 +01:00
swsusp.S s390: add support for virtually mapped kernel stacks 2018-10-09 11:20:57 +02:00
sys_s390.c mm: add ksys_mmap_pgoff() helper; remove in-kernel calls to sys_mmap_pgoff() 2018-04-02 20:16:11 +02:00
sysinfo.c s390/sysinfo: add missing #ifdef CONFIG_PROC_FS 2018-07-02 12:32:20 +02:00
time.c s390/time: Remove read_boot_clock64() 2018-07-20 00:02:41 +02:00
topology.c s390/topology: correct topology mode proc handler 2018-07-06 08:47:53 +02:00
trace.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
traps.c signal/s390: Use force_sig_fault where appropriate 2018-04-25 10:44:08 -05:00
uprobes.c s390/uprobes: implement arch_uretprobe_is_alive() 2018-04-23 07:57:16 +02:00
vdso.c s390/vdso: avoid 64-bit vdso mapping for compat tasks 2018-09-20 13:20:29 +02:00
vmlinux.lds.S s390: introduce .boot.data section 2018-10-09 11:21:06 +02:00
vtime.c s390: kernel: add SPDX identifiers to the remaining files 2017-11-24 15:37:12 +01:00