Re: [PATCH 3/4] cryptodisk: Add options to cryptomount to support keyfiles

2022-05-13 Thread Daniel Kiper
On Thu, May 12, 2022 at 01:53:31PM -0500, Glenn Washburn wrote: > On Thu, 12 May 2022 19:45:48 +0200 > Daniel Kiper wrote: > > > On Fri, May 06, 2022 at 03:45:59AM -0500, Glenn Washburn wrote: > > > From: John Lane > > > > > > Add the options --key-file, --keyfile-offset, and --keyfile-size to >

Re: [PATCH 0/3] Cryptomount detached headers

2022-05-13 Thread Daniel Kiper
On Tue, May 10, 2022 at 11:53:06PM -0500, Glenn Washburn wrote: > This patch series is, I believe, a better approach to supporting detached > headers for cryptomount and backends. This series will probably not apply > cleanly without the changes from the recent series entitled "[PATCH 0/4] > Crypto

Re: [PATCH v2 0/2] Have LUKS2 cryptomounts be useable with grub-probe

2022-05-13 Thread Fabian Vogt
Hi, Am Freitag, 13. Mai 2022, 00:20:38 CEST schrieb Glenn Washburn: > Hi Josselin, > > Have this on my list of things to circle back to but it got pushed to > the bottom. So sorry about taking so long. Thanks for the submitting > this. This approach seems the most complete of the other patch seri

Re: [PATCH 3/4] cryptodisk: Add options to cryptomount to support keyfiles

2022-05-13 Thread Glenn Washburn
On Fri, 13 May 2022 13:12:35 +0200 Daniel Kiper wrote: > On Thu, May 12, 2022 at 01:53:31PM -0500, Glenn Washburn wrote: > > On Thu, 12 May 2022 19:45:48 +0200 > > Daniel Kiper wrote: > > > > > On Fri, May 06, 2022 at 03:45:59AM -0500, Glenn Washburn wrote: > > > > From: John Lane > > > > > > >

Re: [PATCH 3/4] cryptodisk: Add options to cryptomount to support keyfiles

2022-05-13 Thread Glenn Washburn
On Fri, 13 May 2022 13:12:35 +0200 Daniel Kiper wrote: > On Thu, May 12, 2022 at 01:53:31PM -0500, Glenn Washburn wrote: > > On Thu, 12 May 2022 19:45:48 +0200 > > Daniel Kiper wrote: > > > > > On Fri, May 06, 2022 at 03:45:59AM -0500, Glenn Washburn wrote: > > > > From: John Lane > > > > > > >

[PATCH v2 0/5] Cryptomount keyfile support

2022-05-13 Thread Glenn Washburn
Updates from v1: * Make some changes suggested by Daniel * Improve error message for grub_strtoull() failures * Add patch to use enum constants to index parsed option array Glenn Denis 'GNUtoo' Carikli (2): cryptodisk: luks: Unify grub_cryptodisk_dev function names cryptodisk: geli: Unify

[PATCH v2 2/5] cryptodisk: geli: Unify grub_cryptodisk_dev function names

2022-05-13 Thread Glenn Washburn
From: Denis 'GNUtoo' Carikli Signed-off-by: Denis 'GNUtoo' Carikli Reviewed-by: Patrick Steinhardt Signed-off-by: Glenn Washburn --- grub-core/disk/geli.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/grub-core/disk/geli.c b/grub-core/disk/geli.c index 445a66878.

[PATCH v2 5/5] docs: Add documentation on keyfile option to cryptomount

2022-05-13 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- docs/grub.texi | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/grub.texi b/docs/grub.texi index 50ef28edd..0a8057482 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -4490,11 +4490,15 @@ Alias for @code{hashsum --hash cr

[PATCH v2 1/5] cryptodisk: luks: Unify grub_cryptodisk_dev function names

2022-05-13 Thread Glenn Washburn
From: Denis 'GNUtoo' Carikli Signed-off-by: Denis 'GNUtoo' Carikli Reviewed-by: Patrick Steinhardt Signed-off-by: Glenn Washburn --- grub-core/disk/luks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/disk/luks.c b/grub-core/disk/luks.c index 46ae734ef..7f8

[PATCH v2 4/5] cryptodisk: Use enum constants as indexes into cryptomount option array

2022-05-13 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/disk/cryptodisk.c | 53 ++--- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c index 94640b502..ecbda7ce9 100644 --- a/grub-core/disk/cryptodisk.c +

[PATCH v2 3/5] cryptodisk: Add options to cryptomount to support keyfiles

2022-05-13 Thread Glenn Washburn
From: John Lane Add the options --key-file, --keyfile-offset, and --keyfile-size to cryptomount and code to put read the requested key file data and pass via the cargs struct. Note, key file data is for all intents and purposes equivalent to a password given to cryptomount. So there is no need to

Re: [PATCH 0/3] Cryptomount detached headers

2022-05-13 Thread Glenn Washburn
On Fri, 13 May 2022 13:24:12 +0200 Daniel Kiper wrote: > On Tue, May 10, 2022 at 11:53:06PM -0500, Glenn Washburn wrote: > > This patch series is, I believe, a better approach to supporting detached > > headers for cryptomount and backends. This series will probably not apply > > cleanly without

[PATCH v2 0/2] Add efitextmode command

2022-05-13 Thread Glenn Washburn
Updates since v1: * Update documentation language as suggested by Paul This patch add the efitextmode command which is used for showing all available text output modes and setting a specific mode. Its basically the equivalent of the EFI Shell's "mode" command and its output looks similar. The main

[PATCH v2 1/2] efi: Add efitextmode command for getting/setting the text mode resolution

2022-05-13 Thread Glenn Washburn
This command is meant to behave similarly to the 'mode' command of the EFI Shell application. One difference is that to set the mode the mode number is given, not the rows and columns of the desired mode. Also supported are the arguments "min" and "max", which set the mode to the minimum and maximu

[PATCH v2 2/2] docs: Document efitextmode command

2022-05-13 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- docs/grub.texi | 26 ++ 1 file changed, 26 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi index 5de94d062..178957096 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -4049,6 +4049,7 @@ you forget a command, you can run the

[PATCH] docs: Document undocumented variables

2022-05-13 Thread Glenn Washburn
Document the variables net__clientid, net__clientuuid, lockdown, and shim_lock in the list of special environment variables. Signed-off-by: Glenn Washburn --- docs/grub.texi | 36 1 file changed, 36 insertions(+) diff --git a/docs/grub.texi b/docs/grub.texi

[PATCH v2 00/15] GDB script fixes and improvements

2022-05-13 Thread Glenn Washburn
There's been a lot of changes since v1. There are more fixes and more features. The majority of the shell code has been moved to an external file named gdb_helper.sh, instead of being inline in the GDB script. The one (direct) PERL dependency in GRUB has been removed and converted to shell script.

[PATCH v2 01/15] gdb: Fix redirection issue in dump_module_sections

2022-05-13 Thread Glenn Washburn
An error in any GDB command causes it to immediately abort with an error, this includes any command that calls that command. This leads to an issue in dump_module_sections where an error causes the command to exit without turning off file redirection. The user then ends up with a GDB command line w

[PATCH v2 03/15] gdb: If no modules have been loaded, do not try to load module symbols

2022-05-13 Thread Glenn Washburn
This prevents load_all_modules from failing when called before any modules have been loaded. Failures in GDB user-defined functions cause any function which called them to also fail. Signed-off-by: Glenn Washburn --- grub-core/gdb_grub.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[PATCH v2 07/15] gdb: Add functions to make loading from dynamically positioned targets easier

2022-05-13 Thread Glenn Washburn
Many targets, such as EFI, load GRUB at addresses that are determined at runtime. So the load addresses in kernel.exec will almost certainly be wrong. Given the address of the start of the text segment, these functions will tell GDB to load the symbols at the proper locations. It is left up to the

[PATCH v2 04/15] gdb: Move runtime module loading into runtime_load_module

2022-05-13 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- grub-core/gdb_grub.in | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/grub-core/gdb_grub.in b/grub-core/gdb_grub.in index 77491816f..61dc4644f 100644 --- a/grub-core/gdb_grub.in +++ b/grub-core/gdb_grub.in @@ -70,16 +70,2

[PATCH v2 02/15] gdb: Prevent wrapping when writing to .segments.tmp

2022-05-13 Thread Glenn Washburn
GDB logging is redirected to write .segments.tmp, which means that GDB will wrap lines longer than what it thinks is the screen width (typically 80 characters). When wrapping does occur it causes gmodule.pl to misbehave. So disable line wrapping by using GDB's "with" command so that its guaranteed

[PATCH v2 05/15] gdb: Get correct mod variable value

2022-05-13 Thread Glenn Washburn
For some reason, GDB is breaking on grub_dl_add() before the function has setup its stack frame, but GDB thinks it has. So the value of mod is bogus. To get the correct value, create a one-time break on grub_dl_get(), which is the first line of grub_dl_add(). When this break point hits, grub_dl_add

[PATCH v2 12/15] gdb: Allow user defined "onload_" command to be run when module is loaded

2022-05-13 Thread Glenn Washburn
When debugging a module it can be desirable to set break points on code in the module. This is difficult in GRUB because, at GDB start, the module is not loaded and on EFI platforms its not known ahead of time where the module will be loaded. So allow users to create an "onload_" command which will

[PATCH v2 08/15] gdb: Remove Perl dependency for GRUB GDB script

2022-05-13 Thread Glenn Washburn
Remove gmodule.pl and rewrite as a shell function in gdb_helper.sh. Signed-off-by: Glenn Washburn --- grub-core/Makefile.core.def | 6 -- grub-core/gdb_grub.in | 4 ++-- grub-core/gdb_helper.sh.in | 41 + grub-core/gmodule.pl.in | 30 -

[PATCH v2 10/15] gdb: Conditionally run GDB script logic for dynamically or statically positioned GRUB

2022-05-13 Thread Glenn Washburn
There are broadly two classes of targets to consider when loading symbols for GRUB, targets that determine where to load GRUB at runtime (dynamically positioned) and those that do not (statically positioned). For statically poisitioned targets, symbol loading is determined at link time, so nothing

[PATCH v2 06/15] gdb: Do not run load_module if module has already been loaded

2022-05-13 Thread Glenn Washburn
Fix an issue where the command load_module is being run multiple times. This happens because grub_dl_add can get called multiple times by GRUB (eg. a user runs "insmod " multple times). This causes the symbols to get added multiple times. Instead, first check if the modules has already been loaded,

[PATCH v2 09/15] gdb: If enabled, print line used to load EFI kernel symbols when using gdb_grub script

2022-05-13 Thread Glenn Washburn
If the macro PRINT_GDB_SYM_LOAD_CMD is non-zero, compile code which will print the command needed to load symbols for the GRUB EFI kernel. This is needed because EFI firmware determines where to load the GRUB EFI at runtime, and so the relevant addresses are not known ahead of time. The command is

[PATCH v2 13/15] gdb: Allow running user-defined commands at GRUB start

2022-05-13 Thread Glenn Washburn
A new command, run_on_start, is created which handles some complexities of the EFI platform when breaking on GRUB start. If GRUB start is hooked, run "onstart" command if it is defned. Signed-off-by: Glenn Washburn --- grub-core/gdb_grub.in | 44 +++ 1 fil

[PATCH v2 14/15] gdb: Add ability to turn on shell tracing for gdb helper script

2022-05-13 Thread Glenn Washburn
If envvar GRUB_GDB_TRACE_FILE is set, turn on shell tracing and write stderr messages, which includes trace messages, to path specified in the value of the envvar. Signed-off-by: Glenn Washburn --- grub-core/gdb_helper.sh.in | 5 + 1 file changed, 5 insertions(+) diff --git a/grub-core/gdb_

[PATCH v2 11/15] gdb: Only connect to remote target once when first sourced

2022-05-13 Thread Glenn Washburn
The gdb_grub script was originally meant to be run once when GDB first starts up via the -x argument. So it runs commands unconditionally assuming that the script has not been run before. Its nice to be able to source the script again when developing the script to modify/add commands. So only run t

[PATCH v2 15/15] docs: Add debugging chapter to development documentation

2022-05-13 Thread Glenn Washburn
Signed-off-by: Glenn Washburn --- docs/grub-dev.texi | 191 + 1 file changed, 191 insertions(+) diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi index 8a20a9af2..9b72da455 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -79,6 +79,7 @@ T