Re: [dm-devel] dm thin: superblock may write succeed before other metadata blocks because of wirting metadata in async mode.

2018-06-20 Thread monty
On Wed, Jun 20, 2018 at 10:51:17AM -0400, Mike Snitzer wrote: > > On Wed, Jun 20 2018 at 1:03pm -0400, > monty wrote: > > > > > On Tue, Jun 19, 2018 at 11:00:32AM -0400, Mike Snitzer wrote: > > > > > > On Tue, Jun 19 2018 at 10:43am -0400, > > > Joe Thornber wrote: > > > > > > > On Tue,

Re: [dm-devel] [PATCH 05/11] crypto alg: Introduce max blocksize and alignmask

2018-06-20 Thread Eric Biggers
On Wed, Jun 20, 2018 at 05:04:08PM -0700, Kees Cook wrote: > On Wed, Jun 20, 2018 at 4:40 PM, Eric Biggers wrote: > > On Wed, Jun 20, 2018 at 12:04:02PM -0700, Kees Cook wrote: > >> In the quest to remove all stack VLA usage from the kernel[1], this > >> exposes the existing upper bound on crypto

Re: [dm-devel] [PATCH 09/11] crypto: shash: Remove VLA usage in unaligned hashing

2018-06-20 Thread Kees Cook
On Wed, Jun 20, 2018 at 4:57 PM, Eric Biggers wrote: > On Wed, Jun 20, 2018 at 12:04:06PM -0700, Kees Cook wrote: >> 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

Re: [dm-devel] [PATCH 07/11] crypto: xcbc: Remove VLA usage

2018-06-20 Thread Kees Cook
On Wed, Jun 20, 2018 at 4:46 PM, Eric Biggers wrote: > On Wed, Jun 20, 2018 at 12:04:04PM -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. >> >> [1] >>

Re: [dm-devel] [PATCH 05/11] crypto alg: Introduce max blocksize and alignmask

2018-06-20 Thread Kees Cook
On Wed, Jun 20, 2018 at 4:40 PM, Eric Biggers wrote: > On Wed, Jun 20, 2018 at 12:04:02PM -0700, Kees Cook wrote: >> In the quest to remove all stack VLA usage from the kernel[1], this >> exposes the existing upper bound on crypto block sizes for VLA removal, >> and introduces a new check for

Re: [dm-devel] [PATCH 09/11] crypto: shash: Remove VLA usage in unaligned hashing

2018-06-20 Thread Eric Biggers
On Wed, Jun 20, 2018 at 12:04:06PM -0700, Kees Cook wrote: > 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

Re: [dm-devel] [PATCH 07/11] crypto: xcbc: Remove VLA usage

2018-06-20 Thread Eric Biggers
On Wed, Jun 20, 2018 at 12:04:04PM -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. > > [1] > https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com > >

Re: [dm-devel] [PATCH 04/11] dm verity fec: Remove VLA usage

2018-06-20 Thread Kees Cook
On Wed, Jun 20, 2018 at 4:33 PM, Eric Biggers wrote: > On Wed, Jun 20, 2018 at 12:04:01PM -0700, Kees Cook wrote: >> 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] >>

Re: [dm-devel] [PATCH 06/11] crypto: cbc: Remove VLA usage

2018-06-20 Thread Eric Biggers
On Wed, Jun 20, 2018 at 12:04:03PM -0700, Kees Cook wrote: > In the quest to remove all stack VLA usage from the kernel[1], this > uses the upper bounds on blocksize. > > [1] > https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com > > Signed-off-by: Kees

Re: [dm-devel] [PATCH 05/11] crypto alg: Introduce max blocksize and alignmask

2018-06-20 Thread Eric Biggers
On Wed, Jun 20, 2018 at 12:04:02PM -0700, Kees Cook wrote: > In the quest to remove all stack VLA usage from the kernel[1], this > exposes the existing upper bound on crypto block sizes for VLA removal, > and introduces a new check for alignmask (current maximum in the kernel > is 63 from manual

Re: [dm-devel] [PATCH 04/11] dm verity fec: Remove VLA usage

2018-06-20 Thread Eric Biggers
On Wed, Jun 20, 2018 at 12:04:01PM -0700, Kees Cook wrote: > 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] >

Re: [dm-devel] [PATCH 01/11] crypto: shash: Remove VLA usage

2018-06-20 Thread Kees Cook
On Wed, Jun 20, 2018 at 1:39 PM, Christophe LEROY wrote: > > > Le 20/06/2018 à 22:36, Kees Cook a écrit : >> >> On Wed, Jun 20, 2018 at 12:30 PM, Christophe Leroy >> wrote: >>> >>> >>> >>> On 06/20/2018 07:03 PM, Kees Cook wrote: In the quest to remove all stack VLA usage from the

Re: [dm-devel] [PATCH 11/11] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-06-20 Thread Kees Cook
On Wed, Jun 20, 2018 at 12:44 PM, Arnd Bergmann wrote: > On Wed, Jun 20, 2018 at 9:04 PM, Kees Cook wrote: >> 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. >> >> >>

Re: [dm-devel] [PATCH 01/11] crypto: shash: Remove VLA usage

2018-06-20 Thread Kees Cook
On Wed, Jun 20, 2018 at 12:30 PM, Christophe Leroy wrote: > > > On 06/20/2018 07:03 PM, Kees Cook wrote: >> >> 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

Re: [dm-devel] [PATCH 11/11] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-06-20 Thread Arnd Bergmann
On Wed, Jun 20, 2018 at 9:04 PM, Kees Cook wrote: > 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. > > > +#define SKCIPHER_MAX_REQSIZE (PAGE_SIZE / 8) > + > #define

[dm-devel] [PATCH 05/11] crypto alg: Introduce max blocksize and alignmask

2018-06-20 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this exposes the existing upper bound on crypto block sizes for VLA removal, and introduces a new check for alignmask (current maximum in the kernel is 63 from manual inspection of all cra_alignmask settings). [1]

[dm-devel] [PATCH 03/11] crypto: ahash: Remove VLA usage

2018-06-20 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

[dm-devel] [PATCH 00/11] crypto: Remove VLA usage

2018-06-20 Thread Kees Cook
Hi, This is nearly the last of the VLA removals[1], but it's one of the largest because crypto gets used in lots of places. After looking through code, usage, reading the threads Gustavo started, and comparing the use-cases to the other VLA removals that have landed in the kernel, I think this

[dm-devel] [PATCH 10/11] crypto: ahash: Remove VLA usage for AHASH_REQUEST_ON_STACK

2018-06-20 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 registration. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook ---

[dm-devel] [PATCH 06/11] crypto: cbc: Remove VLA usage

2018-06-20 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the upper bounds on blocksize. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- include/crypto/cbc.h | 2 +- 1 file changed, 1 insertion(+), 1

[dm-devel] [PATCH 07/11] crypto: xcbc: Remove VLA usage

2018-06-20 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. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook --- crypto/xcbc.c | 5 - 1 file changed, 4

[dm-devel] [PATCH 11/11] crypto: skcipher: Remove VLA usage for SKCIPHER_REQUEST_ON_STACK

2018-06-20 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. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Kees Cook ---

[dm-devel] [PATCH 09/11] crypto: shash: Remove VLA usage in unaligned hashing

2018-06-20 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. [1]

[dm-devel] [PATCH 08/11] crypto: qat: Remove VLA usage

2018-06-20 Thread Kees Cook
In the quest to remove all stack VLA usage from the kernel[1], this uses the upper bound for the stack buffer. Also adds a sanity check. This additionally raises the stack size limit during the build, to avoid a compiler warning while keeping it reasonably close to expected stack size. The warning

[dm-devel] [PATCH 02/11] dm integrity: Remove VLA usage

2018-06-20 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 ---

Re: [dm-devel] [PATCH v2 4/7] dm: prevent DAX mounts if not supported

2018-06-20 Thread Mike Snitzer
On Mon, Jun 04 2018 at 7:15pm -0400, Ross Zwisler wrote: > On Fri, Jun 01, 2018 at 05:55:13PM -0400, Mike Snitzer wrote: > > On Tue, May 29 2018 at 3:51pm -0400, > > Ross Zwisler wrote: > > > > > Currently the code in dm_dax_direct_access() only checks whether the > > > target > > > type

Re: [dm-devel] dm thin: superblock may write succeed before other metadata blocks because of wirting metadata in async mode.

2018-06-20 Thread Joe Thornber
On Wed, Jun 20, 2018 at 01:03:57PM -0400, monty wrote: > Hi, Mike and Joe. Thanks for your reply. I read __commit_transaction > many times and didn't find any problem of 2-phase commit. I use > md-raid1(PCIe nvme and md-raid5) in write-behind mode to store dm-thin > metadata. > Test case: > 1. I

Re: [dm-devel] dm thin: superblock may write succeed before other metadata blocks because of wirting metadata in async mode.

2018-06-20 Thread Mike Snitzer
On Wed, Jun 20 2018 at 1:03pm -0400, monty wrote: > > On Tue, Jun 19, 2018 at 11:00:32AM -0400, Mike Snitzer wrote: > > > > On Tue, Jun 19 2018 at 10:43am -0400, > > Joe Thornber wrote: > > > > > On Tue, Jun 19, 2018 at 09:11:06AM -0400, Mike Snitzer wrote: > > > > On Mon, May 21 2018 at

Re: [dm-devel] [PATCH v3 0/5] bitmap: Introduce alloc/free helpers

2018-06-20 Thread Andy Shevchenko
On Wed, 2018-06-20 at 10:33 +0300, Yury Norov wrote: > On Mon, Jun 18, 2018 at 04:09:58PM +0300, Andy Shevchenko wrote: > > External Email > > > > A lot of code is using allocation of bitmaps using BITS_PER_LONG() > > macro and > > sizeof(unsigned long) operator. The readability suffers because

Re: [dm-devel] [RFC] kill bio_clone_kmalloc and bio_clone_bioset

2018-06-20 Thread Ming Lei
On Tue, Jun 19, 2018 at 06:52:10AM +0200, Christoph Hellwig wrote: > Hi all, > > this series removes all but one users of the traditional deep bio clone, > and then moves bio_clone_bioset to its only caller so that we get rid > of the deep bio cloning in the block layer API. > > Patch 1 is

Re: [dm-devel] [PATCH v2 5/5] Input: evdev - Switch to bitmap_zalloc()

2018-06-20 Thread Dmitry Torokhov
On Sat, Jun 16, 2018 at 12:42:31AM +0300, Yury Norov wrote: > Hi Andy, > > On Fri, Jun 15, 2018 at 04:20:17PM +0300, Andy Shevchenko wrote: > > Switch to bitmap_zalloc() to show clearly what we are allocating. > > Besides that it returns pointer of bitmap type instead of opaque void *. > > > >

Re: [dm-devel] [PATCH v3 0/5] bitmap: Introduce alloc/free helpers

2018-06-20 Thread Yury Norov
On Mon, Jun 18, 2018 at 04:09:58PM +0300, Andy Shevchenko wrote: > External Email > > A lot of code is using allocation of bitmaps using BITS_PER_LONG() macro and > sizeof(unsigned long) operator. The readability suffers because of this. > > The series introduces three helpers, i.e.

Re: [dm-devel] [PATCH v2 5/5] Input: evdev - Switch to bitmap_zalloc()

2018-06-20 Thread Yury Norov
On Tue, Jun 19, 2018 at 11:33:16AM -0700, Dmitry Torokhov wrote: > External Email > > On Sat, Jun 16, 2018 at 12:42:31AM +0300, Yury Norov wrote: > > Hi Andy, > > > > On Fri, Jun 15, 2018 at 04:20:17PM +0300, Andy Shevchenko wrote: > > > Switch to bitmap_zalloc() to show clearly what we are