Re: KASAN: use-after-free Read in blkcipher_walk_virt

2017-11-30 Thread Eric Biggers
On Thu, Nov 30, 2017 at 12:37:01AM -0800, syzbot wrote: > == > BUG: KASAN: use-after-free in crypto_tfm_alg_blocksize > include/linux/crypto.h:671 [inline] > BUG: KASAN: use-after-free in crypto_blkcipher_blocksize > include/linux/cryp

Re: KASAN: slab-out-of-bounds Read in crypto_chacha20_crypt

2017-11-30 Thread Eric Biggers
On Thu, Nov 30, 2017 at 12:37:01AM -0800, syzbot wrote: > == > BUG: KASAN: slab-out-of-bounds in __le32_to_cpup > include/uapi/linux/byteorder/little_endian.h:58 [inline] > BUG: KASAN: slab-out-of-bounds in le32_to_cpuvp crypto/chacha2

Re: WARNING: kernel stack regs has bad 'bp' value (2)

2017-11-30 Thread Eric Biggers
On Tue, Nov 28, 2017 at 10:36:01AM -0800, syzbot wrote: > WARNING: kernel stack regs at 8801c1e5f468 in syzkaller196611:6199 has > bad 'bp' value 0001 > unwind stack type:0 next_sp: (null) mask:0x6 graph_idx:0 > 8801db4075a8: 8801db407630 (0x8801db407630) >

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Kamil Konieczny
Hi Antoine, On 28.11.2017 16:42, Antoine Tenart wrote: > The patch fixes the ahash support by only updating the result buffer > when provided. Otherwise the driver could crash with NULL pointer > exceptions, because the ahash caller isn't required to supply a result > buffer on all calls. Can you

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Antoine Tenart
Hi Kamil, On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: > On 28.11.2017 16:42, Antoine Tenart wrote: > > The patch fixes the ahash support by only updating the result buffer > > when provided. Otherwise the driver could crash with NULL pointer > > exceptions, because the ahash c

[PATCH 6/6] crypto: tcrypt: add multibuf aead speed test

2017-11-30 Thread Gilad Ben-Yossef
The performance of some aead tfm providers is affected by the amount of parallelism possible with the processing. Introduce an async aead concurrent multiple buffer processing speed test to be able to test performance of such tfm providers. Signed-off-by: Gilad Ben-Yossef --- crypto/tcrypt.c |

[PATCH 0/6] crypto: tcrypt: fix and add multi buf speed tests

2017-11-30 Thread Gilad Ben-Yossef
The performance of some crypto tfm providers is affected by the amount of parallelism possible with the processing. We already had some support for speed test of multiple concurrent requests, dubbed multi buffer, in ahash speed tests. This patch set extends said support and add similar support fo

[PATCH 5/6] crypto: tcrypt: add multibuf skcipher speed test

2017-11-30 Thread Gilad Ben-Yossef
The performance of some skcipher tfm providers is affected by the amount of parallelism possible with the processing. Introduce an async skcipher concurrent multiple buffer processing speed test to be able to test performance of such tfm providers. Signed-off-by: Gilad Ben-Yossef --- crypto/tcr

[PATCH 3/6] crypto: tcrypt: allow setting num of bufs

2017-11-30 Thread Gilad Ben-Yossef
For multiple buffers speed tests, the number of buffers, or requests, used actually sets the level of parallelism a tfm provider may utilize to hide latency. The existing number (of 8) is good for some software based providers but not enough for many HW providers with deep FIFOs. Add a module para

[PATCH 4/6] crypto: tcrypt: add multi buf ahash jiffies test

2017-11-30 Thread Gilad Ben-Yossef
The multi buffer concurrent requests ahash speed test only supported the cycles mode. Add support for the so called jiffies mode that test performance of bytes/sec. We only add support for digest mode at the moment. Signed-off-by: Gilad Ben-Yossef --- crypto/tcrypt.c | 112 +

[PATCH 1/6] crypto: tcrypt: use multi buf for ahash mb test

2017-11-30 Thread Gilad Ben-Yossef
The multi buffer ahash speed test was allocating multiple buffers for use with the multiple outstanding requests it was starting but never actually using them (except to free them), instead using a different single statically allocated buffer for all requests. Fix this by actually using the alloca

[PATCH 2/6] crypto: tcrypt: fix AEAD decryption speed test

2017-11-30 Thread Gilad Ben-Yossef
The AEAD speed test pretended to support decryption, however that support was broken as decryption requires a valid auth field which the test did not provide. Fix this by running the encryption path once with inout/output sgls switched to calculate the auth field prior to performing decryption spe

[PATCH] crypto: stm32: fix module device table name

2017-11-30 Thread Corentin Labbe
This patch fix the following build failure: CC [M] drivers/crypto/stm32/stm32-cryp.o In file included from drivers/crypto/stm32/stm32-cryp.c:11:0: drivers/crypto/stm32/stm32-cryp.c:1049:25: error: 'sti_dt_ids' undeclared here (not in a function) MODULE_DEVICE_TABLE(of, sti_dt_ids); Let's repl

Re: [PATCH] crypto: stm32: fix module device table name

2017-11-30 Thread Fabien DESSENNE
Hi Corentin Thank you for the patch. On 30/11/17 12:04, Corentin Labbe wrote: > This patch fix the following build failure: >CC [M] drivers/crypto/stm32/stm32-cryp.o > In file included from drivers/crypto/stm32/stm32-cryp.c:11:0: > drivers/crypto/stm32/stm32-cryp.c:1049:25: error: 'sti_dt_

[PATCH] crypto: cryptd: make cryptd_max_cpu_qlen module parameter static

2017-11-30 Thread Colin King
From: Colin Ian King The cryptd_max_cpu_qlen module parameter is local to the source and does not need to be in global scope, so make it static. Cleans up sparse warning: crypto/cryptd.c:35:14: warning: symbol 'cryptd_max_cpu_qlen' was not declared. Should it be static? Signed-off-by: Colin Ian

[PATCH] crypto: chelsio: make arrays sgl_ent_len and dsgl_ent_len static

2017-11-30 Thread Colin King
From: Colin Ian King The arrays sgl_ent_len and dsgl_ent_len are local to the source and do not need to be in global scope, so make them static. Also re-format the declarations to match the following round_constant array declaration style. Cleans up sparse warnings: drivers/crypto/chelsio/chcr_a

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Kamil Konieczny
Hi Antoine, On 30.11.2017 10:29, Antoine Tenart wrote: > Hi Kamil, > > On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: >> On 28.11.2017 16:42, Antoine Tenart wrote: >>> The patch fixes the ahash support by only updating the result buffer >>> when provided. Otherwise the driver co

[PATCH] crypto: mcryptd: protect the per-CPU queue with a lock

2017-11-30 Thread Sebastian Andrzej Siewior
mcryptd_enqueue_request() grabs the per-CPU queue struct and protects access to it with disabled preemption. Then it schedules a worker on the same CPU. The worker in mcryptd_queue_worker() guards access to the same per-CPU variable with disabled preemption. If we take CPU-hotplug into account the

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Antoine Tenart
On Thu, Nov 30, 2017 at 12:52:42PM +0100, Kamil Konieczny wrote: > On 30.11.2017 10:29, Antoine Tenart wrote: > > On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: > >> can the driver get request for final/finup/digest with null req->result ? > > > > I don't think that can happen. B

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Kamil Konieczny
On 30.11.2017 13:41, Antoine Tenart wrote: > On Thu, Nov 30, 2017 at 12:52:42PM +0100, Kamil Konieczny wrote: >> On 30.11.2017 10:29, Antoine Tenart wrote: >>> On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: can the driver get request for final/finup/digest with null req->re

[PATCH] chcr: remove unused variables net_device, pi, adap and cntrl

2017-11-30 Thread Colin King
From: Colin Ian King Variables adap, pi and cntrl are assigned but are never read, hence they are redundant and can be removed. Cleans up various clang build warnings. Signed-off-by: Colin Ian King --- drivers/crypto/chelsio/chcr_ipsec.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletio

[PATCH] chcr: ensure cntrl is initialized to fix bit-wise or'ing of garabage data

2017-11-30 Thread Colin King
From: Colin Ian King In the case where skb->ip_summed != CHECKSUM_PARTIAL then cntrl contains garbage value and this is possibly being bit-wise or'd and stored into cpl->ctrl1. Fix this by initializing cntrl to zero. Cleans up clang warning: drivers/crypto/chelsio/chcr_ipsec.c:374:9: warning: T

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Antoine Tenart
Hi Kamil, On Thu, Nov 30, 2017 at 03:10:28PM +0100, Kamil Konieczny wrote: > On 30.11.2017 13:41, Antoine Tenart wrote: > > > > No, if we do this we'll lose the ability to export the current state. > > So maybe save it into request context: > > result_sz = crypto_ahash_digestsize(ahash);

[PATCH v5 26/27] x86_32: assembly, change all ENTRY+ENDPROC to SYM_FUNC_*

2017-11-30 Thread Jiri Slaby
These are all functions which are invoked from elsewhere, so we annotate them as global using the new SYM_FUNC_START (and their ENDPROC's by SYM_FUNC_END.) Now, we can finally force ENTRY/ENDPROC to be undefined on X86. Signed-off-by: Jiri Slaby Cc: "H. Peter Anvin" Cc: Thomas Gleixner Cc: Ing

[PATCH v5 23/27] x86_64: assembly, change all ENTRY+ENDPROC to SYM_FUNC_*

2017-11-30 Thread Jiri Slaby
These are all functions which are invoked from elsewhere, so we annotate them as global using the new SYM_FUNC_START. And their ENDPROC's by SYM_FUNC_END. And make sure ENTRY/ENDPROC is not defined on X86_64, given these were the last users. Signed-off-by: Jiri Slaby Reviewed-by: Rafael J. Wysoc

[PATCH v5 08/27] x86: assembly, annotate aliases

2017-11-30 Thread Jiri Slaby
_key_expansion_128 is an alias to _key_expansion_256a, __memcpy to memcpy, xen_syscall32_target to xen_sysenter_target, and so on. Annotate them all using the new SYM_FUNC_START_ALIAS, SYM_FUNC_START_LOCAL_ALIAS, and SYM_FUNC_END_ALIAS. This will make the tools generating the debuginfo happy. Sign

[PATCH v5 06/27] x86: crypto, annotate local functions

2017-11-30 Thread Jiri Slaby
Use the newly added SYM_FUNC_START_LOCAL to annotate starts of all functions which do not have ".globl" annotation, but their ends are annotated by ENDPROC. This is needed to balance ENDPROC for tools that are about to generate debuginfo. To be symmetric, we also convert their ENDPROCs to the new

[PATCH] KEYS: reject NULL restriction string when type is specified

2017-11-30 Thread Eric Biggers
From: Eric Biggers keyctl_restrict_keyring() allows through a NULL restriction when the "type" is non-NULL, which causes a NULL pointer dereference in asymmetric_lookup_restriction() when it calls strcmp() on the restriction string. But no key types actually use a "NULL restriction" to mean anyt

Re: [PATCH v2 3/4] crypto: inside-secure - only update the result buffer when provided

2017-11-30 Thread Herbert Xu
On Thu, Nov 30, 2017 at 10:19:26AM +0100, Kamil Konieczny wrote: > > can the driver get request for final/finup/digest with null req->result ? > If yes (?), such checks can be done before any hardware processing, saving > time, > for example: This should not be possible through any user-space fac

Re: [PATCH] KEYS: reject NULL restriction string when type is specified

2017-11-30 Thread Mat Martineau
Eric, On Thu, 30 Nov 2017, Eric Biggers wrote: From: Eric Biggers keyctl_restrict_keyring() allows through a NULL restriction when the "type" is non-NULL, which causes a NULL pointer dereference in asymmetric_lookup_restriction() when it calls strcmp() on the restriction string. But no key