Re: [PATCH] crypto: x86/twofish-3way - Fix %rbp usage

2017-12-18 Thread Ingo Molnar
* Eric Biggers wrote: > There may be a small overhead caused by replacing 'xchg REG, REG' with > the needed sequence 'mov MEM, REG; mov REG, MEM; mov REG, REG' once per > round. But, counterintuitively, when I tested "ctr-twofish-3way" on a > Haswell processor, the new version was actually abou

[PATCH v2] crypto: AF_ALG - limit mask and type

2017-12-18 Thread Stephan Müller
The user space interface allows specifying the type and the mask field used to allocate the cipher. As user space can precisely select the desired cipher by using either the name or the driver name, additional selection options for cipher are not considered necessary and relevant for user space. T

Re: [PATCH RESEND] crypto: af_alg - add keylen checking to avoid NULL ptr passing down

2017-12-18 Thread Li Kun
在 2017/12/19 3:12, Eric Biggers 写道: On Mon, Dec 18, 2017 at 01:40:36PM +, Li Kun wrote: alg_setkey do not check the keylen whether it is zero, so the key may be ZERO_SIZE_PTR when keylen is 0, which will pass the copy_from_user's checking and be passed to the lower functions as key. If th

[PATCH] crypto: x86/twofish-3way - Fix %rbp usage

2017-12-18 Thread Eric Biggers
From: Eric Biggers Using %rbp as a temporary register breaks frame pointer convention and breaks stack traces when unwinding from an interrupt in the crypto code. In twofish-3way, we can't simply replace %rbp with another register because there are none available. Instead, we use the stack to h

Re: [PATCH RESEND] crypto: af_alg - add keylen checking to avoid NULL ptr passing down

2017-12-18 Thread Eric Biggers
On Mon, Dec 18, 2017 at 01:40:36PM +, Li Kun wrote: > alg_setkey do not check the keylen whether it is zero, so the key > may be ZERO_SIZE_PTR when keylen is 0, which will pass the > copy_from_user's checking and be passed to the lower functions as key. > > If the lower functions only check th

Re: RFC: Crypto: Race in updating available writable socket memory.

2017-12-18 Thread Stephan Mueller
Am Montag, 18. Dezember 2017, 15:26:00 CET schrieb Jonathan Cameron: Hi Jonathan, > Hi All, > > I came across this one but am not sure how heavy weight a fix we want to > apply. > > I was getting failures on af_alg_readable in af_alg_get_rsgl which made > little sense as I had wmem set to a ver

RFC: Crypto: Race in updating available writable socket memory.

2017-12-18 Thread Jonathan Cameron
Hi All, I came across this one but am not sure how heavy weight a fix we want to apply. I was getting failures on af_alg_readable in af_alg_get_rsgl which made little sense as I had wmem set to a very large value. This was caused by a race between ctx->rcvused += err in af_alg_get_rsgl and ctx-

[PATCH RESEND] crypto: af_alg - add keylen checking to avoid NULL ptr passing down

2017-12-18 Thread Li Kun
alg_setkey do not check the keylen whether it is zero, so the key may be ZERO_SIZE_PTR when keylen is 0, which will pass the copy_from_user's checking and be passed to the lower functions as key. If the lower functions only check the key if it is NULL, ZERO_SIZE_PTR will pass the checking, and wil

Re: [PATCH] crypto: af_alg - add keylen checking to avoid NULL ptr passing down

2017-12-18 Thread Li Kun
在 2017/12/18 20:00, Greg KH 写道: On Mon, Dec 18, 2017 at 11:09:23AM +, Li Kun wrote: alg_setkey do not check the keylen whether it is zero, so the key may be ZERO_SIZE_PTR when keylen is 0, which will pass the copy_from_user's checking and be passed to the lower functions as key. If the lo

Re: [PATCH] crypto: af_alg - add keylen checking to avoid NULL ptr passing down

2017-12-18 Thread Greg KH
On Mon, Dec 18, 2017 at 11:09:23AM +, Li Kun wrote: > alg_setkey do not check the keylen whether it is zero, so the key > may be ZERO_SIZE_PTR when keylen is 0, which will pass the > copy_from_user's checking and be passed to the lower functions as key. > > If the lower functions only check th

[PATCH] crypto: af_alg - add keylen checking to avoid NULL ptr passing down

2017-12-18 Thread Li Kun
alg_setkey do not check the keylen whether it is zero, so the key may be ZERO_SIZE_PTR when keylen is 0, which will pass the copy_from_user's checking and be passed to the lower functions as key. If the lower functions only check the key if it is NULL, ZERO_SIZE_PTR will pass the checking, and wil