2018-08-24 07:44:09

by Martin Schwidefsky

[permalink] [raw]
Subject: [GIT PULL] s390 patches for the 4.19 merge window #2

Hi Linus,

please pull from the 'for-linus' branch of

git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git for-linus

to receive the following updates:

- A couple of patches for the zcrypt driver
+ Add two masks to determine which AP cards and queues are host devices,
this will be useful for KVM AP device passthrough
+ Add-on patch to improve the parsing of the new apmask and aqmask
+ Some code beautification

- Second try to reenable the GCC plugins, the first patch set had a
patch to do this but the merge somehow missed this

- Remove the s390 specific GCC version check and use the generic one

- Three patches for kdump, two bug fixes and one cleanup

- Three patches for the PCI layer, one bug fix and two cleanups

Harald Freudenberger (5):
s390/zcrypt: fix ap_instructions_available() returncodes
s390/zcrypt: switch return type to bool for ap_instructions_available()
s390/zcrypt: code beautify
s390/zcrypt: AP bus support for alternate driver(s)
s390/zcrypt: hex string mask improvements for apmask and aqmask.

Heiko Carstens (2):
s390: reenable gcc plugins for real
s390: remove gcc version check (4.3 or newer)

Philipp Rudo (3):
s390/kdump: Make elfcorehdr size calculation ABI compliant
s390/kdump: Fix memleak in nt_vmcoreinfo
s390/kdump: Remove kzalloc_panic

Sebastian Ott (3):
s390/pci: fix out of bounds access during irq setup
s390/pci: remove stale rc
s390/pci: remove fmb address from debug output

arch/s390/Kconfig | 2 +-
arch/s390/include/asm/ap.h | 14 +-
arch/s390/include/uapi/asm/zcrypt.h | 72 +++---
arch/s390/kernel/asm-offsets.c | 8 -
arch/s390/kernel/crash_dump.c | 70 +++---
arch/s390/pci/pci.c | 3 +-
arch/s390/pci/pci_debug.c | 1 -
drivers/s390/crypto/ap_bus.c | 432 ++++++++++++++++++++++++++++++---
drivers/s390/crypto/ap_bus.h | 36 ++-
drivers/s390/crypto/ap_card.c | 50 ++--
drivers/s390/crypto/ap_queue.c | 38 +--
drivers/s390/crypto/pkey_api.c | 91 +++----
drivers/s390/crypto/zcrypt_api.c | 30 ++-
drivers/s390/crypto/zcrypt_api.h | 2 +-
drivers/s390/crypto/zcrypt_card.c | 29 ++-
drivers/s390/crypto/zcrypt_cca_key.h | 12 +-
drivers/s390/crypto/zcrypt_cex2a.c | 2 +
drivers/s390/crypto/zcrypt_cex2a.h | 18 +-
drivers/s390/crypto/zcrypt_cex4.c | 2 +
drivers/s390/crypto/zcrypt_error.h | 2 +-
drivers/s390/crypto/zcrypt_msgtype50.c | 17 +-
drivers/s390/crypto/zcrypt_msgtype50.h | 8 +-
drivers/s390/crypto/zcrypt_msgtype6.c | 34 ++-
drivers/s390/crypto/zcrypt_msgtype6.h | 2 +-
drivers/s390/crypto/zcrypt_pcixcc.c | 6 +-
drivers/s390/crypto/zcrypt_pcixcc.h | 2 +-
drivers/s390/crypto/zcrypt_queue.c | 23 +-
27 files changed, 706 insertions(+), 300 deletions(-)



2018-09-05 00:20:00

by Kees Cook

[permalink] [raw]
Subject: Re: [GIT PULL] s390 patches for the 4.19 merge window #2

On Fri, Aug 24, 2018 at 12:42 AM, Martin Schwidefsky
<[email protected]> wrote:
> Harald Freudenberger (5):
> s390/zcrypt: hex string mask improvements for apmask and aqmask.

This (and an earlier 2017 commit) adds VLAs, which are being
removed[1] from the kernel:

drivers/s390/crypto/ap_bus.c:980:3: warning: ISO C90 forbids variable
length array ‘clrm’ [-Wvla]
drivers/s390/crypto/ap_bus.c:981:3: warning: ISO C90 forbids variable
length array ‘setm’ [-Wvla]
drivers/s390/crypto/ap_bus.c:995:3: warning: ISO C90 forbids variable
length array ‘setm’ [-Wvla]

static int process_mask_arg(const char *str,
unsigned long *bitmap, int bits,
struct mutex *lock)
...
DECLARE_BITMAP(clrm, bits);
DECLARE_BITMAP(setm, bits);

Can someone please adjust this to make these fixed size again?

Thanks!

-Kees

[1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com

--
Kees Cook
Pixel Security

2018-09-05 06:00:43

by Martin Schwidefsky

[permalink] [raw]
Subject: Re: [GIT PULL] s390 patches for the 4.19 merge window #2

On Tue, 4 Sep 2018 17:16:31 -0700
Kees Cook <[email protected]> wrote:

> On Fri, Aug 24, 2018 at 12:42 AM, Martin Schwidefsky
> <[email protected]> wrote:
> > Harald Freudenberger (5):
> > s390/zcrypt: hex string mask improvements for apmask and aqmask.
>
> This (and an earlier 2017 commit) adds VLAs, which are being
> removed[1] from the kernel:
>
> drivers/s390/crypto/ap_bus.c:980:3: warning: ISO C90 forbids variable
> length array ‘clrm’ [-Wvla]
> drivers/s390/crypto/ap_bus.c:981:3: warning: ISO C90 forbids variable
> length array ‘setm’ [-Wvla]
> drivers/s390/crypto/ap_bus.c:995:3: warning: ISO C90 forbids variable
> length array ‘setm’ [-Wvla]
>
> static int process_mask_arg(const char *str,
> unsigned long *bitmap, int bits,
> struct mutex *lock)
> ...
> DECLARE_BITMAP(clrm, bits);
> DECLARE_BITMAP(setm, bits);
>
> Can someone please adjust this to make these fixed size again?

Oops, sorry about that. We will provide a solution for this.

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.


2018-09-06 17:47:15

by Harald Freudenberger

[permalink] [raw]
Subject: Re: [GIT PULL] s390 patches for the 4.19 merge window #2

On 05.09.2018 02:16, Kees Cook wrote:
> On Fri, Aug 24, 2018 at 12:42 AM, Martin Schwidefsky
> <[email protected]> wrote:
>> Harald Freudenberger (5):
>> s390/zcrypt: hex string mask improvements for apmask and aqmask.
> This (and an earlier 2017 commit) adds VLAs, which are being
> removed[1] from the kernel:
>
> drivers/s390/crypto/ap_bus.c:980:3: warning: ISO C90 forbids variable
> length array ‘clrm’ [-Wvla]
> drivers/s390/crypto/ap_bus.c:981:3: warning: ISO C90 forbids variable
> length array ‘setm’ [-Wvla]
> drivers/s390/crypto/ap_bus.c:995:3: warning: ISO C90 forbids variable
> length array ‘setm’ [-Wvla]
>
> static int process_mask_arg(const char *str,
> unsigned long *bitmap, int bits,
> struct mutex *lock)
> ...
> DECLARE_BITMAP(clrm, bits);
> DECLARE_BITMAP(setm, bits);
>
> Can someone please adjust this to make these fixed size again?
>
> Thanks!
>
> -Kees
>
> [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com
>
Here is a simple solution which just hard codes the upper limit to 256 bits.
As all callers are only internal to the ap bus code and do obey to this limit
this shouldn't be a real limitation.

However, a version which really allocates will follow and then I'll discuss
with Martin, which version to post upstream.

========================================

From: Harald Freudenberger <[email protected]>
Date: Thu, 6 Sep 2018 11:29:36 +0200
Subject: [PATCH] s390/zcrypt: remove VLA use in ap bus code

The internal function to parse sysfs arguments uses VLAs -
dynamic bitmap arrays on the stack where the size is determined
by a invocation argument.

Reworked the code to have fixed sizes and check, if the caller
comply to this limit. However, one code path uses two of these
bitmap arrays and thus has a stack footprint of 64 bytes.

Signed-off-by: Harald Freudenberger <[email protected]>
---
 drivers/s390/crypto/ap_bus.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index ec891bc7d10a..20f2fa2276c8 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -972,13 +972,13 @@ static int process_mask_arg(const char *str,
 {
     int i;
 
-    /* bits needs to be a multiple of 8 */
-    if (bits & 0x07)
+    /* bits needs to be a multiple of 8 and <= 256 */
+    if (bits & 0x07 || bits > 256)
         return -EINVAL;
 
     if (*str == '+' || *str == '-') {
-        DECLARE_BITMAP(clrm, bits);
-        DECLARE_BITMAP(setm, bits);
+        DECLARE_BITMAP(clrm, 256);
+        DECLARE_BITMAP(setm, 256);
 
         i = str2clrsetmasks(str, clrm, setm, bits);
         if (i)
@@ -992,7 +992,7 @@ static int process_mask_arg(const char *str,
                 set_bit_inv(i, bitmap);
         }
     } else {
-        DECLARE_BITMAP(setm, bits);
+        DECLARE_BITMAP(setm, 256);
 
         i = hex2bitmap(str, setm, bits);
         if (i)
--
2.17.1