Skip to content

Commit d8cb068

Browse files
committed
Merge tag 's390-6.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 updates from Heiko Carstens: - Large rework of the protected key crypto code to allow for asynchronous handling without memory allocation - Speed up system call entry/exit path by re-implementing lazy ASCE handling - Add module autoload support for the diag288_wdt watchdog device driver - Get rid of s390 specific strcpy() and strncpy() implementations, and switch all remaining users to strscpy() when possible - Various other small fixes and improvements * tag 's390-6.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (51 commits) s390/pci: Serialize device addition and removal s390/pci: Allow re-add of a reserved but not yet removed device s390/pci: Prevent self deletion in disable_slot() s390/pci: Remove redundant bus removal and disable from zpci_release_device() s390/crypto: Extend protected key conversion retry loop s390/pci: Fix __pcilg_mio_inuser() inline assembly s390/ptrace: Always inline regs_get_kernel_stack_nth() and regs_get_register() s390/thread_info: Cleanup header includes s390/extmem: Add workaround for DCSS unload diag s390/crypto: Rework protected key AES for true asynch support s390/cpacf: Rework cpacf_pcc() to return condition code s390/mm: Fix potential use-after-free in __crst_table_upgrade() s390/mm: Add mmap_assert_write_locked() check to crst_table_upgrade() s390/string: Remove strcpy() implementation s390/con3270: Use strscpy() instead of strcpy() s390/boot: Use strspcy() instead of strcpy() s390: Simple strcpy() to strscpy() conversions s390/pkey/crypto: Introduce xflags param for pkey in-kernel API s390/pkey: Provide and pass xflags within pkey and zcrypt layers s390/uv: Remove uv_get_secret_metadata function ...
2 parents ba45037 + 774a1fa commit d8cb068

Some content is hidden

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

64 files changed

+2585
-1830
lines changed

arch/s390/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ config S390
146146
select ARCH_WANTS_NO_INSTR
147147
select ARCH_WANT_DEFAULT_BPF_JIT
148148
select ARCH_WANT_IPC_PARSE_VERSION
149+
select ARCH_WANT_IRQS_OFF_ACTIVATE_MM
149150
select ARCH_WANT_KERNEL_PMD_MKWRITE
150151
select ARCH_WANT_LD_ORPHAN_WARN
151152
select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP

arch/s390/boot/ipl_parm.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void setup_boot_command_line(void)
179179
if (has_ebcdic_char(parmarea.command_line))
180180
EBCASC(parmarea.command_line, COMMAND_LINE_SIZE);
181181
/* copy arch command line */
182-
strcpy(early_command_line, strim(parmarea.command_line));
182+
strscpy(early_command_line, strim(parmarea.command_line));
183183

184184
/* append IPL PARM data to the boot command line */
185185
if (!is_prot_virt_guest() && ipl_block_valid)
@@ -253,7 +253,8 @@ void parse_boot_command_line(void)
253253
int rc;
254254

255255
__kaslr_enabled = IS_ENABLED(CONFIG_RANDOMIZE_BASE);
256-
args = strcpy(command_line_buf, early_command_line);
256+
strscpy(command_line_buf, early_command_line);
257+
args = command_line_buf;
257258
while (*args) {
258259
args = next_arg(args, &param, &val);
259260

@@ -309,7 +310,7 @@ void parse_boot_command_line(void)
309310
if (!strcmp(param, "bootdebug")) {
310311
bootdebug = true;
311312
if (val)
312-
strncpy(bootdebug_filter, val, sizeof(bootdebug_filter) - 1);
313+
strscpy(bootdebug_filter, val);
313314
}
314315
if (!strcmp(param, "quiet"))
315316
boot_console_loglevel = CONSOLE_LOGLEVEL_QUIET;

arch/s390/boot/printk.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ static void boot_rb_add(const char *str, size_t len)
2929
/* store strings separated by '\0' */
3030
if (len + 1 > avail)
3131
boot_rb_off = 0;
32-
strcpy(boot_rb + boot_rb_off, str);
32+
avail = sizeof(boot_rb) - boot_rb_off - 1;
33+
strscpy(boot_rb + boot_rb_off, str, avail);
3334
boot_rb_off += len + 1;
3435
}
3536

@@ -158,10 +159,10 @@ static noinline char *strsym(char *buf, void *ip)
158159

159160
p = findsym((unsigned long)ip, &off, &len);
160161
if (p) {
161-
strncpy(buf, p, MAX_SYMLEN);
162+
strscpy(buf, p, MAX_SYMLEN);
162163
/* reserve 15 bytes for offset/len in symbol+0x1234/0x1234 */
163164
p = buf + strnlen(buf, MAX_SYMLEN - 15);
164-
strcpy(p, "+0x");
165+
strscpy(p, "+0x", MAX_SYMLEN - (p - buf));
165166
as_hex(p + 3, off, 0);
166167
strcat(p, "/0x");
167168
as_hex(p + strlen(p), len, 0);

arch/s390/boot/startup.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <asm/boot_data.h>
77
#include <asm/extmem.h>
88
#include <asm/sections.h>
9+
#include <asm/diag288.h>
910
#include <asm/maccess.h>
1011
#include <asm/machine.h>
1112
#include <asm/sysinfo.h>
@@ -71,6 +72,20 @@ static void detect_machine_type(void)
7172
set_machine_feature(MFEATURE_VM);
7273
}
7374

75+
static void detect_diag288(void)
76+
{
77+
/* "BEGIN" in EBCDIC character set */
78+
static const char cmd[] = "\xc2\xc5\xc7\xc9\xd5";
79+
unsigned long action, len;
80+
81+
action = machine_is_vm() ? (unsigned long)cmd : LPARWDT_RESTART;
82+
len = machine_is_vm() ? sizeof(cmd) : 0;
83+
if (__diag288(WDT_FUNC_INIT, MIN_INTERVAL, action, len))
84+
return;
85+
__diag288(WDT_FUNC_CANCEL, 0, 0, 0);
86+
set_machine_feature(MFEATURE_DIAG288);
87+
}
88+
7489
static void detect_diag9c(void)
7590
{
7691
unsigned int cpu;
@@ -519,6 +534,8 @@ void startup_kernel(void)
519534
detect_facilities();
520535
detect_diag9c();
521536
detect_machine_type();
537+
/* detect_diag288() needs machine type */
538+
detect_diag288();
522539
cmma_init();
523540
sanitize_prot_virt_host();
524541
max_physmem_end = detect_max_physmem_end();

arch/s390/boot/string.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ int strncmp(const char *cs, const char *ct, size_t count)
2929
return 0;
3030
}
3131

32+
ssize_t sized_strscpy(char *dst, const char *src, size_t count)
33+
{
34+
size_t len;
35+
36+
if (count == 0)
37+
return -E2BIG;
38+
len = strnlen(src, count - 1);
39+
memcpy(dst, src, len);
40+
dst[len] = '\0';
41+
return src[len] ? -E2BIG : len;
42+
}
43+
3244
void *memset64(uint64_t *s, uint64_t v, size_t count)
3345
{
3446
uint64_t *xs = s;

0 commit comments

Comments
 (0)