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

2020-12-08 Thread Frank Rowand
On 12/4/20 7:23 AM, Paul Menzel wrote: > Dear Wim, dear Daniel, > > > First, thank you for including all parties in the discussion. > Am 04.12.20 um 13:52 schrieb Wim Vervoorn: > >> I agree with you. Using an existing standard is better than inventing >> a new one in this case. I think using

Re: [PATCHv2] grub-install: Add backup and restore

2020-12-08 Thread Michael Chang via Grub-devel
On Tue, Dec 08, 2020 at 05:58:40AM +, Dimitri John Ledkov wrote: > On Tue, 8 Dec 2020, 03:17 Michael Chang, wrote: > > > On Mon, Dec 07, 2020 at 12:37:28PM +, Dimitri John Ledkov wrote: > > > Refactor clean_grub_dir to create a backup of all the files, instead > > > of just irrevocably

[PATCH] efi: Copy load_options into environment

2020-12-08 Thread Jordan Webb
When GRUB is loaded as an EFI application, it will copy the EFI LoadOptions into an environment variable called "efi_load_options" and export it. My use case for this is to pass along arguments generated by the Raspberry Pi's internal bootloader from U-Boot to GRUB to a Linux kernel, but I think

[PATCH v8 12/18] luks2: grub_cryptodisk_t->total_sectors is the max number of device native sectors

2020-12-08 Thread Glenn Washburn
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 cryptodisk sectors as well. Also, removed an empty statement. Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper ---

[PATCH v8 13/18] cryptodisk: Properly handle non-512 byte sized sectors

2020-12-08 Thread Glenn Washburn
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, the amount the IV is incremented is the number of 512 byte blocks in a

[PATCH v8 09/18] luks2: Add string "index" to user strings using a json index.

2020-12-08 Thread Glenn Washburn
This allows error messages to be more easily distinguishable between indexes and slot keys. The former include the string "index" in the error/debug string, and the later are surrounded in quotes. Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 6 +++--- 1 file changed, 3

[PATCH v8 02/18] misc: Add parentheses around ALIGN_UP and ALIGN_DOWN arguments

2020-12-08 Thread Glenn Washburn
This ensures that expected order of operations is preserved when arguments are expressions. Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper Reviewed-by: Patrick Steinhardt --- include/grub/misc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH v8 16/18] mips: Enable __clzdi2()

2020-12-08 Thread Glenn Washburn
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: Glenn Washburn Suggested-by: Daniel Kiper --- grub-core/kern/compiler-rt.c | 2 +- include/grub/compiler-rt.h | 2 +- 2

[PATCH v8 15/18] luks2: Error check segment.sector_size

2020-12-08 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 8cb11e899..c737797b9 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@ -629,6 +629,17 @@

[PATCH v8 05/18] luks2: Make sure all fields of output argument in luks2_parse_digest() are written to

2020-12-08 Thread Glenn Washburn
We should assume that the output argument "out" is uninitialized and could have random data. So, make sure to initialize the segments and keyslots bit fields because potentially not all bits of those fields are written to. Otherwise, the digest could say it belongs to keyslots and segments that it

[PATCH v8 11/18] cryptodisk: Add macros GRUB_TYPE_U_MAX/MIN(type) to replace literals

2020-12-08 Thread Glenn Washburn
Add GRUB_TYPE_U_MAX/MIN(type) macros to get the max/min values for an unsigned number with size of type. Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 8 include/grub/types.h| 7 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git

[PATCH v8 08/18] luks2: Rename json index variables to names that they are obviously json indexes

2020-12-08 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/disk/luks2.c | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index b6930b2f5..7e0419a82 100644 --- a/grub-core/disk/luks2.c +++

[PATCH v8 18/18] luks2: Use grub_log2ull to calculate log_sector_size and improve readability

2020-12-08 Thread Glenn Washburn
Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper --- grub-core/disk/luks2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index c737797b9..31b51f1d4 100644 --- a/grub-core/disk/luks2.c +++ b/grub-core/disk/luks2.c @@

[PATCH v8 17/18] misc: Add grub_log2ull macro for calculating log base 2 of 64-bit integers

2020-12-08 Thread Glenn Washburn
Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper --- include/grub/misc.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/grub/misc.h b/include/grub/misc.h index 780a34e90..73a514eb1 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -482,4 +482,7 @@ void

[PATCH v8 14/18] luks2: Better error handling when setting up the cryptodisk

2020-12-08 Thread Glenn Washburn
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 processing continues. So this is probably a bit conservative. However, 3 of

[PATCH v8 04/18] luks2: Remove unused argument in grub_error

2020-12-08 Thread Glenn Washburn
Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper Reviewed-by: Patrick Steinhardt --- grub-core/disk/luks2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index 66e3b8798..402926680 100644 ---

[PATCH v8 10/18] cryptodisk: Add macro GRUB_TYPE_BITS() to replace some literals

2020-12-08 Thread Glenn Washburn
The new macro GRUB_TYPE_BITS(type) returns the number of bits allocated for type. Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 7 --- include/grub/types.h| 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/grub-core/disk/cryptodisk.c

[PATCH v8 03/18] whitespace: convert 8 spaces to tabs

2020-12-08 Thread Glenn Washburn
Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper Reviewed-by: Patrick Steinhardt --- grub-core/disk/luks2.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/grub-core/disk/luks2.c b/grub-core/disk/luks2.c index d96764a02..66e3b8798 100644 ---

[PATCH v8 06/18] luks2: Add idx member to struct grub_luks2_keyslot/segment/digest

2020-12-08 Thread Glenn Washburn
This allows code using these structs to know the named key associated with these json data structures. In the future we can use these to provide better error messages to the user. Get rid of idx local variable in luks2_get_keyslot() which was overloaded to be used for both keyslot and segment

[PATCH v8 01/18] disk: Rename grub_disk_get_size to grub_disk_native_sectors

2020-12-08 Thread Glenn Washburn
The function grub_disk_get_size is confusingly named because it actually returns a sector count where the sectors are sized in the grub native sector size. Rename to something more appropriate. Signed-off-by: Glenn Washburn Suggested-by: Daniel Kiper Reviewed-by: Daniel Kiper Reviewed-by:

[PATCH v8 00/18] Cryptodisk fixes for v2.06 redux

2020-12-08 Thread Glenn Washburn
This patch series, fixes issues with v7 series. Some of those patches had changes applied to the wrong patch. The added structure member was renamed again, this time to idx. And there is an added patch that renames some json index variables to note that they are such. Glenn Glenn Washburn (18):

Re: [PATCH v7 03/17] luks2: Remove unused argument in grub_error

2020-12-08 Thread Patrick Steinhardt
On Tue, Dec 08, 2020 at 11:45:37AM -0600, Glenn Washburn wrote: > On Mon, 7 Dec 2020 20:52:44 +0100 > Daniel Kiper wrote: > > > On Fri, Dec 04, 2020 at 10:43:32AM -0600, Glenn Washburn wrote: > > > Reviewed-by: Daniel Kiper > > > Signed-off-by: Glenn Washburn > > > > Nit, my RB should be

Re: [PATCH v7 06/17] luks2: Use more intuitive slot key instead of index in user messages

2020-12-08 Thread Glenn Washburn
On Mon, 7 Dec 2020 21:15:33 +0100 Daniel Kiper wrote: > On Fri, Dec 04, 2020 at 10:43:35AM -0600, Glenn Washburn wrote: > > Use the slot key name in the json array rather than the 0 based > > index in the json array for keyslots, segments, and digests. This > > is less confusing for the end

Re: [PATCH v7 05/17] luks2: Add json_slot_key member to struct grub_luks2_keyslot/segment/digest

2020-12-08 Thread Glenn Washburn
On Tue, 8 Dec 2020 07:38:31 +0100 Patrick Steinhardt wrote: > On Mon, Dec 07, 2020 at 10:06:44PM -0600, Glenn Washburn wrote: > > On Mon, 7 Dec 2020 21:02:39 +0100 > > Daniel Kiper wrote: > > > > > On Sun, Dec 06, 2020 at 02:29:06PM +0100, Patrick Steinhardt > > > wrote: > > > > On Fri, Dec

Re: [PATCH v7 03/17] luks2: Remove unused argument in grub_error

2020-12-08 Thread Glenn Washburn
On Mon, 7 Dec 2020 20:52:44 +0100 Daniel Kiper wrote: > On Fri, Dec 04, 2020 at 10:43:32AM -0600, Glenn Washburn wrote: > > Reviewed-by: Daniel Kiper > > Signed-off-by: Glenn Washburn > > Nit, my RB should be after your SOB. I will fix it. > > Daniel This is annoying to do with how my git