Commit addfba11 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 's390-6.2-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 fixes from Heiko Carstens:

 - With CONFIG_VMAP_STACK enabled it is not possible to load the s390
   specific diag288_wdt watchdog module. The reason is that a pointer to
   a string is passed to an inline assembly; this string however is
   located on the stack, while the instruction within the inline
   assembly expects a physicial address. Fix this by copying the string
   to a kmalloc'ed buffer.

 - The diag288_wdt watchdog module does not indicate that it accesses
   memory from an inline assembly, which it does. Add "memory" to the
   clobber list to prevent the compiler from optimizing code incorrectly
   away.

 - Pass size of the uncompressed kernel image to __decompress() call.
   Otherwise the kernel image decompressor may corrupt/overwrite an
   initrd. This was reported to happen on s390 after commit 2aa14b1a
   ("zstd: import usptream v1.5.2").

* tag 's390-6.2-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/decompressor: specify __decompress() buf len to avoid overflow
  watchdog: diag288_wdt: fix __diag288() inline assembly
  watchdog: diag288_wdt: do not use stack buffers for hardware data
parents 870bb765 7ab41c2c
...@@ -80,6 +80,6 @@ void *decompress_kernel(void) ...@@ -80,6 +80,6 @@ void *decompress_kernel(void)
void *output = (void *)decompress_offset; void *output = (void *)decompress_offset;
__decompress(_compressed_start, _compressed_end - _compressed_start, __decompress(_compressed_start, _compressed_end - _compressed_start,
NULL, NULL, output, 0, NULL, error); NULL, NULL, output, vmlinux.image_size, NULL, error);
return output; return output;
} }
...@@ -86,7 +86,7 @@ static int __diag288(unsigned int func, unsigned int timeout, ...@@ -86,7 +86,7 @@ static int __diag288(unsigned int func, unsigned int timeout,
"1:\n" "1:\n"
EX_TABLE(0b, 1b) EX_TABLE(0b, 1b)
: "+d" (err) : "d"(__func), "d"(__timeout), : "+d" (err) : "d"(__func), "d"(__timeout),
"d"(__action), "d"(__len) : "1", "cc"); "d"(__action), "d"(__len) : "1", "cc", "memory");
return err; return err;
} }
...@@ -268,12 +268,21 @@ static int __init diag288_init(void) ...@@ -268,12 +268,21 @@ static int __init diag288_init(void)
char ebc_begin[] = { char ebc_begin[] = {
194, 197, 199, 201, 213 194, 197, 199, 201, 213
}; };
char *ebc_cmd;
watchdog_set_nowayout(&wdt_dev, nowayout_info); watchdog_set_nowayout(&wdt_dev, nowayout_info);
if (MACHINE_IS_VM) { if (MACHINE_IS_VM) {
if (__diag288_vm(WDT_FUNC_INIT, 15, ebc_cmd = kmalloc(sizeof(ebc_begin), GFP_KERNEL);
ebc_begin, sizeof(ebc_begin)) != 0) { if (!ebc_cmd) {
pr_err("The watchdog cannot be initialized\n");
return -ENOMEM;
}
memcpy(ebc_cmd, ebc_begin, sizeof(ebc_begin));
ret = __diag288_vm(WDT_FUNC_INIT, 15,
ebc_cmd, sizeof(ebc_begin));
kfree(ebc_cmd);
if (ret != 0) {
pr_err("The watchdog cannot be initialized\n"); pr_err("The watchdog cannot be initialized\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment