Commit 10de638d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull s390 updates from Vasily Gorbik:

 - Add support for stackleak feature. Also allow specifying
   architecture-specific stackleak poison function to enable faster
   implementation. On s390, the mvc-based implementation helps decrease
   typical overhead from a factor of 3 to just 25%

 - Convert all assembler files to use SYM* style macros, deprecating the
   ENTRY() macro and other annotations. Select ARCH_USE_SYM_ANNOTATIONS

 - Improve KASLR to also randomize module and special amode31 code base
   load addresses

 - Rework decompressor memory tracking to support memory holes and
   improve error handling

 - Add support for protected virtualization AP binding

 - Add support for set_direct_map() calls

 - Implement set_memory_rox() and noexec module_alloc()

 - Remove obsolete overriding of mem*() functions for KASAN

 - Rework kexec/kdump to avoid using nodat_stack to call purgatory

 - Convert the rest of the s390 code to use flexible-array member
   instead of a zero-length array

 - Clean up uaccess inline asm

 - Enable ARCH_HAS_MEMBARRIER_SYNC_CORE

 - Convert to using CONFIG_FUNCTION_ALIGNMENT and enable
   DEBUG_FORCE_FUNCTION_ALIGN_64B

 - Resolve last_break in userspace fault reports

 - Simplify one-level sysctl registration

 - Clean up branch prediction handling

 - Rework CPU counter facility to retrieve available counter sets just
   once

 - Other various small fixes and improvements all over the code

* tag 's390-6.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (118 commits)
  s390/stackleak: provide fast __stackleak_poison() implementation
  stackleak: allow to specify arch specific stackleak poison function
  s390: select ARCH_USE_SYM_ANNOTATIONS
  s390/mm: use VM_FLUSH_RESET_PERMS in module_alloc()
  s390: wire up memfd_secret system call
  s390/mm: enable ARCH_HAS_SET_DIRECT_MAP
  s390/mm: use BIT macro to generate SET_MEMORY bit masks
  s390/relocate_kernel: adjust indentation
  s390/relocate_kernel: use SYM* macros instead of ENTRY(), etc.
  s390/entry: use SYM* macros instead of ENTRY(), etc.
  s390/purgatory: use SYM* macros instead of ENTRY(), etc.
  s390/kprobes: use SYM* macros instead of ENTRY(), etc.
  s390/reipl: use SYM* macros instead of ENTRY(), etc.
  s390/head64: use SYM* macros instead of ENTRY(), etc.
  s390/earlypgm: use SYM* macros instead of ENTRY(), etc.
  s390/mcount: use SYM* macros instead of ENTRY(), etc.
  s390/crc32le: use SYM* macros instead of ENTRY(), etc.
  s390/crc32be: use SYM* macros instead of ENTRY(), etc.
  s390/crypto,chacha: use SYM* macros instead of ENTRY(), etc.
  s390/amode31: use SYM* macros instead of ENTRY(), etc.
  ...
parents d55571c0 2a405f6b
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -5,7 +5,7 @@
#
#
# Architecture requirements
# Architecture requirements
#
#
# * arm/arm64/powerpc
# * arm/arm64/powerpc/s390
#
#
# Rely on implicit context synchronization as a result of exception return
# Rely on implicit context synchronization as a result of exception return
# when returning from IPI handler, and when returning to user-space.
# when returning from IPI handler, and when returning to user-space.
@@ -45,7 +45,7 @@
    |      parisc: | TODO |
    |      parisc: | TODO |
    |     powerpc: |  ok  |
    |     powerpc: |  ok  |
    |       riscv: | TODO |
    |       riscv: | TODO |
    |        s390: | TODO |
    |        s390: |  ok  |
    |          sh: | TODO |
    |          sh: | TODO |
    |       sparc: | TODO |
    |       sparc: | TODO |
    |          um: | TODO |
    |          um: | TODO |
+6 −4
Original line number Original line Diff line number Diff line
@@ -26,10 +26,6 @@ config GENERIC_BUG
config GENERIC_BUG_RELATIVE_POINTERS
config GENERIC_BUG_RELATIVE_POINTERS
	def_bool y
	def_bool y


config GENERIC_CSUM
	bool
	default y if KASAN

config GENERIC_LOCKBREAK
config GENERIC_LOCKBREAK
	def_bool y if PREEMPTION
	def_bool y if PREEMPTION


@@ -76,10 +72,12 @@ config S390
	select ARCH_HAS_GCOV_PROFILE_ALL
	select ARCH_HAS_GCOV_PROFILE_ALL
	select ARCH_HAS_GIGANTIC_PAGE
	select ARCH_HAS_GIGANTIC_PAGE
	select ARCH_HAS_KCOV
	select ARCH_HAS_KCOV
	select ARCH_HAS_MEMBARRIER_SYNC_CORE
	select ARCH_HAS_MEM_ENCRYPT
	select ARCH_HAS_MEM_ENCRYPT
	select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
	select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
	select ARCH_HAS_PTE_SPECIAL
	select ARCH_HAS_PTE_SPECIAL
	select ARCH_HAS_SCALED_CPUTIME
	select ARCH_HAS_SCALED_CPUTIME
	select ARCH_HAS_SET_DIRECT_MAP
	select ARCH_HAS_SET_MEMORY
	select ARCH_HAS_SET_MEMORY
	select ARCH_HAS_STRICT_KERNEL_RWX
	select ARCH_HAS_STRICT_KERNEL_RWX
	select ARCH_HAS_STRICT_MODULE_RWX
	select ARCH_HAS_STRICT_MODULE_RWX
@@ -123,6 +121,7 @@ config S390
	select ARCH_SUPPORTS_PER_VMA_LOCK
	select ARCH_SUPPORTS_PER_VMA_LOCK
	select ARCH_USE_BUILTIN_BSWAP
	select ARCH_USE_BUILTIN_BSWAP
	select ARCH_USE_CMPXCHG_LOCKREF
	select ARCH_USE_CMPXCHG_LOCKREF
	select ARCH_USE_SYM_ANNOTATIONS
	select ARCH_WANTS_DYNAMIC_TASK_STRUCT
	select ARCH_WANTS_DYNAMIC_TASK_STRUCT
	select ARCH_WANTS_NO_INSTR
	select ARCH_WANTS_NO_INSTR
	select ARCH_WANT_DEFAULT_BPF_JIT
	select ARCH_WANT_DEFAULT_BPF_JIT
@@ -132,6 +131,8 @@ config S390
	select CLONE_BACKWARDS2
	select CLONE_BACKWARDS2
	select DMA_OPS if PCI
	select DMA_OPS if PCI
	select DYNAMIC_FTRACE if FUNCTION_TRACER
	select DYNAMIC_FTRACE if FUNCTION_TRACER
	select FUNCTION_ALIGNMENT_8B if CC_IS_GCC
	select FUNCTION_ALIGNMENT_16B if !CC_IS_GCC
	select GCC12_NO_ARRAY_BOUNDS
	select GCC12_NO_ARRAY_BOUNDS
	select GENERIC_ALLOCATOR
	select GENERIC_ALLOCATOR
	select GENERIC_CPU_AUTOPROBE
	select GENERIC_CPU_AUTOPROBE
@@ -153,6 +154,7 @@ config S390
	select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
	select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
	select HAVE_ARCH_SECCOMP_FILTER
	select HAVE_ARCH_SECCOMP_FILTER
	select HAVE_ARCH_SOFT_DIRTY
	select HAVE_ARCH_SOFT_DIRTY
	select HAVE_ARCH_STACKLEAK
	select HAVE_ARCH_TRACEHOOK
	select HAVE_ARCH_TRACEHOOK
	select HAVE_ARCH_TRANSPARENT_HUGEPAGE
	select HAVE_ARCH_TRANSPARENT_HUGEPAGE
	select HAVE_ARCH_VMAP_STACK
	select HAVE_ARCH_VMAP_STACK
+9 −23
Original line number Original line Diff line number Diff line
@@ -66,16 +66,6 @@ static struct ctl_table appldata_table[] = {
	{ },
	{ },
};
};


static struct ctl_table appldata_dir_table[] = {
	{
		.procname	= appldata_proc_name,
		.maxlen		= 0,
		.mode		= S_IRUGO | S_IXUGO,
		.child		= appldata_table,
	},
	{ },
};

/*
/*
 * Timer
 * Timer
 */
 */
@@ -291,7 +281,7 @@ appldata_generic_handler(struct ctl_table *ctl, int write,
	mutex_lock(&appldata_ops_mutex);
	mutex_lock(&appldata_ops_mutex);
	list_for_each(lh, &appldata_ops_list) {
	list_for_each(lh, &appldata_ops_list) {
		tmp_ops = list_entry(lh, struct appldata_ops, list);
		tmp_ops = list_entry(lh, struct appldata_ops, list);
		if (&tmp_ops->ctl_table[2] == ctl) {
		if (&tmp_ops->ctl_table[0] == ctl) {
			found = 1;
			found = 1;
		}
		}
	}
	}
@@ -361,7 +351,8 @@ int appldata_register_ops(struct appldata_ops *ops)
	if (ops->size > APPLDATA_MAX_REC_SIZE)
	if (ops->size > APPLDATA_MAX_REC_SIZE)
		return -EINVAL;
		return -EINVAL;


	ops->ctl_table = kcalloc(4, sizeof(struct ctl_table), GFP_KERNEL);
	/* The last entry must be an empty one */
	ops->ctl_table = kcalloc(2, sizeof(struct ctl_table), GFP_KERNEL);
	if (!ops->ctl_table)
	if (!ops->ctl_table)
		return -ENOMEM;
		return -ENOMEM;


@@ -369,17 +360,12 @@ int appldata_register_ops(struct appldata_ops *ops)
	list_add(&ops->list, &appldata_ops_list);
	list_add(&ops->list, &appldata_ops_list);
	mutex_unlock(&appldata_ops_mutex);
	mutex_unlock(&appldata_ops_mutex);


	ops->ctl_table[0].procname = appldata_proc_name;
	ops->ctl_table[0].procname = ops->name;
	ops->ctl_table[0].maxlen   = 0;
	ops->ctl_table[0].mode = S_IRUGO | S_IWUSR;
	ops->ctl_table[0].mode     = S_IRUGO | S_IXUGO;
	ops->ctl_table[0].proc_handler = appldata_generic_handler;
	ops->ctl_table[0].child    = &ops->ctl_table[2];
	ops->ctl_table[0].data = ops;

	ops->ctl_table[2].procname = ops->name;
	ops->ctl_table[2].mode     = S_IRUGO | S_IWUSR;
	ops->ctl_table[2].proc_handler = appldata_generic_handler;
	ops->ctl_table[2].data = ops;


	ops->sysctl_header = register_sysctl_table(ops->ctl_table);
	ops->sysctl_header = register_sysctl(appldata_proc_name, ops->ctl_table);
	if (!ops->sysctl_header)
	if (!ops->sysctl_header)
		goto out;
		goto out;
	return 0;
	return 0;
@@ -422,7 +408,7 @@ static int __init appldata_init(void)
	appldata_wq = alloc_ordered_workqueue("appldata", 0);
	appldata_wq = alloc_ordered_workqueue("appldata", 0);
	if (!appldata_wq)
	if (!appldata_wq)
		return -ENOMEM;
		return -ENOMEM;
	appldata_sysctl_header = register_sysctl_table(appldata_dir_table);
	appldata_sysctl_header = register_sysctl(appldata_proc_name, appldata_table);
	return 0;
	return 0;
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -35,7 +35,7 @@ endif


CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char
CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char


obj-y	:= head.o als.o startup.o mem_detect.o ipl_parm.o ipl_report.o vmem.o
obj-y	:= head.o als.o startup.o physmem_info.o ipl_parm.o ipl_report.o vmem.o
obj-y	+= string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
obj-y	+= string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
obj-y	+= version.o pgm_check_info.o ctype.o ipl_data.o machine_kexec_reloc.o
obj-y	+= version.o pgm_check_info.o ctype.o ipl_data.o machine_kexec_reloc.o
obj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) $(CONFIG_PGSTE))	+= uv.o
obj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) $(CONFIG_PGSTE))	+= uv.o
+35 −7
Original line number Original line Diff line number Diff line
@@ -8,6 +8,8 @@


#ifndef __ASSEMBLY__
#ifndef __ASSEMBLY__


#include <asm/physmem_info.h>

struct machine_info {
struct machine_info {
	unsigned char has_edat1 : 1;
	unsigned char has_edat1 : 1;
	unsigned char has_edat2 : 1;
	unsigned char has_edat2 : 1;
@@ -30,24 +32,46 @@ struct vmlinux_info {
	unsigned long init_mm_off;
	unsigned long init_mm_off;
	unsigned long swapper_pg_dir_off;
	unsigned long swapper_pg_dir_off;
	unsigned long invalid_pg_dir_off;
	unsigned long invalid_pg_dir_off;
#ifdef CONFIG_KASAN
	unsigned long kasan_early_shadow_page_off;
	unsigned long kasan_early_shadow_pte_off;
	unsigned long kasan_early_shadow_pmd_off;
	unsigned long kasan_early_shadow_pud_off;
	unsigned long kasan_early_shadow_p4d_off;
#endif
};
};


void startup_kernel(void);
void startup_kernel(void);
unsigned long detect_memory(unsigned long *safe_addr);
unsigned long detect_max_physmem_end(void);
void mem_detect_set_usable_limit(unsigned long limit);
void detect_physmem_online_ranges(unsigned long max_physmem_end);
void physmem_set_usable_limit(unsigned long limit);
void physmem_reserve(enum reserved_range_type type, unsigned long addr, unsigned long size);
void physmem_free(enum reserved_range_type type);
/* for continuous/multiple allocations per type */
unsigned long physmem_alloc_top_down(enum reserved_range_type type, unsigned long size,
				     unsigned long align);
/* for single allocations, 1 per type */
unsigned long physmem_alloc_range(enum reserved_range_type type, unsigned long size,
				  unsigned long align, unsigned long min, unsigned long max,
				  bool die_on_oom);
unsigned long get_physmem_alloc_pos(void);
bool ipl_report_certs_intersects(unsigned long addr, unsigned long size,
				 unsigned long *intersection_start);
bool is_ipl_block_dump(void);
bool is_ipl_block_dump(void);
void store_ipl_parmblock(void);
void store_ipl_parmblock(void);
unsigned long read_ipl_report(unsigned long safe_addr);
int read_ipl_report(void);
void save_ipl_cert_comp_list(void);
void setup_boot_command_line(void);
void setup_boot_command_line(void);
void parse_boot_command_line(void);
void parse_boot_command_line(void);
void verify_facilities(void);
void verify_facilities(void);
void print_missing_facilities(void);
void print_missing_facilities(void);
void sclp_early_setup_buffer(void);
void sclp_early_setup_buffer(void);
void print_pgm_check_info(void);
void print_pgm_check_info(void);
unsigned long get_random_base(unsigned long safe_addr);
unsigned long randomize_within_range(unsigned long size, unsigned long align,
				     unsigned long min, unsigned long max);
void setup_vmem(unsigned long asce_limit);
void setup_vmem(unsigned long asce_limit);
unsigned long vmem_estimate_memory_needs(unsigned long online_mem_total);
void __printf(1, 2) decompressor_printk(const char *fmt, ...);
void __printf(1, 2) decompressor_printk(const char *fmt, ...);
void print_stacktrace(unsigned long sp);
void error(char *m);
void error(char *m);


extern struct machine_info machine;
extern struct machine_info machine;
@@ -57,12 +81,11 @@ extern const char kernel_version[];
extern unsigned long memory_limit;
extern unsigned long memory_limit;
extern unsigned long vmalloc_size;
extern unsigned long vmalloc_size;
extern int vmalloc_size_set;
extern int vmalloc_size_set;
extern int kaslr_enabled;
extern char __boot_data_start[], __boot_data_end[];
extern char __boot_data_start[], __boot_data_end[];
extern char __boot_data_preserved_start[], __boot_data_preserved_end[];
extern char __boot_data_preserved_start[], __boot_data_preserved_end[];
extern char _decompressor_syms_start[], _decompressor_syms_end[];
extern char _decompressor_syms_start[], _decompressor_syms_end[];
extern char _stack_start[], _stack_end[];
extern char _stack_start[], _stack_end[];
extern char _end[];
extern char _end[], _decompressor_end[];
extern unsigned char _compressed_start[];
extern unsigned char _compressed_start[];
extern unsigned char _compressed_end[];
extern unsigned char _compressed_end[];
extern struct vmlinux_info _vmlinux_info;
extern struct vmlinux_info _vmlinux_info;
@@ -70,5 +93,10 @@ extern struct vmlinux_info _vmlinux_info;


#define __abs_lowcore_pa(x)	(((unsigned long)(x) - __abs_lowcore) % sizeof(struct lowcore))
#define __abs_lowcore_pa(x)	(((unsigned long)(x) - __abs_lowcore) % sizeof(struct lowcore))


static inline bool intersects(unsigned long addr0, unsigned long size0,
			      unsigned long addr1, unsigned long size1)
{
	return addr0 + size0 > addr1 && addr1 + size1 > addr0;
}
#endif /* __ASSEMBLY__ */
#endif /* __ASSEMBLY__ */
#endif /* BOOT_BOOT_H */
#endif /* BOOT_BOOT_H */
Loading