Cryptomount detached headers
Glenn,
As I had no idea how to get the debug logs from qemu, I made screenshots, find them attached. As this is probably something I am doing wrong, I hope it shows from the logs.
Van: Glenn Washburn <[email protected]>
Aan: [email protected]
Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers
Datum: 29/07/2022 21:27:48 Europe/Paris
Cc: [email protected];
[email protected];
[email protected]
Quoted 19 lines · On Fri, 29 Jul 2022 20:56:18 +0200 (CEST) [email protected] wrote:
testing detached header failed:
1. built grub payload with following modules: ahci
usb_keyboardpart_msdospart_gptat_keyboardcbfs cryptodisk luks2 lvmgcry_rijndaelgcry_sha1gcry_sha256gcry_sha5122. encrypt a partition: cryptsetup luksFormat --type luks2 -q -h sha512 -s 512 --pbkdf pbkdf2 --header /path/to/header --luks2-metadata-size=16k --luks2-keyslots-size=512k
/dev/sda1(where --luks2-metadata-size=16k --luks2-keyslots-size=512k is optional, this is just to minimize header size, but I also tested without).
3. from the grub cmd, i try to decrypt this partition using: cryptomount -H /path/to/header (ahci0,msdos1)
4. I also tried luks1 encryption with detached header.
Quoted 7 lines
whatever I try, I always get the same error:
"no cryptodisk module can handle this device"
Is this feature not 100% implemented yet, I saw people already verifying the patches and would expect this to be working, so if yes, this seems like a bug.
This feature should be working in all cases, and if not there may be a bug. I responded to your off-list email before seeing this one. I'll repeat what I said there and let's continue this discussion on the list.
I see nothing obviously wrong with what you're doing, given the information above. To further debug this, would you be able to send a log of the serial output when the GRUB envvar debug is set to "all" while running the cryptomount command? If so, please send compressed in a reply to this email on the list.
If you can't because of hardware issues, would you be able to replicate this in QEMU and grab the serial output from there? If you can boot the system via other means, you should be able to use the raw disks (the one with the LUKS volume and the other with the filesystem containing the header file).
Glenn
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Glenn,
The most obvious error that jumps out:
Read out of range: sector 0x32000 (attempt to read or write outside partition)
Van: brutser--- via Grub-devel <[email protected]>
Aan: [email protected]
Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers
Datum: 30/07/2022 11:54:32 Europe/Paris
Cc: [email protected];
[email protected];
[email protected]
Glenn,
As I had no idea how to get the debug logs from qemu, I made screenshots, find them attached. As this is probably something I am doing wrong, I hope it shows from the logs.
Van: Glenn Washburn <[email protected]>
Aan: [email protected]
Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers
Datum: 29/07/2022 21:27:48 Europe/Paris
Cc: [email protected];
[email protected];
[email protected]
Quoted 19 lines · On Fri, 29 Jul 2022 20:56:18 +0200 (CEST) [email protected] wrote:
testing detached header failed:
1. built grub payload with following modules: ahci
usb_keyboardpart_msdospart_gptat_keyboardcbfs cryptodisk luks2 lvmgcry_rijndaelgcry_sha1gcry_sha256gcry_sha5122. encrypt a partition: cryptsetup luksFormat --type luks2 -q -h sha512 -s 512 --pbkdf pbkdf2 --header /path/to/header --luks2-metadata-size=16k --luks2-keyslots-size=512k
/dev/sda1(where --luks2-metadata-size=16k --luks2-keyslots-size=512k is optional, this is just to minimize header size, but I also tested without).
3. from the grub cmd, i try to decrypt this partition using: cryptomount -H /path/to/header (ahci0,msdos1)
4. I also tried luks1 encryption with detached header.
Quoted 7 lines
whatever I try, I always get the same error:
"no cryptodisk module can handle this device"
Is this feature not 100% implemented yet, I saw people already verifying the patches and would expect this to be working, so if yes, this seems like a bug.
This feature should be working in all cases, and if not there may be a bug. I responded to your off-list email before seeing this one. I'll repeat what I said there and let's continue this discussion on the list.
I see nothing obviously wrong with what you're doing, given the information above. To further debug this, would you be able to send a log of the serial output when the GRUB envvar debug is set to "all" while running the cryptomount command? If so, please send compressed in a reply to this email on the list.
If you can't because of hardware issues, would you be able to replicate this in QEMU and grab the serial output from there? If you can boot the system via other means, you should be able to use the raw disks (the one with the LUKS volume and the other with the filesystem containing the header file).
Glenn
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 7 lines · On Sat, 30 Jul 2022 20:48:54 +0200 (CEST) brutser--- via Grub-devel…
Glenn,
The most obvious error that jumps out:
Read out of range: sector
0x32000(attempt to read or write outside partition)
This looks like a red-herring to me. I believe it happens because in opening the header file the disk is probed to see what file system is on it. The error occurs in the probe for cbfs, which fails because its an ext* filesystem.
Glenn
Quoted 89 lines
Van: brutser--- via Grub-devel <[email protected]>
Aan: [email protected]
Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers
Datum: 30/07/2022 11:54:32 Europe/Paris
Cc: [email protected];
[email protected];
[email protected]Glenn,
As I had no idea how to get the debug logs from qemu, I made screenshots, find them attached. As this is probably something I am doing wrong, I hope it shows from the logs.
Van: Glenn Washburn <[email protected]>
Aan: [email protected]
Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers
Datum: 29/07/2022 21:27:48 Europe/Paris
Cc: [email protected];
[email protected];
[email protected]Quoted 19 lines · On Fri, 29 Jul 2022 20:56:18 +0200 (CEST) [email protected] wrote:
testing detached header failed:
1. built grub payload with following modules: ahci
usb_keyboardpart_msdospart_gptat_keyboardcbfs cryptodisk luks2 lvmgcry_rijndaelgcry_sha1gcry_sha256gcry_sha5122. encrypt a partition: cryptsetup luksFormat --type luks2 -q -h sha512 -s 512 --pbkdf pbkdf2 --header /path/to/header --luks2-metadata-size=16k --luks2-keyslots-size=512k
/dev/sda1(where --luks2-metadata-size=16k --luks2-keyslots-size=512k is optional, this is just to minimize header size, but I also tested without).
3. from the grub cmd, i try to decrypt this partition using: cryptomount -H /path/to/header (ahci0,msdos1)
4. I also tried luks1 encryption with detached header.
Quoted 7 lines
whatever I try, I always get the same error:
"no cryptodisk module can handle this device"
Is this feature not 100% implemented yet, I saw people already verifying the patches and would expect this to be working, so if yes, this seems like a bug.
This feature should be working in all cases, and if not there may be a bug. I responded to your off-list email before seeing this one. I'll repeat what I said there and let's continue this discussion on the list.
I see nothing obviously wrong with what you're doing, given the information above. To further debug this, would you be able to send a log of the serial output when the GRUB envvar debug is set to "all" while running the cryptomount command? If so, please send compressed in a reply to this email on the list.
If you can't because of hardware issues, would you be able to replicate this in QEMU and grab the serial output from there? If you can boot the system via other means, you should be able to use the raw disks (the one with the LUKS volume and the other with the filesystem containing the header file).
Glenn
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 7 lines · On Sat, 30 Jul 2022 11:54:32 +0200 (CEST) brutser--- via Grub-devel…
Glenn,
As I had no idea how to get the debug logs from qemu, I made screenshots, find them attached. As this is probably something I am doing wrong, I hope it shows from the logs.
Getting the output to go to serial depends on the target. For i386 using seabios, use "-fw_cfg name=etc/sercon-port,string=0 -serial stdio".
Unfortunately, I'm now seeing that there are no debug log messages in the luks2 module that would be shown in this case. How about putting the line 'grub_dprintf("entering luks_scan");' at the start of the function luks2_scan in grub-core/disk/luks2.c and then recompiling and getting the output?
Glenn
Quoted 63 lines
Van: Glenn Washburn <[email protected]>
Aan: [email protected]
Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers
Datum: 29/07/2022 21:27:48 Europe/Paris
Cc: [email protected];
[email protected];
[email protected]Quoted 19 lines · On Fri, 29 Jul 2022 20:56:18 +0200 (CEST) [email protected] wrote:
testing detached header failed:
1. built grub payload with following modules: ahci
usb_keyboardpart_msdospart_gptat_keyboardcbfs cryptodisk luks2 lvmgcry_rijndaelgcry_sha1gcry_sha256gcry_sha5122. encrypt a partition: cryptsetup luksFormat --type luks2 -q -h sha512 -s 512 --pbkdf pbkdf2 --header /path/to/header --luks2-metadata-size=16k --luks2-keyslots-size=512k
/dev/sda1(where --luks2-metadata-size=16k --luks2-keyslots-size=512k is optional, this is just to minimize header size, but I also tested without).
3. from the grub cmd, i try to decrypt this partition using: cryptomount -H /path/to/header (ahci0,msdos1)
4. I also tried luks1 encryption with detached header.
Quoted 7 lines
whatever I try, I always get the same error:
"no cryptodisk module can handle this device"
Is this feature not 100% implemented yet, I saw people already verifying the patches and would expect this to be working, so if yes, this seems like a bug.
This feature should be working in all cases, and if not there may be a bug. I responded to your off-list email before seeing this one. I'll repeat what I said there and let's continue this discussion on the list.
I see nothing obviously wrong with what you're doing, given the information above. To further debug this, would you be able to send a log of the serial output when the GRUB envvar debug is set to "all" while running the cryptomount command? If so, please send compressed in a reply to this email on the list.
If you can't because of hardware issues, would you be able to replicate this in QEMU and grab the serial output from there? If you can boot the system via other means, you should be able to use the raw disks (the one with the LUKS volume and the other with the filesystem containing the header file).
Glenn
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Glenn,
Still resorted to screenshots for the debug (with the added dprintf):
Van: Glenn Washburn <[email protected]>
Aan: brutser--- via Grub-devel <[email protected]>
Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers
Datum: 01/08/2022 22:50:27 Europe/Paris
Cc: [email protected];
[email protected];
[email protected]
Quoted 7 lines · On Sat, 30 Jul 2022 11:54:32 +0200 (CEST) brutser--- via Grub-devel…
Glenn,
As I had no idea how to get the debug logs from qemu, I made screenshots, find them attached. As this is probably something I am doing wrong, I hope it shows from the logs.
Getting the output to go to serial depends on the target. For i386 using seabios, use "-fw_cfg name=etc/sercon-port,string=0 -serial stdio".
Unfortunately, I'm now seeing that there are no debug log messages in the luks2 module that would be shown in this case. How about putting the line 'grub_dprintf("entering luks_scan");' at the start of the function luks2_scan in grub-core/disk/luks2.c and then recompiling and getting the output?
Glenn
Quoted 55 lines
Van: Glenn Washburn <[email protected]>
Aan: [email protected]
Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers
Datum: 29/07/2022 21:27:48 Europe/Paris
Cc: [email protected];
[email protected];
[email protected]Quoted 19 lines · On Fri, 29 Jul 2022 20:56:18 +0200 (CEST) [email protected] wrote:
testing detached header failed:
1. built grub payload with following modules: ahci
usb_keyboardpart_msdospart_gptat_keyboardcbfs cryptodisk luks2 lvmgcry_rijndaelgcry_sha1gcry_sha256gcry_sha5122. encrypt a partition: cryptsetup luksFormat --type luks2 -q -h sha512 -s 512 --pbkdf pbkdf2 --header /path/to/header --luks2-metadata-size=16k --luks2-keyslots-size=512k
/dev/sda1(where --luks2-metadata-size=16k --luks2-keyslots-size=512k is optional, this is just to minimize header size, but I also tested without).
3. from the grub cmd, i try to decrypt this partition using: cryptomount -H /path/to/header (ahci0,msdos1)
4. I also tried luks1 encryption with detached header.
Quoted 7 lines
whatever I try, I always get the same error:
"no cryptodisk module can handle this device"
Is this feature not 100% implemented yet, I saw people already verifying the patches and would expect this to be working, so if yes, this seems like a bug.
This feature should be working in all cases, and if not there may be a bug. I responded to your off-list email before seeing this one. I'll repeat what I said there and let's continue this discussion on the list.
I see nothing obviously wrong with what you're doing, given the information above. To further debug this, would you be able to send a log of the serial output when the GRUB envvar debug is set to "all" while running the cryptomount command? If so, please send compressed in a reply to this email on the list.
If you can't because of hardware issues, would you be able to replicate this in QEMU and grab the serial output from there? If you can boot the system via other means, you should be able to use the raw disks (the one with the LUKS volume and the other with the filesystem containing the header file).
Quoted 8 lines
Glenn
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Quoted 9 lines · On Tue, 2 Aug 2022 00:21:09 +0200 (CEST) brutser--- via Grub-devel…
Glenn,
Still resorted to screenshots for the debug (with the added dprintf):
Ok, that confirms that the luks2 module is loaded and that the scan is happening. Based on the output I think luks2_read_header must be failing. That means that either disk reads are failing, which doesn't seem like the case, the disk read hook is failing or the LUKS2 magic bytes are not what they should be.
Have you verified that after creating the volume and header file that cryptsetup/dm can open the volume successfully?
What architecture and endianness is the machine you're running cryptsetup on and what is it for the one GRUB is running on?
To test the read hook, add 'grub_dprintf("luks2", "read hook successed");' just before the last return statement in the function cryptodisk_read_hook in grub-core/disk/cryptodisk.c.
Glenn
Quoted 104 lines
Van: Glenn Washburn <[email protected]>
Aan: brutser--- via Grub-devel <[email protected]>
Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers
Datum: 01/08/2022 22:50:27 Europe/Paris
Cc: [email protected];
[email protected];
[email protected]Quoted 7 lines · On Sat, 30 Jul 2022 11:54:32 +0200 (CEST) brutser--- via Grub-devel…
Glenn,
As I had no idea how to get the debug logs from qemu, I made screenshots, find them attached. As this is probably something I am doing wrong, I hope it shows from the logs.
Getting the output to go to serial depends on the target. For i386 using seabios, use "-fw_cfg name=etc/sercon-port,string=0 -serial stdio".
Unfortunately, I'm now seeing that there are no debug log messages in the luks2 module that would be shown in this case. How about putting the line '
grub_dprintf("entering luks_scan");' at the start of the functionluks2_scaningrub-core/disk/luks2.cand then recompiling and getting the output?Glenn
Quoted 55 lines
Van: Glenn Washburn <[email protected]>
Aan: [email protected]
Onderwerp: Re: [PATCH v3 0/3] Cryptomount detached headers
Datum: 29/07/2022 21:27:48 Europe/Paris
Cc: [email protected];
[email protected];
[email protected]Quoted 19 lines · On Fri, 29 Jul 2022 20:56:18 +0200 (CEST) [email protected] wrote:
testing detached header failed:
1. built grub payload with following modules: ahci
usb_keyboardpart_msdospart_gptat_keyboardcbfs cryptodisk luks2 lvmgcry_rijndaelgcry_sha1gcry_sha256gcry_sha5122. encrypt a partition: cryptsetup luksFormat --type luks2 -q -h sha512 -s 512 --pbkdf pbkdf2 --header /path/to/header --luks2-metadata-size=16k --luks2-keyslots-size=512k
/dev/sda1(where --luks2-metadata-size=16k --luks2-keyslots-size=512k is optional, this is just to minimize header size, but I also tested without).
3. from the grub cmd, i try to decrypt this partition using: cryptomount -H /path/to/header (ahci0,msdos1)
4. I also tried luks1 encryption with detached header.
Quoted 7 lines
whatever I try, I always get the same error:
"no cryptodisk module can handle this device"
Is this feature not 100% implemented yet, I saw people already verifying the patches and would expect this to be working, so if yes, this seems like a bug.
This feature should be working in all cases, and if not there may be a bug. I responded to your off-list email before seeing this one. I'll repeat what I said there and let's continue this discussion on the list.
I see nothing obviously wrong with what you're doing, given the information above. To further debug this, would you be able to send a log of the serial output when the GRUB envvar debug is set to "all" while running the cryptomount command? If so, please send compressed in a reply to this email on the list.
If you can't because of hardware issues, would you be able to replicate this in QEMU and grab the serial output from there? If you can boot the system via other means, you should be able to use the raw disks (the one with the LUKS volume and the other with the filesystem containing the header file).
Quoted 8 lines
Glenn
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel