Skip to content

Commit 10de638

Browse files
committed
Merge tag 's390-6.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
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. ...
2 parents d55571c + 2a405f6 commit 10de638

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2784
-2436
lines changed

Documentation/features/sched/membarrier-sync-core/arch-support.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# Architecture requirements
77
#
8-
# * arm/arm64/powerpc
8+
# * arm/arm64/powerpc/s390
99
#
1010
# Rely on implicit context synchronization as a result of exception return
1111
# when returning from IPI handler, and when returning to user-space.
@@ -45,7 +45,7 @@
4545
| parisc: | TODO |
4646
| powerpc: | ok |
4747
| riscv: | TODO |
48-
| s390: | TODO |
48+
| s390: | ok |
4949
| sh: | TODO |
5050
| sparc: | TODO |
5151
| um: | TODO |

arch/s390/Kconfig

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ config GENERIC_BUG
2626
config GENERIC_BUG_RELATIVE_POINTERS
2727
def_bool y
2828

29-
config GENERIC_CSUM
30-
bool
31-
default y if KASAN
32-
3329
config GENERIC_LOCKBREAK
3430
def_bool y if PREEMPTION
3531

@@ -76,10 +72,12 @@ config S390
7672
select ARCH_HAS_GCOV_PROFILE_ALL
7773
select ARCH_HAS_GIGANTIC_PAGE
7874
select ARCH_HAS_KCOV
75+
select ARCH_HAS_MEMBARRIER_SYNC_CORE
7976
select ARCH_HAS_MEM_ENCRYPT
8077
select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
8178
select ARCH_HAS_PTE_SPECIAL
8279
select ARCH_HAS_SCALED_CPUTIME
80+
select ARCH_HAS_SET_DIRECT_MAP
8381
select ARCH_HAS_SET_MEMORY
8482
select ARCH_HAS_STRICT_KERNEL_RWX
8583
select ARCH_HAS_STRICT_MODULE_RWX
@@ -123,6 +121,7 @@ config S390
123121
select ARCH_SUPPORTS_PER_VMA_LOCK
124122
select ARCH_USE_BUILTIN_BSWAP
125123
select ARCH_USE_CMPXCHG_LOCKREF
124+
select ARCH_USE_SYM_ANNOTATIONS
126125
select ARCH_WANTS_DYNAMIC_TASK_STRUCT
127126
select ARCH_WANTS_NO_INSTR
128127
select ARCH_WANT_DEFAULT_BPF_JIT
@@ -132,6 +131,8 @@ config S390
132131
select CLONE_BACKWARDS2
133132
select DMA_OPS if PCI
134133
select DYNAMIC_FTRACE if FUNCTION_TRACER
134+
select FUNCTION_ALIGNMENT_8B if CC_IS_GCC
135+
select FUNCTION_ALIGNMENT_16B if !CC_IS_GCC
135136
select GCC12_NO_ARRAY_BOUNDS
136137
select GENERIC_ALLOCATOR
137138
select GENERIC_CPU_AUTOPROBE
@@ -153,6 +154,7 @@ config S390
153154
select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
154155
select HAVE_ARCH_SECCOMP_FILTER
155156
select HAVE_ARCH_SOFT_DIRTY
157+
select HAVE_ARCH_STACKLEAK
156158
select HAVE_ARCH_TRACEHOOK
157159
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
158160
select HAVE_ARCH_VMAP_STACK

arch/s390/appldata/appldata_base.c

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,6 @@ static struct ctl_table appldata_table[] = {
6666
{ },
6767
};
6868

69-
static struct ctl_table appldata_dir_table[] = {
70-
{
71-
.procname = appldata_proc_name,
72-
.maxlen = 0,
73-
.mode = S_IRUGO | S_IXUGO,
74-
.child = appldata_table,
75-
},
76-
{ },
77-
};
78-
7969
/*
8070
* Timer
8171
*/
@@ -291,7 +281,7 @@ appldata_generic_handler(struct ctl_table *ctl, int write,
291281
mutex_lock(&appldata_ops_mutex);
292282
list_for_each(lh, &appldata_ops_list) {
293283
tmp_ops = list_entry(lh, struct appldata_ops, list);
294-
if (&tmp_ops->ctl_table[2] == ctl) {
284+
if (&tmp_ops->ctl_table[0] == ctl) {
295285
found = 1;
296286
}
297287
}
@@ -361,25 +351,21 @@ int appldata_register_ops(struct appldata_ops *ops)
361351
if (ops->size > APPLDATA_MAX_REC_SIZE)
362352
return -EINVAL;
363353

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

368359
mutex_lock(&appldata_ops_mutex);
369360
list_add(&ops->list, &appldata_ops_list);
370361
mutex_unlock(&appldata_ops_mutex);
371362

372-
ops->ctl_table[0].procname = appldata_proc_name;
373-
ops->ctl_table[0].maxlen = 0;
374-
ops->ctl_table[0].mode = S_IRUGO | S_IXUGO;
375-
ops->ctl_table[0].child = &ops->ctl_table[2];
376-
377-
ops->ctl_table[2].procname = ops->name;
378-
ops->ctl_table[2].mode = S_IRUGO | S_IWUSR;
379-
ops->ctl_table[2].proc_handler = appldata_generic_handler;
380-
ops->ctl_table[2].data = ops;
363+
ops->ctl_table[0].procname = ops->name;
364+
ops->ctl_table[0].mode = S_IRUGO | S_IWUSR;
365+
ops->ctl_table[0].proc_handler = appldata_generic_handler;
366+
ops->ctl_table[0].data = ops;
381367

382-
ops->sysctl_header = register_sysctl_table(ops->ctl_table);
368+
ops->sysctl_header = register_sysctl(appldata_proc_name, ops->ctl_table);
383369
if (!ops->sysctl_header)
384370
goto out;
385371
return 0;
@@ -422,7 +408,7 @@ static int __init appldata_init(void)
422408
appldata_wq = alloc_ordered_workqueue("appldata", 0);
423409
if (!appldata_wq)
424410
return -ENOMEM;
425-
appldata_sysctl_header = register_sysctl_table(appldata_dir_table);
411+
appldata_sysctl_header = register_sysctl(appldata_proc_name, appldata_table);
426412
return 0;
427413
}
428414

arch/s390/boot/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ endif
3535

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

38-
obj-y := head.o als.o startup.o mem_detect.o ipl_parm.o ipl_report.o vmem.o
38+
obj-y := head.o als.o startup.o physmem_info.o ipl_parm.o ipl_report.o vmem.o
3939
obj-y += string.o ebcdic.o sclp_early_core.o mem.o ipl_vmparm.o cmdline.o
4040
obj-y += version.o pgm_check_info.o ctype.o ipl_data.o machine_kexec_reloc.o
4141
obj-$(findstring y, $(CONFIG_PROTECTED_VIRTUALIZATION_GUEST) $(CONFIG_PGSTE)) += uv.o

arch/s390/boot/boot.h

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#ifndef __ASSEMBLY__
1010

11+
#include <asm/physmem_info.h>
12+
1113
struct machine_info {
1214
unsigned char has_edat1 : 1;
1315
unsigned char has_edat2 : 1;
@@ -30,24 +32,46 @@ struct vmlinux_info {
3032
unsigned long init_mm_off;
3133
unsigned long swapper_pg_dir_off;
3234
unsigned long invalid_pg_dir_off;
35+
#ifdef CONFIG_KASAN
36+
unsigned long kasan_early_shadow_page_off;
37+
unsigned long kasan_early_shadow_pte_off;
38+
unsigned long kasan_early_shadow_pmd_off;
39+
unsigned long kasan_early_shadow_pud_off;
40+
unsigned long kasan_early_shadow_p4d_off;
41+
#endif
3342
};
3443

3544
void startup_kernel(void);
36-
unsigned long detect_memory(unsigned long *safe_addr);
37-
void mem_detect_set_usable_limit(unsigned long limit);
45+
unsigned long detect_max_physmem_end(void);
46+
void detect_physmem_online_ranges(unsigned long max_physmem_end);
47+
void physmem_set_usable_limit(unsigned long limit);
48+
void physmem_reserve(enum reserved_range_type type, unsigned long addr, unsigned long size);
49+
void physmem_free(enum reserved_range_type type);
50+
/* for continuous/multiple allocations per type */
51+
unsigned long physmem_alloc_top_down(enum reserved_range_type type, unsigned long size,
52+
unsigned long align);
53+
/* for single allocations, 1 per type */
54+
unsigned long physmem_alloc_range(enum reserved_range_type type, unsigned long size,
55+
unsigned long align, unsigned long min, unsigned long max,
56+
bool die_on_oom);
57+
unsigned long get_physmem_alloc_pos(void);
58+
bool ipl_report_certs_intersects(unsigned long addr, unsigned long size,
59+
unsigned long *intersection_start);
3860
bool is_ipl_block_dump(void);
3961
void store_ipl_parmblock(void);
40-
unsigned long read_ipl_report(unsigned long safe_addr);
62+
int read_ipl_report(void);
63+
void save_ipl_cert_comp_list(void);
4164
void setup_boot_command_line(void);
4265
void parse_boot_command_line(void);
4366
void verify_facilities(void);
4467
void print_missing_facilities(void);
4568
void sclp_early_setup_buffer(void);
4669
void print_pgm_check_info(void);
47-
unsigned long get_random_base(unsigned long safe_addr);
70+
unsigned long randomize_within_range(unsigned long size, unsigned long align,
71+
unsigned long min, unsigned long max);
4872
void setup_vmem(unsigned long asce_limit);
49-
unsigned long vmem_estimate_memory_needs(unsigned long online_mem_total);
5073
void __printf(1, 2) decompressor_printk(const char *fmt, ...);
74+
void print_stacktrace(unsigned long sp);
5175
void error(char *m);
5276

5377
extern struct machine_info machine;
@@ -57,18 +81,22 @@ extern const char kernel_version[];
5781
extern unsigned long memory_limit;
5882
extern unsigned long vmalloc_size;
5983
extern int vmalloc_size_set;
60-
extern int kaslr_enabled;
6184
extern char __boot_data_start[], __boot_data_end[];
6285
extern char __boot_data_preserved_start[], __boot_data_preserved_end[];
6386
extern char _decompressor_syms_start[], _decompressor_syms_end[];
6487
extern char _stack_start[], _stack_end[];
65-
extern char _end[];
88+
extern char _end[], _decompressor_end[];
6689
extern unsigned char _compressed_start[];
6790
extern unsigned char _compressed_end[];
6891
extern struct vmlinux_info _vmlinux_info;
6992
#define vmlinux _vmlinux_info
7093

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

96+
static inline bool intersects(unsigned long addr0, unsigned long size0,
97+
unsigned long addr1, unsigned long size1)
98+
{
99+
return addr0 + size0 > addr1 && addr1 + size1 > addr0;
100+
}
73101
#endif /* __ASSEMBLY__ */
74102
#endif /* BOOT_BOOT_H */

arch/s390/boot/install.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
echo "Warning: '${INSTALLKERNEL}' command not available - additional " \
1919
"bootloader config required" >&2
20-
if [ -f $4/vmlinuz-$1 ]; then mv $4/vmlinuz-$1 $4/vmlinuz-$1.old; fi
21-
if [ -f $4/System.map-$1 ]; then mv $4/System.map-$1 $4/System.map-$1.old; fi
20+
if [ -f "$4/vmlinuz-$1" ]; then mv -- "$4/vmlinuz-$1" "$4/vmlinuz-$1.old"; fi
21+
if [ -f "$4/System.map-$1" ]; then mv -- "$4/System.map-$1" "$4/System.map-$1.old"; fi
2222

23-
cat $2 > $4/vmlinuz-$1
24-
cp $3 $4/System.map-$1
23+
cat -- "$2" > "$4/vmlinuz-$1"
24+
cp -- "$3" "$4/System.map-$1"

arch/s390/boot/ipl_parm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ int __bootdata(noexec_disabled);
2424
unsigned int __bootdata_preserved(zlib_dfltcc_support) = ZLIB_DFLTCC_FULL;
2525
struct ipl_parameter_block __bootdata_preserved(ipl_block);
2626
int __bootdata_preserved(ipl_block_valid);
27+
int __bootdata_preserved(__kaslr_enabled);
2728

2829
unsigned long vmalloc_size = VMALLOC_DEFAULT_SIZE;
2930
unsigned long memory_limit;
3031
int vmalloc_size_set;
31-
int kaslr_enabled;
3232

3333
static inline int __diag308(unsigned long subcode, void *addr)
3434
{
@@ -264,7 +264,7 @@ void parse_boot_command_line(void)
264264
char *args;
265265
int rc;
266266

267-
kaslr_enabled = IS_ENABLED(CONFIG_RANDOMIZE_BASE);
267+
__kaslr_enabled = IS_ENABLED(CONFIG_RANDOMIZE_BASE);
268268
args = strcpy(command_line_buf, early_command_line);
269269
while (*args) {
270270
args = next_arg(args, &param, &val);
@@ -300,7 +300,7 @@ void parse_boot_command_line(void)
300300
modify_fac_list(val);
301301

302302
if (!strcmp(param, "nokaslr"))
303-
kaslr_enabled = 0;
303+
__kaslr_enabled = 0;
304304

305305
#if IS_ENABLED(CONFIG_KVM)
306306
if (!strcmp(param, "prot_virt")) {

0 commit comments

Comments
 (0)