Re: [dm-devel] Deadlock when using crypto API for block devices

2018-08-27 Thread Dave Watson
On 08/24/18 09:22 PM, Herbert Xu wrote: > > > BTW. gcmaes_crypt_by_sg also contains GFP_ATOMIC and -ENOMEM, behind a > > > pretty complex condition. Do you mean that this condition is part of the > > > contract that the crypto API provides? > > > > This is an implementation defect. I think for

Re: [dm-devel] Deadlock when using crypto API for block devices

2018-08-24 Thread Herbert Xu
On Fri, Aug 24, 2018 at 09:21:45PM +0800, Herbert Xu wrote: > On Fri, Aug 24, 2018 at 09:00:00AM -0400, Mikulas Patocka wrote: > > > > BTW. gcmaes_crypt_by_sg also contains GFP_ATOMIC and -ENOMEM, behind a > > pretty complex condition. Do you mean that this condition is part of the > > contract

Re: [dm-devel] Deadlock when using crypto API for block devices

2018-08-24 Thread Herbert Xu
On Fri, Aug 24, 2018 at 09:00:00AM -0400, Mikulas Patocka wrote: > > BTW. gcmaes_crypt_by_sg also contains GFP_ATOMIC and -ENOMEM, behind a > pretty complex condition. Do you mean that this condition is part of the > contract that the crypto API provides? This is an implementation defect. I

Re: [dm-devel] Deadlock when using crypto API for block devices

2018-08-24 Thread Mikulas Patocka
On Fri, 24 Aug 2018, Mikulas Patocka wrote: > > > On Fri, 24 Aug 2018, Herbert Xu wrote: > > > On Fri, Aug 24, 2018 at 07:06:32AM -0400, Mikulas Patocka wrote: > > > > > > A quick search through the crypto code shows that ahash_save_req and > > > seqiv_aead_encrypt return -ENOMEM. > > > >

Re: [dm-devel] Deadlock when using crypto API for block devices

2018-08-24 Thread Mikulas Patocka
On Fri, 24 Aug 2018, Herbert Xu wrote: > On Fri, Aug 24, 2018 at 07:06:32AM -0400, Mikulas Patocka wrote: > > > > A quick search through the crypto code shows that ahash_save_req and > > seqiv_aead_encrypt return -ENOMEM. > > > > Will you fix them? > > These only trigger for unaligned

Re: [dm-devel] Deadlock when using crypto API for block devices

2018-08-24 Thread Herbert Xu
On Fri, Aug 24, 2018 at 07:22:19AM -0400, Mikulas Patocka wrote: > > And also ablkcipher_next_slow, ablkcipher_copy_iv, skcipher_next_slow, > skcipher_next_copy, skcipher_copy_iv, blkcipher_next_slow, > blkcipher_copy_iv. > > So, I think that dropping CRYPTO_TFM_REQ_MAY_SLEEP is not possible.

Re: [dm-devel] Deadlock when using crypto API for block devices

2018-08-24 Thread Mikulas Patocka
On Fri, 24 Aug 2018, Mikulas Patocka wrote: > > > On Fri, 24 Aug 2018, Herbert Xu wrote: > > > On Thu, Aug 23, 2018 at 04:39:23PM -0400, Mikulas Patocka wrote: > > > > > > 1. don't set CRYPTO_TFM_REQ_MAY_SLEEP in dm-crypt > > > = > > > If we

Re: [dm-devel] Deadlock when using crypto API for block devices

2018-08-24 Thread Mikulas Patocka
On Fri, 24 Aug 2018, Herbert Xu wrote: > On Thu, Aug 23, 2018 at 04:39:23PM -0400, Mikulas Patocka wrote: > > > > 1. don't set CRYPTO_TFM_REQ_MAY_SLEEP in dm-crypt > > = > > If we don't set it, dm-crypt will use GFP_ATOMIC and GFP_ATOMIC may

Re: [dm-devel] Deadlock when using crypto API for block devices

2018-08-23 Thread Herbert Xu
On Thu, Aug 23, 2018 at 04:39:23PM -0400, Mikulas Patocka wrote: > > 1. don't set CRYPTO_TFM_REQ_MAY_SLEEP in dm-crypt > = > If we don't set it, dm-crypt will use GFP_ATOMIC and GFP_ATOMIC may fail. > The function init_crypt in xts.c handles the