* [dm-crypt] crypt_get_uuid does not work as expected with plain volumes
@ 2013-01-18 18:29 .. ink ..
2013-01-21 11:42 ` Milan Broz
0 siblings, 1 reply; 4+ messages in thread
From: .. ink .. @ 2013-01-18 18:29 UTC (permalink / raw)
To: dm-crypt
[-- Attachment #1: Type: text/plain, Size: 741 bytes --]
tested with cryptsetup version 1.6.0
http://pastebin.com/G1jtyCZN
link above has source code for the "tt" program below
[root@mtz ~]# cryptsetup create rrr /home/ink/rrr.img
Enter passphrase:
[root@mtz ~]#
[root@mtz ~]# /home/ink/tt /dev/mapper/rrr
UUID=PLAIN-rrr
[root@mtz ~]# /home/ink/tt /dev/mapper/zuluCrypt-500-NAAN-truecrypt-2273
crypt_get_uuid() failed: No such file or directory
The source code and the test show crypt_get_uuid does not work as expected
with plain volumes but does with truecrypt volumes and luks volumes. The
expected behavior is to return NULL on volumes that do not support UUID.
with plain volumes,instead of "NULL",crypt_get_uuid returns "PLAIN-XYZ"
where "XYZ" is the last component of the mapper path.
[-- Attachment #2: Type: text/html, Size: 976 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dm-crypt] crypt_get_uuid does not work as expected with plain volumes
2013-01-18 18:29 [dm-crypt] crypt_get_uuid does not work as expected with plain volumes .. ink ..
@ 2013-01-21 11:42 ` Milan Broz
2013-01-21 13:40 ` .. ink ..
0 siblings, 1 reply; 4+ messages in thread
From: Milan Broz @ 2013-01-21 11:42 UTC (permalink / raw)
To: .. ink ..; +Cc: dm-crypt
On 01/18/2013 07:29 PM, .. ink .. wrote:
> The source code and the test show crypt_get_uuid does not work as
> expected with plain volumes but does with truecrypt volumes and luks
> volumes. The expected behavior is to return NULL on volumes that do
> not support UUID.
>
> with plain volumes,instead of "NULL",crypt_get_uuid returns
> "PLAIN-XYZ" where "XYZ" is the last component of the mapper path.
Hm. That function is confusing.
There are two UUIDs in fact
- on disk (applies only to LUKS)
- for activated device (aka DM-UUID)
DM-UUID is constructed from format type, on-disk UUID (if present) and
activated device name (so you are able to activate e.g. snapshot of LUKS
even with the same on-disk UUID).
crypt_get_uuid() was formerly designed to return DM-UUID but apparently I
mixed up something here (PLAIN prefix should not be visible).
Well, I'll check what I can do here now and not break existing logic.
Thanks,
Milan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dm-crypt] crypt_get_uuid does not work as expected with plain volumes
2013-01-21 11:42 ` Milan Broz
@ 2013-01-21 13:40 ` .. ink ..
2013-01-21 14:19 ` Milan Broz
0 siblings, 1 reply; 4+ messages in thread
From: .. ink .. @ 2013-01-21 13:40 UTC (permalink / raw)
To: Milan Broz; +Cc: dm-crypt
[-- Attachment #1: Type: text/plain, Size: 816 bytes --]
> Hm. That function is confusing.
>
> There are two UUIDs in fact
> - on disk (applies only to LUKS)
> - for activated device (aka DM-UUID)
>
> DM-UUID is constructed from format type, on-disk UUID (if present) and
> activated device name (so you are able to activate e.g. snapshot of LUKS
> even with the same on-disk UUID).
>
> crypt_get_uuid() was formerly designed to return DM-UUID but apparently I
> mixed up something here (PLAIN prefix should not be visible).
>
>
so crypt_get_uuid() was supposed to return something like one of the below
entries?
[ink@mtz ~]$ ls /dev/disk/by-id/dm-uuid
dm-uuid-CRYPT-LUKS1-f57ccd0520f943b9973aed73c6b67f07-zuluCrypt-500-NAAN-sdc6-781
dm-uuid-CRYPT-PLAIN-rrr
dm-uuid-CRYPT-PLAIN-zuluCrypt-500-NAAN-image-01.img-2216
dm-uuid-CRYPT-TCRYPT-zuluCrypt-500-NAAN-truecrypt-2273
[-- Attachment #2: Type: text/html, Size: 1202 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dm-crypt] crypt_get_uuid does not work as expected with plain volumes
2013-01-21 13:40 ` .. ink ..
@ 2013-01-21 14:19 ` Milan Broz
0 siblings, 0 replies; 4+ messages in thread
From: Milan Broz @ 2013-01-21 14:19 UTC (permalink / raw)
To: .. ink ..; +Cc: dm-crypt
On 01/21/2013 02:40 PM, .. ink .. wrote:
> Hm. That function is confusing.
>
> There are two UUIDs in fact
> - on disk (applies only to LUKS)
> - for activated device (aka DM-UUID)
>
> DM-UUID is constructed from format type, on-disk UUID (if present) and
> activated device name (so you are able to activate e.g. snapshot of LUKS
> even with the same on-disk UUID).
>
> crypt_get_uuid() was formerly designed to return DM-UUID but apparently I
> mixed up something here (PLAIN prefix should not be visible).
>
>
> so crypt_get_uuid() was supposed to return something like one of the below entries?
In some old testing API yes, but not now :)
>
> [ink@mtz ~]$ ls /dev/disk/by-id/dm-uuid
> dm-uuid-CRYPT-LUKS1-f57ccd0520f943b9973aed73c6b67f07-zuluCrypt-500-NAAN-sdc6-781
> dm-uuid-CRYPT-PLAIN-rrr
> dm-uuid-CRYPT-PLAIN-zuluCrypt-500-NAAN-image-01.img-2216
> dm-uuid-CRYPT-TCRYPT-zuluCrypt-500-NAAN-truecrypt-2273
These are is udev links created from DM_UUID (it is adding dm-uuid prefix)
(and created by generic DM udev rules, you will similar links for LVM, multipath etc).
Anyway, I'll switch crypt_get_uuid() to return only on-disk UUID
IOW it will work for LUKS and VERITY where UUID is persistent.
(I did not found users which rely on this old and confusing behaviour for PLAIN/loopAES devices.)
The rest (DM_UUID handling) is internal for libcryptsetup and will remain hidden.
But just for reference (you should not rely on this, internal for libcryptsetup),
DM-UUID is generated like this
CRYPT-TCRYPT-zuluCrypt-500-NAAN-truecrypt-2273
| | ---------------------------------
| | activated device name
| - CRYPT device context type (LUKS1/PLAIN/ etc)
- device managed by cryptsetup (similar to LVM,DMRAID,MPATH prefixes)
For device with on-disk UUID:
CRYPT-LUKS1-f57ccd0520f943b9973aed73c6b67f07-zuluCrypt-500-NAAN-sdc6-781
| | on-disk UUID activated device name
| - CRYPT device context type (LUKS1/PLAIN/etc)
- device managed by cryptsetup
Milan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-21 14:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-18 18:29 [dm-crypt] crypt_get_uuid does not work as expected with plain volumes .. ink ..
2013-01-21 11:42 ` Milan Broz
2013-01-21 13:40 ` .. ink ..
2013-01-21 14:19 ` Milan Broz
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.