All of lore.kernel.org
 help / color / mirror / Atom feed
* dm-integrity stalls with iMX6q CAAM
@ 2018-09-21 12:06 Neil Armstrong
  2018-10-17 13:35 ` Horia Geanta
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Armstrong @ 2018-09-21 12:06 UTC (permalink / raw)
  To: linux-crypto, horia.geanta, aymen.sghaier, dm-devel; +Cc: Herbert Xu

Hi,

I recently configured dm-crypt + dm-integrity on an iMX6q platform with CAAM Hash functions enabled using the following command lines :

Linux 4.14.71

cryptsetup luksFormat /dev/mmcblk1p3 --cipher aes-xts-plain64 --type luks2 --integrity hmac-sha256 --sector-size 512 --use-urandom
cryptsetup open /dev/mmcblk1p3 root
mkfs.ext4 -v -F /dev/mapper/root

luksFormat and open finishes correctly, luksDump and status reports correct dm and luks properties.

but when trying to access the /dev/mapper/root (mkfs, sha256sum or whatever), it blocks without any warning or errors reported by the kernel.
I can see a few (~170) interrupts on the jr0 interrupt then nothing.

Is there a particular issue with hmac-sha256 with the linux CAAM driver ?

When disabling the CAAM hash functions or using another cipher & integrity pair, it works like a charm.

Thanks,
Neil

-- 
Neil Armstrong
Embedded Linux Software Engineer
BayLibre - At the Heart of Embedded Linux
www.baylibre.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dm-integrity stalls with iMX6q CAAM
  2018-09-21 12:06 dm-integrity stalls with iMX6q CAAM Neil Armstrong
@ 2018-10-17 13:35 ` Horia Geanta
  2018-10-18  5:35     ` Gilad Ben-Yossef
  2018-10-25 13:40   ` Neil Armstrong
  0 siblings, 2 replies; 5+ messages in thread
From: Horia Geanta @ 2018-10-17 13:35 UTC (permalink / raw)
  To: Neil Armstrong, linux-crypto, Aymen Sghaier, dm-devel; +Cc: Herbert Xu

On 9/21/2018 3:06 PM, Neil Armstrong wrote:
> Hi,
> 
> I recently configured dm-crypt + dm-integrity on an iMX6q platform with CAAM Hash functions enabled using the following command lines :
> 
> Linux 4.14.71
> 
> cryptsetup luksFormat /dev/mmcblk1p3 --cipher aes-xts-plain64 --type luks2 --integrity hmac-sha256 --sector-size 512 --use-urandom
> cryptsetup open /dev/mmcblk1p3 root
> mkfs.ext4 -v -F /dev/mapper/root
> 
> luksFormat and open finishes correctly, luksDump and status reports correct dm and luks properties.
> 
> but when trying to access the /dev/mapper/root (mkfs, sha256sum or whatever), it blocks without any warning or errors reported by the kernel.
> I can see a few (~170) interrupts on the jr0 interrupt then nothing.
> 
> Is there a particular issue with hmac-sha256 with the linux CAAM driver ?
> 
> When disabling the CAAM hash functions or using another cipher & integrity pair, it works like a charm.
> 
The issue you are seeing is most probably related to CAAM driver not
implementing correctly the crypto requests "backlogging".
See commit c0403ec0bb5a ("Revert "dm crypt: fix deadlock when async crypto
algorithm returns -EBUSY"") for a detailed description.

Historically, there have been several CAAM backlogging implementations proposed
- but all were rejected:
v1: https://patchwork.kernel.org/patch/7144701
v2: https://patchwork.kernel.org/patch/7199241
v3: https://patchwork.kernel.org/patch/7221941
v4: https://patchwork.kernel.org/patch/7230241
v5: https://patchwork.kernel.org/patch/9033121

Discussion here: https://community.nxp.com/message/1020096
mentions v2 as solving the issue.
You could try it while we find a solution that would be accepted upstream.

Hope this helps,
Horia

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dm-integrity stalls with iMX6q CAAM
  2018-10-17 13:35 ` Horia Geanta
@ 2018-10-18  5:35     ` Gilad Ben-Yossef
  2018-10-25 13:40   ` Neil Armstrong
  1 sibling, 0 replies; 5+ messages in thread
From: Gilad Ben-Yossef @ 2018-10-18  5:35 UTC (permalink / raw)
  To: Horia Geantă
  Cc: narmstrong, Linux Crypto Mailing List, aymen.sghaier,
	device-mapper development, Herbert Xu

On Wed, Oct 17, 2018 at 4:35 PM Horia Geanta <horia.geanta@nxp.com> wrote:
>
> On 9/21/2018 3:06 PM, Neil Armstrong wrote:
> > Hi,
> >
> > I recently configured dm-crypt + dm-integrity on an iMX6q platform with CAAM Hash functions enabled using the following command lines :
> >
> > Linux 4.14.71
> >
> > cryptsetup luksFormat /dev/mmcblk1p3 --cipher aes-xts-plain64 --type luks2 --integrity hmac-sha256 --sector-size 512 --use-urandom
> > cryptsetup open /dev/mmcblk1p3 root
> > mkfs.ext4 -v -F /dev/mapper/root
> >
> > luksFormat and open finishes correctly, luksDump and status reports correct dm and luks properties.
> >
> > but when trying to access the /dev/mapper/root (mkfs, sha256sum or whatever), it blocks without any warning or errors reported by the kernel.
> > I can see a few (~170) interrupts on the jr0 interrupt then nothing.
> >
> > Is there a particular issue with hmac-sha256 with the linux CAAM driver ?
> >
> > When disabling the CAAM hash functions or using another cipher & integrity pair, it works like a charm.
> >
> The issue you are seeing is most probably related to CAAM driver not
> implementing correctly the crypto requests "backlogging".
> See commit c0403ec0bb5a ("Revert "dm crypt: fix deadlock when async crypto
> algorithm returns -EBUSY"") for a detailed description.
>
> Historically, there have been several CAAM backlogging implementations proposed
> - but all were rejected:

hmmm... obviously the right solution is to implement backlogging but
you might want to consider changing the driver to
return -ENOSPC or -ENOSYS instead in the meantime. It should cause
dm-crypt to fail rather than hang... which is not necessarily better,
but at least more obvious by the user what is going on?

Gilad

-- 
Gilad Ben-Yossef
Chief Coffee Drinker

values of β will give rise to dom!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dm-integrity stalls with iMX6q CAAM
@ 2018-10-18  5:35     ` Gilad Ben-Yossef
  0 siblings, 0 replies; 5+ messages in thread
From: Gilad Ben-Yossef @ 2018-10-18  5:35 UTC (permalink / raw)
  To: Horia Geantă
  Cc: Herbert Xu, device-mapper development, aymen.sghaier,
	Linux Crypto Mailing List, narmstrong

On Wed, Oct 17, 2018 at 4:35 PM Horia Geanta <horia.geanta@nxp.com> wrote:
>
> On 9/21/2018 3:06 PM, Neil Armstrong wrote:
> > Hi,
> >
> > I recently configured dm-crypt + dm-integrity on an iMX6q platform with CAAM Hash functions enabled using the following command lines :
> >
> > Linux 4.14.71
> >
> > cryptsetup luksFormat /dev/mmcblk1p3 --cipher aes-xts-plain64 --type luks2 --integrity hmac-sha256 --sector-size 512 --use-urandom
> > cryptsetup open /dev/mmcblk1p3 root
> > mkfs.ext4 -v -F /dev/mapper/root
> >
> > luksFormat and open finishes correctly, luksDump and status reports correct dm and luks properties.
> >
> > but when trying to access the /dev/mapper/root (mkfs, sha256sum or whatever), it blocks without any warning or errors reported by the kernel.
> > I can see a few (~170) interrupts on the jr0 interrupt then nothing.
> >
> > Is there a particular issue with hmac-sha256 with the linux CAAM driver ?
> >
> > When disabling the CAAM hash functions or using another cipher & integrity pair, it works like a charm.
> >
> The issue you are seeing is most probably related to CAAM driver not
> implementing correctly the crypto requests "backlogging".
> See commit c0403ec0bb5a ("Revert "dm crypt: fix deadlock when async crypto
> algorithm returns -EBUSY"") for a detailed description.
>
> Historically, there have been several CAAM backlogging implementations proposed
> - but all were rejected:

hmmm... obviously the right solution is to implement backlogging but
you might want to consider changing the driver to
return -ENOSPC or -ENOSYS instead in the meantime. It should cause
dm-crypt to fail rather than hang... which is not necessarily better,
but at least more obvious by the user what is going on?

Gilad

-- 
Gilad Ben-Yossef
Chief Coffee Drinker

values of β will give rise to dom!

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dm-integrity stalls with iMX6q CAAM
  2018-10-17 13:35 ` Horia Geanta
  2018-10-18  5:35     ` Gilad Ben-Yossef
@ 2018-10-25 13:40   ` Neil Armstrong
  1 sibling, 0 replies; 5+ messages in thread
From: Neil Armstrong @ 2018-10-25 13:40 UTC (permalink / raw)
  To: Horia Geanta, linux-crypto, Aymen Sghaier, dm-devel; +Cc: Herbert Xu

On 17/10/2018 15:35, Horia Geanta wrote:
> On 9/21/2018 3:06 PM, Neil Armstrong wrote:
>> Hi,
>>
>> I recently configured dm-crypt + dm-integrity on an iMX6q platform with CAAM Hash functions enabled using the following command lines :
>>
>> Linux 4.14.71
>>
>> cryptsetup luksFormat /dev/mmcblk1p3 --cipher aes-xts-plain64 --type luks2 --integrity hmac-sha256 --sector-size 512 --use-urandom
>> cryptsetup open /dev/mmcblk1p3 root
>> mkfs.ext4 -v -F /dev/mapper/root
>>
>> luksFormat and open finishes correctly, luksDump and status reports correct dm and luks properties.
>>
>> but when trying to access the /dev/mapper/root (mkfs, sha256sum or whatever), it blocks without any warning or errors reported by the kernel.
>> I can see a few (~170) interrupts on the jr0 interrupt then nothing.
>>
>> Is there a particular issue with hmac-sha256 with the linux CAAM driver ?
>>
>> When disabling the CAAM hash functions or using another cipher & integrity pair, it works like a charm.
>>
> The issue you are seeing is most probably related to CAAM driver not
> implementing correctly the crypto requests "backlogging".
> See commit c0403ec0bb5a ("Revert "dm crypt: fix deadlock when async crypto
> algorithm returns -EBUSY"") for a detailed description.
> 
> Historically, there have been several CAAM backlogging implementations proposed
> - but all were rejected:
> v1: https://patchwork.kernel.org/patch/7144701
> v2: https://patchwork.kernel.org/patch/7199241
> v3: https://patchwork.kernel.org/patch/7221941
> v4: https://patchwork.kernel.org/patch/7230241
> v5: https://patchwork.kernel.org/patch/9033121
> 
> Discussion here: https://community.nxp.com/message/1020096
> mentions v2 as solving the issue.
> You could try it while we find a solution that would be accepted upstream.
> 
> Hope this helps,
> Horia
> 

Hi Horia,

Thanks for the pointers ! Hopefully you will find a solution soon.

Neil

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-25 22:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-21 12:06 dm-integrity stalls with iMX6q CAAM Neil Armstrong
2018-10-17 13:35 ` Horia Geanta
2018-10-18  5:35   ` Gilad Ben-Yossef
2018-10-18  5:35     ` Gilad Ben-Yossef
2018-10-25 13:40   ` Neil Armstrong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.