Commit 79b7e67b authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'for-linus-5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml

Pull UML updates from Richard Weinberger:

 - KASAN support for x86_64

 - noreboot command line option, just like qemu's -no-reboot

 - Various fixes and cleanups

* tag 'for-linus-5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
  um: include sys/types.h for size_t
  um: Replace to_phys() and to_virt() with less generic function names
  um: Add missing apply_returns()
  um: add "noreboot" command line option for PANIC_TIMEOUT=-1 setups
  um: include linux/stddef.h for __always_inline
  UML: add support for KASAN under x86_64
  mm: Add PAGE_ALIGN_DOWN macro
  um: random: Don't initialise hwrng struct with zero
  um: remove unused mm_copy_segments
  um: remove unused variable
  um: Remove straying parenthesis
  um: x86: print RIP with symbol
  arch: um: Fix build for statically linked UML w/ constructors
  x86/um: Kconfig: Fix indentation
  um/drivers: Kconfig: Fix indentation
  um: Kconfig: Fix indentation
parents 4d5398a3 af3e1610
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -12,6 +12,8 @@ config UML
	select ARCH_HAS_STRNLEN_USER
	select ARCH_NO_PREEMPT
	select HAVE_ARCH_AUDITSYSCALL
	select HAVE_ARCH_KASAN if X86_64
	select HAVE_ARCH_KASAN_VMALLOC if HAVE_ARCH_KASAN
	select HAVE_ARCH_SECCOMP_FILTER
	select HAVE_ASM_MODVERSIONS
	select HAVE_UID16
@@ -219,6 +221,19 @@ config UML_TIME_TRAVEL_SUPPORT

	  It is safe to say Y, but you probably don't need this.

config KASAN_SHADOW_OFFSET
	hex
	depends on KASAN
	default 0x100000000000
	help
	  This is the offset at which the ~16TB of shadow memory is
	  mapped and used by KASAN for memory debugging. This can be any
	  address that has at least KASAN_SHADOW_SIZE (total address space divided
	  by 8) amount of space so that the KASAN shadow memory does not conflict
	  with anything. The default is 0x100000000000, which works even if mem is
	  set to a large value. On low-memory systems, try 0x7fff8000, as it fits
	  into the immediate of most instructions, improving performance.

endmenu

source "arch/um/drivers/Kconfig"
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
 * protects against a module being loaded twice at the same time.
 */
static int random_fd = -1;
static struct hwrng hwrng = { 0, };
static struct hwrng hwrng;
static DECLARE_COMPLETION(have_data);

static int rng_dev_read(struct hwrng *rng, void *buf, size_t max, bool block)
+2 −0
Original line number Diff line number Diff line
@@ -83,6 +83,8 @@
  }
  .init_array : {
	__init_array_start = .;
	*(.kasan_init)
	*(.init_array.*)
	*(.init_array)
	__init_array_end = .;
  }
+37 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_UM_KASAN_H
#define __ASM_UM_KASAN_H

#include <linux/init.h>
#include <linux/const.h>

#define KASAN_SHADOW_OFFSET _AC(CONFIG_KASAN_SHADOW_OFFSET, UL)

/* used in kasan_mem_to_shadow to divide by 8 */
#define KASAN_SHADOW_SCALE_SHIFT 3

#ifdef CONFIG_X86_64
#define KASAN_HOST_USER_SPACE_END_ADDR 0x00007fffffffffffUL
/* KASAN_SHADOW_SIZE is the size of total address space divided by 8 */
#define KASAN_SHADOW_SIZE ((KASAN_HOST_USER_SPACE_END_ADDR + 1) >> \
			KASAN_SHADOW_SCALE_SHIFT)
#else
#error "KASAN_SHADOW_SIZE is not defined for this sub-architecture"
#endif /* CONFIG_X86_64 */

#define KASAN_SHADOW_START (KASAN_SHADOW_OFFSET)
#define KASAN_SHADOW_END (KASAN_SHADOW_START + KASAN_SHADOW_SIZE)

#ifdef CONFIG_KASAN
void kasan_init(void);
void kasan_map_memory(void *start, unsigned long len);
extern int kasan_um_is_ready;

#ifdef CONFIG_STATIC_LINK
#define kasan_arch_is_ready() (kasan_um_is_ready)
#endif
#else
static inline void kasan_init(void) { }
#endif /* CONFIG_KASAN */

#endif /* __ASM_UM_KASAN_H */
+0 −5
Original line number Diff line number Diff line
@@ -59,11 +59,6 @@ static inline void release_thread(struct task_struct *task)
{
}

static inline void mm_copy_segments(struct mm_struct *from_mm,
				    struct mm_struct *new_mm)
{
}

/*
 * User space process size: 3GB (default).
 */
Loading