Re: [PATCH v6 04/12] cryptodisk: Replace some literals with constants in grub_cryptodisk_endecrypt

2020-12-03 Thread Glenn Washburn
On Wed, 2 Dec 2020 18:37:42 +0100 Daniel Kiper wrote: > On Fri, Nov 27, 2020 at 03:03:36AM -0600, Glenn Washburn wrote: > > This should improve readability of code by providing clues as to > > what the value represents. The new macro GRUB_TYPE_BITS(type) > > returns the number of bits allocated f

Re: [PATCH v6 05/12] luks2: grub_cryptodisk_t->total_sectors is the max number of device native sectors

2020-12-03 Thread Glenn Washburn
On Wed, 2 Dec 2020 18:56:46 +0100 Daniel Kiper wrote: > On Fri, Nov 27, 2020 at 03:03:37AM -0600, Glenn Washburn wrote: > > We need to convert the sectors from the size of the underlying > > device to the cryptodisk sector size; segment.size is in bytes > > which need to be converted to cryptodis

Re: [PATCH v6 01/12] luks2: Add slot_key member to struct grub_luks2_keyslot/segment/digest

2020-12-03 Thread Daniel Kiper
On Thu, Dec 03, 2020 at 01:23:17AM -0600, Glenn Washburn wrote: > On Wed, 2 Dec 2020 18:01:47 +0100 > Daniel Kiper wrote: > > > On Fri, Nov 27, 2020 at 03:03:33AM -0600, Glenn Washburn wrote: > > > This allows code using these structs to know the named key > > > associated with these json data str

Re: [PATCH v6 02/12] luks2: Use more intuitive slot key instead of index in user messages.

2020-12-03 Thread Daniel Kiper
On Thu, Dec 03, 2020 at 01:24:18AM -0600, Glenn Washburn wrote: > On Wed, 2 Dec 2020 18:23:08 +0100 > Daniel Kiper wrote: > > > On Fri, Nov 27, 2020 at 03:03:34AM -0600, Glenn Washburn wrote: > > > Use the slot key name in the json array rather than the 0 based > > > index in the json array for ke

Re: [PATCH v6 04/12] cryptodisk: Replace some literals with constants in grub_cryptodisk_endecrypt

2020-12-03 Thread Daniel Kiper
On Thu, Dec 03, 2020 at 02:29:11AM -0600, Glenn Washburn wrote: > On Wed, 2 Dec 2020 18:37:42 +0100 > Daniel Kiper wrote: > > > On Fri, Nov 27, 2020 at 03:03:36AM -0600, Glenn Washburn wrote: > > > This should improve readability of code by providing clues as to > > > what the value represents. Th

Re: [PATCH v6 05/12] luks2: grub_cryptodisk_t->total_sectors is the max number of device native sectors

2020-12-03 Thread Daniel Kiper
On Thu, Dec 03, 2020 at 02:54:19AM -0600, Glenn Washburn wrote: > On Wed, 2 Dec 2020 18:56:46 +0100 > Daniel Kiper wrote: > > > On Fri, Nov 27, 2020 at 03:03:37AM -0600, Glenn Washburn wrote: > > > We need to convert the sectors from the size of the underlying > > > device to the cryptodisk sector

Re: [PATCH v6 06/12] cryptodisk: Properly handle non-512 byte sized sectors

2020-12-03 Thread Daniel Kiper
On Fri, Nov 27, 2020 at 03:03:38AM -0600, Glenn Washburn wrote: > By default, dm-crypt internally uses an IV that corresponds to 512-byte > sectors, even when a larger sector size is specified. What this means is > that when using a larger sector size, the IV is incremented every sector. > However,

Re: [PATCH v6 07/12] luks2: Better error handling when setting up the cryptodisk

2020-12-03 Thread Daniel Kiper
On Fri, Nov 27, 2020 at 03:03:39AM -0600, Glenn Washburn wrote: > First, check to make sure that source disk has a known size. If not, print > debug message and return error. There are 4 cases where > GRUB_DISK_SIZE_UNKNOWN is set (biosdisk, obdisk, ofdisk, and uboot), and in > all those cases proc

Re: [PATCH] arm-coreboot: Declare global struct ps2_state as static so symbols don't cause link failure

2020-12-03 Thread Glenn Washburn
On Thu, 3 Dec 2020 00:15:27 -0600 Glenn Washburn wrote: > Here is a log file showing the build failure. > > https://gitlab.com/grub2-testing/grub/-/jobs/885372725/raw Accidentally deleted this pipeline. Here's another log with the same error. https://gitlab.com/grub2-testing/grub/-/jobs/888562

Re: [PATCH v6 08/12] luks2: Error check segment.sector_size

2020-12-03 Thread Daniel Kiper
On Fri, Nov 27, 2020 at 03:03:40AM -0600, Glenn Washburn wrote: > Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper Daniel ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel

Re: [PATCH v6 09/12] whitespace: convert 8 spaces to tabs.

2020-12-03 Thread Daniel Kiper
On Fri, Nov 27, 2020 at 03:03:41AM -0600, Glenn Washburn wrote: > Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper Daniel ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel

Re: [PATCH v6 10/12] mips: Enable __clzdi2()

2020-12-03 Thread Daniel Kiper
On Fri, Nov 27, 2020 at 03:03:42AM -0600, Glenn Washburn wrote: > This patch is similiar to commit 9dab2f51e (sparc: Enable __clzsi2() and > __clzdi2()) but for MIPS target and __clzdi2 only, __clzsi2 was already > enabled. > > Signed-off-by: Daniel Kiper This should be replaced with: Suggeste

Re: [PATCH v6 11/12] misc: Add grub_log2ull macro for calculating log base 2 of 64-bit integers

2020-12-03 Thread Daniel Kiper
On Fri, Nov 27, 2020 at 03:03:43AM -0600, Glenn Washburn wrote: > Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper Daniel ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel

Re: [PATCH v6 12/12] luks2: Use grub_log2ull to calculate log_sector_size and improve readability

2020-12-03 Thread Daniel Kiper
On Fri, Nov 27, 2020 at 03:03:44AM -0600, Glenn Washburn wrote: > Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper Daniel ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel

[PATCH 4/9] efi: Make shim_lock GUID and protocol type public

2020-12-03 Thread Javier Martinez Canillas
From: Daniel Kiper The GUID will be used to properly detect and report UEFI Secure Boot status to the x86 Linux kernel. The functionality will be added by subsequent patches. The shim_lock protocol type is made public for completeness. Additionally, fix formatting of four preceding GUIDs. Signe

[PATCH 7/9] efi: Add secure boot detection

2020-12-03 Thread Javier Martinez Canillas
From: Daniel Kiper Introduce grub_efi_get_secureboot() function which returns whether UEFI Secure Boot is enabled or not on UEFI systems. Signed-off-by: Ignat Korchagin Signed-off-by: Daniel Kiper Signed-off-by: Marco A Benatto Signed-off-by: Javier Martinez Canillas --- grub-core/Makefile

[PATCH 1/9] i386: Don't include in coreboot and ieee1275 startup.S

2020-12-03 Thread Javier Martinez Canillas
Nothing defined in the header file is used in the assembly code but it may lead to build errors if some headers are included through this and contains definitions that are not recognized by the assembler, e.g.: ../include/grub/types.h: Assembler messages: ../include/grub/types.h:76: Error: no such

[PATCH 2/9] include/grub/i386/linux.h: Include missing header

2020-12-03 Thread Javier Martinez Canillas
This header uses types defined in but does not include it, which leads to compile errors like the following: In file included from ../include/grub/cpu/linux.h:19, from kern/efi/sb.c:21: ../include/grub/i386/linux.h:80:3: error: unknown type name ‘grub_uint64_t’ 80 | grub_uin

[PATCH 3/9] arm/term: Fix linking error due multiple ps2_state definitions

2020-12-03 Thread Javier Martinez Canillas
When building with --target=arm-linux-gnu --with-platform=coreboot a linking error occurs caused by multiple definitions of the ps2_state variable. Mark them as static since they aren't used outside their compilation unit. Signed-off-by: Javier Martinez Canillas --- grub-core/term/arm/cros.c

[PATCH 0/9] Add UEFI Secure Boot detection and report the status to Linux

2020-12-03 Thread Javier Martinez Canillas
This patch series adds support for the GRUB to detect the UEFI Secure Boot status using the SecureBoot and SetupMode EFI variables. It also reports this to Linux by setting the .secure_boot field of struct boot_params. Besides that, it contains some cleanups and fixes mostly around EFI support.

[PATCH 5/9] efi: Return grub_efi_status_t from grub_efi_get_variable()

2020-12-03 Thread Javier Martinez Canillas
From: Daniel Kiper This is needed to properly detect and report UEFI Secure Boot status to the x86 Linux kernel. The functionality will be added by subsequent patches. Signed-off-by: Daniel Kiper Signed-off-by: Marco A Benatto Signed-off-by: Javier Martinez Canillas --- grub-core/commands/e

[PATCH 6/9] efi: Add a function to read EFI variables with attributes

2020-12-03 Thread Javier Martinez Canillas
From: Daniel Kiper It will be used to properly detect and report UEFI Secure Boot status to the x86 Linux kernel. The functionality will be added by subsequent patches. Signed-off-by: Ignat Korchagin Signed-off-by: Daniel Kiper Signed-off-by: Marco A Benatto Signed-off-by: Javier Martinez Can

[PATCH 9/9] loader/linux: Report the UEFI Secure Boot status to the Linux kernel

2020-12-03 Thread Javier Martinez Canillas
From: Daniel Kiper Now that the GRUB has a grub_efi_get_secureboot() function to check the UEFI Secure Boot status, use it to report that to the Linux kernel. Signed-off-by: Ignat Korchagin Signed-off-by: Daniel Kiper Signed-off-by: Marco A Benatto Signed-off-by: Javier Martinez Canillas ---

[PATCH 8/9] efi: Only register shim_lock verifier if shim_lock protocol is found and SB enabled

2020-12-03 Thread Javier Martinez Canillas
The shim_lock module registers a verifier to call shim's verify, but the handler is registered even when the shim_lock protocol was not installed. This doesn't cause a NULL pointer dereference in shim_lock_write() because the shim_lock_init() function just returns GRUB_ERR_NONE if sl isn't set. B

Re: [PATCH v6 10/12] mips: Enable __clzdi2()

2020-12-03 Thread Glenn Washburn
On Thu, 3 Dec 2020 15:00:14 +0100 Daniel Kiper wrote: > On Fri, Nov 27, 2020 at 03:03:42AM -0600, Glenn Washburn wrote: > > This patch is similiar to commit 9dab2f51e (sparc: Enable > > __clzsi2() and __clzdi2()) but for MIPS target and __clzdi2 only, > > __clzsi2 was already enabled. > > > > Sig

Re: [PATCH v6 07/12] luks2: Better error handling when setting up the cryptodisk

2020-12-03 Thread Glenn Washburn
On Thu, 3 Dec 2020 14:31:49 +0100 Daniel Kiper wrote: > On Fri, Nov 27, 2020 at 03:03:39AM -0600, Glenn Washburn wrote: > > First, check to make sure that source disk has a known size. If > > not, print debug message and return error. There are 4 cases where > > GRUB_DISK_SIZE_UNKNOWN is set (bio

Re: [PATCH v6 01/12] luks2: Add slot_key member to struct grub_luks2_keyslot/segment/digest

2020-12-03 Thread Glenn Washburn
On Thu, 3 Dec 2020 13:35:28 +0100 Daniel Kiper wrote: > On Thu, Dec 03, 2020 at 01:23:17AM -0600, Glenn Washburn wrote: > > On Wed, 2 Dec 2020 18:01:47 +0100 > > Daniel Kiper wrote: > > > > > On Fri, Nov 27, 2020 at 03:03:33AM -0600, Glenn Washburn wrote: > > > > This allows code using these str

Re: [SPECIFICATION RFC] The firmware and bootloader log specification

2020-12-03 Thread Andy Shevchenko
On Sat, Nov 14, 2020 at 2:01 AM Daniel Kiper wrote: ... > The log specification should be as much as possible platform agnostic > and self contained. The final version of this spec should be merged into > existing specifications, e.g. UEFI, ACPI, Multiboot2, or be a standalone > spec, e.g. as a

[PATCH v2] loopback: Do not automaticaly replace existing loopback dev, error instead

2020-12-03 Thread Glenn Washburn
If there is a loopback device with the same name as the one to be created, instead of closing the old one and replacing it with the new one, return an error instead. If the loopback device was created, its probably being used by something and just replacing it may cause grub to crash unexpectedly.