linux/arch/um/kernel
Patricia Alfonso 5b301409e8 UML: add support for KASAN under x86_64
Make KASAN run on User Mode Linux on x86_64.

The UML-specific KASAN initializer uses mmap to map the ~16TB of shadow
memory to the location defined by KASAN_SHADOW_OFFSET.  kasan_init()
utilizes constructors to initialize KASAN before main().

The location of the KASAN shadow memory, starting at
KASAN_SHADOW_OFFSET, can be configured using the KASAN_SHADOW_OFFSET
option. The default location of this offset is 0x100000000000, which
keeps it out-of-the-way even on UML setups with more "physical" memory.

For low-memory setups, 0x7fff8000 can be used instead, which fits in an
immediate and is therefore faster, as suggested by Dmitry Vyukov. There
is usually enough free space at this location; however, it is a config
option so that it can be easily changed if needed.

Note that, unlike KASAN on other architectures, vmalloc allocations
still use the shadow memory allocated upfront, rather than allocating
and free-ing it per-vmalloc allocation.

If another architecture chooses to go down the same path, we should
replace the checks for CONFIG_UML with something more generic, such
as:
- A CONFIG_KASAN_NO_SHADOW_ALLOC option, which architectures could set
- or, a way of having architecture-specific versions of these vmalloc
  and module shadow memory allocation options.

Also note that, while UML supports both KASAN in inline mode
(CONFIG_KASAN_INLINE) and static linking (CONFIG_STATIC_LINK), it does
not support both at the same time.

Signed-off-by: Patricia Alfonso <trishalfonso@google.com>
Co-developed-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Signed-off-by: David Gow <davidgow@google.com>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Andrey Konovalov <andreyknvl@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
2022-07-17 23:35:22 +02:00
..
skas Peter Zijlstra says: 2022-01-11 17:24:45 -08:00
asm-offsets.c um: get rid of pointless include "..." where include <...> will do 2012-10-09 22:28:45 +02:00
config.c.in um: Add SPDX headers to files in arch/um/kernel/ 2019-09-15 21:37:17 +02:00
dtb.c um: Fix order of dtb unflatten/early init 2022-03-11 10:44:43 +01:00
dyn.lds.S UML: add support for KASAN under x86_64 2022-07-17 23:35:22 +02:00
early_printk.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
exec.c ptrace/um: Replace PT_DTRACE with TIF_SINGLESTEP 2022-05-11 14:33:33 -05:00
exitcode.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
gprof_syms.c um: Add SPDX headers to files in arch/um/kernel/ 2019-09-15 21:37:17 +02:00
initrd.c um: Extract load file helper from initrd.c 2021-12-22 20:32:36 +01:00
ioport.c um: add PCI over virtio emulation driver 2021-06-17 21:45:43 +02:00
irq.c um: add PCI over virtio emulation driver 2021-06-17 21:45:43 +02:00
kmsg_dump.c printk: introduce a kmsg_dump iterator 2021-03-08 11:43:27 +01:00
ksyms.c um: rename set_signals() to um_set_signals() 2021-12-21 21:13:44 +01:00
load_file.c um: Extract load file helper from initrd.c 2021-12-22 20:32:36 +01:00
maccess.c maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault 2020-06-17 10:57:41 -07:00
Makefile um: Add devicetree support 2021-12-22 20:35:01 +01:00
mem.c UML: add support for KASAN under x86_64 2022-07-17 23:35:22 +02:00
physmem.c um: Add SPDX headers to files in arch/um/kernel/ 2019-09-15 21:37:17 +02:00
process.c While looking at the ptrace problems with PREEMPT_RT and the problems 2022-06-03 16:13:25 -07:00
ptrace.c ptrace/um: Replace PT_DTRACE with TIF_SINGLESTEP 2022-05-11 14:33:33 -05:00
reboot.c um: Add SPDX headers to files in arch/um/kernel/ 2019-09-15 21:37:17 +02:00
sigio.c um: Support dynamic IRQ allocation 2020-12-13 22:22:08 +01:00
signal.c ptrace/um: Replace PT_DTRACE with TIF_SINGLESTEP 2022-05-11 14:33:33 -05:00
stacktrace.c UML: add support for KASAN under x86_64 2022-07-17 23:35:22 +02:00
sysrq.c um: Clean up stacktrace dump 2020-10-11 23:25:07 +02:00
time.c um: time-travel/signals: fix ndelay() in interrupt 2021-06-17 21:44:52 +02:00
tlb.c um: remove process stub VMA 2021-02-12 21:37:38 +01:00
trap.c Merge branch 'akpm' (patches from Andrew) 2022-01-15 20:37:06 +02:00
um_arch.c x86/alternative: Use .ibt_endbr_seal to seal indirect calls 2022-03-15 10:32:47 +01:00
um_arch.h um: Add devicetree support 2021-12-22 20:35:01 +01:00
umid.c um: Add SPDX headers to files in arch/um/kernel/ 2019-09-15 21:37:17 +02:00
uml.lds.S arch: um: Fix build for statically linked UML w/ constructors 2022-07-17 23:14:34 +02:00
vmlinux.lds.S