Re: [PATCH v5 01/11] crypto: xcbc: Remove VLA usage

2018-07-16 Thread Herbert Xu
On Mon, Jul 16, 2018 at 09:21:40PM -0700, Kees Cook wrote: > In the quest to remove all stack VLA usage from the kernel[1], this uses > the maximum blocksize and adds a sanity check. For xcbc, the blocksize > must always be 16, so use that, since it's already being enforced during > instantiation.

[PATCH v5 04/11] dm integrity: Remove VLA usage

2018-07-16 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the new SHASH_MAX_DIGESTSIZE from the crypto layer to allocate the upper bounds on stack usage. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook ---

[PATCH v5 03/11] crypto: shash: Remove VLA usage

2018-07-16 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this removes the VLAs in SHASH_DESC_ON_STACK (via crypto_shash_descsize()) by using the maximum allowable size (which is now more clearly captured in a macro). Similar limits are turned into macros as well. A review of existing sizes s

[PATCH v5 00/11] crypto: Remove VLA usage

2018-07-16 Thread Kees Cook
v5: - limit AHASH_REQUEST_ON_STACK size only to non-async hash wrapping. - sanity-check ahash reqsize only when doing shash wrapping. - remove frame_warn changes in favor of shash conversions and other fixes. - send ahash to shash conversion patches and other fixes separately. v4: - add back *_REQ

[PATCH v5 05/11] crypto: ahash: Remove VLA usage

2018-07-16 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this introduces max size macros for ahash, as already done for shash, and adjust the crypto user to max state size. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees

[PATCH v5 07/11] crypto alg: Introduce generic max blocksize and alignmask

2018-07-16 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this exposes a new general upper bound on crypto blocksize and alignmask (higher than for the existing cipher limits) for VLA removal, and introduces new checks. At present, the highest cra_alignmask in the kernel is 63. The highest cr

[PATCH v5 02/11] crypto: cbc: Remove VLA usage

2018-07-16 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the upper bounds on blocksize. Since this is always a cipher blocksize, use the existing cipher max blocksize. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by:

[PATCH v5 10/11] crypto: ahash: Remove VLA usage for AHASH_REQUEST_ON_STACK

2018-07-16 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this caps the ahash request size similar to the other limits and adds a sanity check at initialization. AHASH_REQUEST_ON_STACK is special, though: it is only ever used for shash-wrapped ahash, so its size is bounded only by non-async ha

[PATCH v5 08/11] crypto: qat: Remove VLA usage

2018-07-16 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the new upper bound for the stack buffer. Also adds a sanity check. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- drivers/crypto/qat/qat_comm

[PATCH v5 01/11] crypto: xcbc: Remove VLA usage

2018-07-16 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the maximum blocksize and adds a sanity check. For xcbc, the blocksize must always be 16, so use that, since it's already being enforced during instantiation. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC

[PATCH v5 09/11] crypto: shash: Remove VLA usage in unaligned hashing

2018-07-16 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the newly defined max alignment to perform unaligned hashing to avoid VLAs, and drops the helper function while adding sanity checks on the resulting buffer sizes. Additionally, the __aligned_largest macro is removed since thi

[PATCH v5 06/11] dm verity fec: Remove VLA usage

2018-07-16 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the newly defined max digest size macro. Also adds a sanity-check at use-time. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- drivers/md/dm-ve

[PATCH v5 11/11] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-07-16 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this caps the skcipher request size similar to other limits and adds a sanity check at registration. Looking at instrumented tcrypt output, the largest is for lrw: crypt: testing lrw(aes) crypto_skcipher_set_reqsize: 8

[PATCH v19 1/6] iomap: Use non-raw io functions for io{read|write}XXbe

2018-07-16 Thread Logan Gunthorpe
Fix an asymmetry in the io{read|write}XXbe functions in that the big-endian variants make use of the raw io accessors while the little-endian variants use the regular accessors. Some architectures implement barriers to order against both spinlocks and DMA accesses and for these case, the big-endian

[PATCH v19 0/6] Add io{read|write}64 to io-64-atomic headers

2018-07-16 Thread Logan Gunthorpe
This updated patchset fixes a couple issues that have been noticed while the patchset was in linux-next. Andrew, can you please replace the patchset in mmotm with this updated version? Let me know if you'd like me to handle this differently. Thanks, Logan -- Changes since v18: - Dropped the CA

[PATCH v19 2/6] parisc: iomap: introduce io{read|write}64

2018-07-16 Thread Logan Gunthorpe
Add support for io{read|write}64() functions in parisc architecture. These are pretty straightforward copies of similar functions which make use of readq and writeq. Also, indicate that the lo_hi and hi_lo variants of these functions are not provided by this architecture. Signed-off-by: Logan Gun

[PATCH v19 6/6] ntb: ntb_hw_switchtec: Cleanup 64bit IO defines to use the common header

2018-07-16 Thread Logan Gunthorpe
Clean up the ifdefs which conditionally defined the io{read|write}64 functions in favour of the new common io-64-nonatomic-lo-hi header. Per a nit from Andy Shevchenko, the include list is also made alphabetical. Signed-off-by: Logan Gunthorpe Reviewed-by: Andy Shevchenko Cc: Jon Mason --- dr

[PATCH v19 4/6] io-64-nonatomic: add io{read|write}64[be]{_lo_hi|_hi_lo} macros

2018-07-16 Thread Logan Gunthorpe
This patch adds generic io{read|write}64[be]{_lo_hi|_hi_lo} macros if they are not already defined by the architecture. (As they are provided by the generic iomap library). The patch also points io{read|write}64[be] to the variant specified by the header name. This is because new drivers are enco

[PATCH v19 3/6] iomap: introduce io{read|write}64_{lo_hi|hi_lo}

2018-07-16 Thread Logan Gunthorpe
In order to provide non-atomic functions for io{read|write}64 that will use readq and writeq when appropriate. We define a number of variants of these functions in the generic iomap that will do non-atomic operations on pio but atomic operations on mmio. These functions are only defined if readq a

[PATCH v19 5/6] ntb: ntb_hw_intel: use io-64-nonatomic instead of in-driver hacks

2018-07-16 Thread Logan Gunthorpe
Now that ioread64 and iowrite64 are available in io-64-nonatomic, we can remove the hack at the top of ntb_hw_intel.c and replace it with an include. Signed-off-by: Logan Gunthorpe Reviewed-by: Andy Shevchenko Acked-by: Dave Jiang Acked-by: Allen Hubbe Acked-by: Jon Mason --- drivers/ntb/hw/

[PATCH 2/3] crypto: hisilicon SEC security accelerator driver

2018-07-16 Thread Jonathan Cameron
This accelerator is found inside hisilicon hip06 and hip07 SoCs. Each instance provides a number of queues which feed a different number of backend acceleration units. The queues are operating in an out of order mode in the interests of throughput. The silicon does not do tracking of dependencies

[PATCH 0/3] Hisilicon SEC crypto driver (hip06 / hip07)

2018-07-16 Thread Jonathan Cameron
The driver provides in kernel support for hte Hisilicon SEC accelerator found in the hip06 and hip07 SoCs. There are 4 such units on the D05 board for which an appropriate DT binding has been provided. ACPI also works with an appropriate UEFI build. The hardware does not update the IV in chainin

[PATCH 1/3] dt-bindings: Add bindings for Hisilicon SEC crypto accelerators.

2018-07-16 Thread Jonathan Cameron
The hip06 and hip07 SoCs contain a number of these crypto units which accelerate AES and DES operations. Signed-off-by: Jonathan Cameron --- .../bindings/crypto/hisilicon,hip07-sec.txt| 69 ++ 1 file changed, 69 insertions(+) diff --git a/Documentation/devicetree/bin

[PATCH 3/3] arm64: dts: hisi: add SEC crypto accelerator nodes for hip07 SoC

2018-07-16 Thread Jonathan Cameron
Enable all 4 SEC units available on d05 boards. Signed-off-by: Jonathan Cameron --- arch/arm64/boot/dts/hisilicon/hip07.dtsi | 285 +++ 1 file changed, 285 insertions(+) diff --git a/arch/arm64/boot/dts/hisilicon/hip07.dtsi b/arch/arm64/boot/dts/hisilicon/hip07.dtsi

[PATCH 4.17 55/67] crypto: dont optimize keccakf()

2018-07-16 Thread Greg Kroah-Hartman
4.17-stable review patch. If anyone has any objections, please let me know. -- From: Dmitry Vyukov commit f044a84e040b85cd609851ac88ae8b54b2cc0b75 upstream. keccakf() is the only function in kernel that uses __optimize() macro. __optimize() breaks frame pointer unwinder as opt

Re: [PATCH v4 11/14] treewide: Prepare to remove VLA usage for AHASH_REQUEST_ON_STACK

2018-07-16 Thread Arnd Bergmann
On Mon, Jul 16, 2018 at 5:39 AM, Kees Cook wrote: > On Sun, Jul 15, 2018 at 5:01 PM, Herbert Xu > wrote: >> On Sat, Jul 14, 2018 at 07:59:09PM -0700, Kees Cook wrote: >>> On Sat, Jul 14, 2018 at 7:44 PM, Herbert Xu >>> wrote: >>> > On Fri, Jul 13, 2018 at 08:07:10PM -0700, Kees Cook wrote: >>>