All of lore.kernel.org
 help / color / mirror / Atom feed
* Regression in 5.0-rc4 device-mapper - integrity data invalid
@ 2019-02-05 17:06 Milan Broz
  2019-02-05 22:18 ` Mike Snitzer
  0 siblings, 1 reply; 4+ messages in thread
From: Milan Broz @ 2019-02-05 17:06 UTC (permalink / raw)
  To: device-mapper development, Mike Snitzer; +Cc: Mikulas Patocka, Ming Lei

Hi Mike,

since 5.0-rc4 we are not able to use LUKS2 devices with 4k sector size.

For example,
# cryptsetup luksFormat --type luks2 -c aes-xts-plain64 --integrity hmac-sha256 /dev/sdc --sector-size 4096

fails with these syslog errors:
  device-mapper: crypt: Integrity AEAD, tag size 32, IV size 0.
  device-mapper: integrity: Invalid integrity data size 32768, expected 4096
  device-mapper: integrity: Invalid integrity data size 32768, expected 4096

(with 512-byte sectors it seems to work ok)

Bisect shows this commit in rc4 is the problematic one (reverting fixes the problem):

commit 57c36519e4b949f89381053f7283f5d605595b42
Author: Mike Snitzer <snitzer@redhat.com>
Date:   Wed Jan 16 18:53:26 2019 -0500

    dm: fix clone_bio() to trigger blk_recount_segments()
    
    DM's clone_bio() now benefits from using bio_trim() by fixing the fact
    that clone_bio() wasn't clearing BIO_SEG_VALID like bio_trim() does;
    which triggers blk_recount_segments() via bio_phys_segments().
    
    Reviewed-by: Ming Lei <ming.lei@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@redhat.com>

Could you please check what is missing in the patch?

Milan

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

* Re: Regression in 5.0-rc4 device-mapper - integrity data invalid
  2019-02-05 17:06 Regression in 5.0-rc4 device-mapper - integrity data invalid Milan Broz
@ 2019-02-05 22:18 ` Mike Snitzer
  2019-02-06  7:26   ` Milan Broz
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Snitzer @ 2019-02-05 22:18 UTC (permalink / raw)
  To: Milan Broz; +Cc: device-mapper development, Mikulas Patocka, Ming Lei

On Tue, Feb 05 2019 at 12:06pm -0500,
Milan Broz <gmazyland@gmail.com> wrote:

> Hi Mike,
> 
> since 5.0-rc4 we are not able to use LUKS2 devices with 4k sector size.
> 
> For example,
> # cryptsetup luksFormat --type luks2 -c aes-xts-plain64 --integrity hmac-sha256 /dev/sdc --sector-size 4096
> 
> fails with these syslog errors:
>   device-mapper: crypt: Integrity AEAD, tag size 32, IV size 0.
>   device-mapper: integrity: Invalid integrity data size 32768, expected 4096
>   device-mapper: integrity: Invalid integrity data size 32768, expected 4096
> 
> (with 512-byte sectors it seems to work ok)
> 
> Bisect shows this commit in rc4 is the problematic one (reverting fixes the problem):
> 
> commit 57c36519e4b949f89381053f7283f5d605595b42
> Author: Mike Snitzer <snitzer@redhat.com>
> Date:   Wed Jan 16 18:53:26 2019 -0500
> 
>     dm: fix clone_bio() to trigger blk_recount_segments()
>     
>     DM's clone_bio() now benefits from using bio_trim() by fixing the fact
>     that clone_bio() wasn't clearing BIO_SEG_VALID like bio_trim() does;
>     which triggers blk_recount_segments() via bio_phys_segments().
>     
>     Reviewed-by: Ming Lei <ming.lei@redhat.com>
>     Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> 
> Could you please check what is missing in the patch?

Could be that this bio_trim() check is causing it to return early?:

  if (offset == 0 && size == bio->bi_iter.bi_size)
     	     return;

But I'll just effectively revert 57c36519e4b94.  I don't have time right
now to dwell on _why_ this patch, which seemed to be obvious cleanup,
isn't safe.

Thanks!
Mike

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

* Re: Regression in 5.0-rc4 device-mapper - integrity data invalid
  2019-02-05 22:18 ` Mike Snitzer
@ 2019-02-06  7:26   ` Milan Broz
  2019-02-06 14:45     ` Mike Snitzer
  0 siblings, 1 reply; 4+ messages in thread
From: Milan Broz @ 2019-02-06  7:26 UTC (permalink / raw)
  To: Mike Snitzer; +Cc: device-mapper development, Mikulas Patocka, Ming Lei

On 05/02/2019 23:18, Mike Snitzer wrote:
> On Tue, Feb 05 2019 at 12:06pm -0500,
> Milan Broz <gmazyland@gmail.com> wrote:
> 
>> Hi Mike,
>>
>> since 5.0-rc4 we are not able to use LUKS2 devices with 4k sector size.
>>
>> For example,
>> # cryptsetup luksFormat --type luks2 -c aes-xts-plain64 --integrity hmac-sha256 /dev/sdc --sector-size 4096
>>
>> fails with these syslog errors:
>>   device-mapper: crypt: Integrity AEAD, tag size 32, IV size 0.
>>   device-mapper: integrity: Invalid integrity data size 32768, expected 4096
>>   device-mapper: integrity: Invalid integrity data size 32768, expected 4096
>>
>> (with 512-byte sectors it seems to work ok)
>>
>> Bisect shows this commit in rc4 is the problematic one (reverting fixes the problem):
>>
>> commit 57c36519e4b949f89381053f7283f5d605595b42
>> Author: Mike Snitzer <snitzer@redhat.com>
>> Date:   Wed Jan 16 18:53:26 2019 -0500
>>
>>     dm: fix clone_bio() to trigger blk_recount_segments()
>>     
>>     DM's clone_bio() now benefits from using bio_trim() by fixing the fact
>>     that clone_bio() wasn't clearing BIO_SEG_VALID like bio_trim() does;
>>     which triggers blk_recount_segments() via bio_phys_segments().
>>     
>>     Reviewed-by: Ming Lei <ming.lei@redhat.com>
>>     Signed-off-by: Mike Snitzer <snitzer@redhat.com>
>>
>> Could you please check what is missing in the patch?
> 
> Could be that this bio_trim() check is causing it to return early?:
> 
>   if (offset == 0 && size == bio->bi_iter.bi_size)
>      	     return;


Yes, this condition causes that bio_integrity_trim() is not called.
Removing this early return in bio_trim() fixes the issue.

Not sure how this can happen though, the integrity offset should be in sync here...

> 
> But I'll just effectively revert 57c36519e4b94.  I don't have time right
> now to dwell on _why_ this patch, which seemed to be obvious cleanup,
> isn't safe.

Thanks,
Milan

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

* Re: Regression in 5.0-rc4 device-mapper - integrity data invalid
  2019-02-06  7:26   ` Milan Broz
@ 2019-02-06 14:45     ` Mike Snitzer
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Snitzer @ 2019-02-06 14:45 UTC (permalink / raw)
  To: Milan Broz
  Cc: device-mapper development, Mikulas Patocka, Martin K. Petersen,
	Ming Lei

On Wed, Feb 06 2019 at  2:26am -0500,
Milan Broz <gmazyland@gmail.com> wrote:

> On 05/02/2019 23:18, Mike Snitzer wrote:
> > On Tue, Feb 05 2019 at 12:06pm -0500,
> > Milan Broz <gmazyland@gmail.com> wrote:
> > 
> >> Hi Mike,
> >>
> >> since 5.0-rc4 we are not able to use LUKS2 devices with 4k sector size.
> >>
> >> For example,
> >> # cryptsetup luksFormat --type luks2 -c aes-xts-plain64 --integrity hmac-sha256 /dev/sdc --sector-size 4096
> >>
> >> fails with these syslog errors:
> >>   device-mapper: crypt: Integrity AEAD, tag size 32, IV size 0.
> >>   device-mapper: integrity: Invalid integrity data size 32768, expected 4096
> >>   device-mapper: integrity: Invalid integrity data size 32768, expected 4096
> >>
> >> (with 512-byte sectors it seems to work ok)
> >>
> >> Bisect shows this commit in rc4 is the problematic one (reverting fixes the problem):
> >>
> >> commit 57c36519e4b949f89381053f7283f5d605595b42
> >> Author: Mike Snitzer <snitzer@redhat.com>
> >> Date:   Wed Jan 16 18:53:26 2019 -0500
> >>
> >>     dm: fix clone_bio() to trigger blk_recount_segments()
> >>     
> >>     DM's clone_bio() now benefits from using bio_trim() by fixing the fact
> >>     that clone_bio() wasn't clearing BIO_SEG_VALID like bio_trim() does;
> >>     which triggers blk_recount_segments() via bio_phys_segments().
> >>     
> >>     Reviewed-by: Ming Lei <ming.lei@redhat.com>
> >>     Signed-off-by: Mike Snitzer <snitzer@redhat.com>
> >>
> >> Could you please check what is missing in the patch?
> > 
> > Could be that this bio_trim() check is causing it to return early?:
> > 
> >   if (offset == 0 && size == bio->bi_iter.bi_size)
> >      	     return;
> 
> 
> Yes, this condition causes that bio_integrity_trim() is not called.
> Removing this early return in bio_trim() fixes the issue.
> 
> Not sure how this can happen though, the integrity offset should be in sync here...

OK, think we need to get to the bottom of it now then ...
 
> > But I'll just effectively revert 57c36519e4b94.  I don't have time right
> > now to dwell on _why_ this patch, which seemed to be obvious cleanup,
> > isn't safe.

... otherwise by reverting we'd be papering over this unexplained bug.
We can always revert next week if the reason isn't found.  But I'd like
to get to the bottom of this.

Mike

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

end of thread, other threads:[~2019-02-06 14:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-05 17:06 Regression in 5.0-rc4 device-mapper - integrity data invalid Milan Broz
2019-02-05 22:18 ` Mike Snitzer
2019-02-06  7:26   ` Milan Broz
2019-02-06 14:45     ` Mike Snitzer

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.