Re: alignment enforcement in dm-crypt causes severe problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/04/2020 12:21, Andreas Kinzler wrote:
> Hello devs,
> 
> please see issue: 
> https://github.com/virtio-win/kvm-guest-drivers-windows/issues/446
> 
> Short summary: When using encrypted disks with qemu (using dm-crypt) and 
> pass that through LIO/vhost to qemu (via virtio-scsi) the following code 
> is hit:
> 
> https://elixir.bootlin.com/linux/v5.3.18/source/drivers/md/dm-crypt.c#L1251
> 
> I am not familiar with the specification/contract of "bio". So I am not 
> sure if the enforced alignment is legitimate.

Encryption in dm-crypt works with sectors as atomic units of encryption,
so data legth in bio must be aligned to whole sectors.

For example, if you use CBC (Cipher Block Chaining mode), and only
partial encrypted sector is written, the rest is corrupted.

So this restriction is perfectly valid there.

The question is what operation sends such bio structures.
If it is some control operation, it should probably bypass it.

Anyway this seems like but in the driver that sends such bio.

Milan

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




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux