Re: [RFC PATCH v2 1/1] kern/dl: Add module version check

2022-12-23 Thread Zhang Boyang
Hi, On 2022/12/22 14:31, Glenn Washburn wrote: On Wed, 21 Dec 2022 20:11:57 +0800 Zhang Boyang wrote: + grub_printf_ (N_("warning: module %.63s has incorrect version: %.63s != %s\n"), + mod->name, modver, PACKAGE_VERSION); I don't quite like this, but I could live with

Re: [RFC PATCH v3 0/1] kern/dl: Add module version check

2022-12-23 Thread Pete Batard via Grub-devel
On 2022.12.23 07:18, Zhang Boyang wrote: This feature is implemented in kern/dl.c in core.img, which is UNDER YOUR CONTROL. Let me analyze the worst case from your perspective: 1) Every distro is enforcing version check, even in BIOS mode. 2) Because this check is in kern/dl.c, there is no su

Re: [RFC PATCH v3 0/1] kern/dl: Add module version check

2022-12-23 Thread Zhang Boyang
Hi, On 2022/12/23 21:07, Pete Batard wrote: On 2022.12.23 07:18, Zhang Boyang wrote: This feature is implemented in kern/dl.c in core.img, which is UNDER YOUR CONTROL. Let me analyze the worst case from your perspective: 1) Every distro is enforcing version check, even in BIOS mode. 2) Beca

Re: [RFC PATCH v3 0/1] kern/dl: Add module version check

2022-12-23 Thread Zhang Boyang
On 2022/12/24 00:44, Zhang Boyang wrote: -  || grub_dl_check_version (mod, e) +  || (1||grub_dl_check_version (mod, e)) Oh, there is a small error, it should be: - || grub_dl_check_version (mod, e) + || (0 && grub_dl_check_version (mod, e)) Best Regards, Zhang Boyang __

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

2022-12-23 Thread Glenn Washburn
On Thu, 22 Dec 2022 19:17:31 +0100 Daniel Kiper wrote: > On Wed, Dec 21, 2022 at 11:57:33AM -0600, Glenn Washburn wrote: > > On Wed, 21 Dec 2022 16:20:17 +0100 > > Daniel Kiper wrote: > > > > > Adding Robbie... > > > > > > Please CC him next time when you post these patches. I would want > > > t

Re: [PATCH v8 1/1] plainmount: Support plain encryption mode

2022-12-23 Thread Glenn Washburn
On Fri, 02 Dec 2022 17:11:23 + Maxim Fomin wrote: > --- Original Message --- > On Friday, December 2nd, 2022 at 0:00, Glenn Washburn > wrote: > > I'm now compiling this patch and found a few compile issues below. > > You're compile testing this right? > > First versions of the patch

Re: [PATCH v8 1/1] plainmount: Support plain encryption mode

2022-12-23 Thread Glenn Washburn
On Fri, 23 Dec 2022 19:54:47 -0600 Glenn Washburn wrote: > On Fri, 02 Dec 2022 17:11:23 + > Maxim Fomin wrote: > > > --- Original Message --- > > On Friday, December 2nd, 2022 at 0:00, Glenn Washburn > > wrote: > > > I'm now compiling this patch and found a few compile issues below

[PATCH v5 13/14] gdb: Modify gdb prompt when running gdb_grub script

2022-12-23 Thread Glenn Washburn
This will let users know that the GDB session is using the GRUB gdb scripts. Signed-off-by: Glenn Washburn --- grub-core/gdb_helper.py.in | 4 1 file changed, 4 insertions(+) diff --git a/grub-core/gdb_helper.py.in b/grub-core/gdb_helper.py.in index 8d5ee1d292..5ed9eab0f5 100644 --- a/grub

[PATCH v5 02/14] gdb: Prevent wrapping when writing to .segments.tmp

2022-12-23 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 v5 10/14] gdb: Allow running user-defined commands at GRUB start

2022-12-23 Thread Glenn Washburn
A new command, run_on_start, for things to do when just before GRUB starts executing. Currently, this is setting up the loading of module symbols as they are loaded and allowing user-defined script to be run if a command named "onstart" exists. A thbreak, temporary hardware breakpoint, is used beca

[PATCH v5 06/14] gdb: Only connect to remote target once when first sourced

2022-12-23 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 v5 04/14] gdb: Move runtime module loading into runtime_load_module

2022-12-23 Thread Glenn Washburn
By moving this code into a function, it can be run re-utilized while gdb is running, not just when loading the script. This will also be useful in some following changes which will make a separate script path for targets which statically vs dynamically position GRUB code. Signed-off-by: Glenn Wash

[PATCH v5 07/14] gdb: Replace module symbol loading implementation with Python one

2022-12-23 Thread Glenn Washburn
Remove gmodule.pl and rewrite as a python in gdb_helper.py. This removes PERL dependency for the GRUB GDB script, but adds Python as a dependency. This is more desirable because Python is tightly integrated with GDB and can do things not even available to GDB native scripting language. GDB must be

[PATCH v5 12/14] gdb: Add extra early initialization symbols for i386-pc

2022-12-23 Thread Glenn Washburn
Add symbols for boot.image, disk.image, and lzma_decompress.image if the target is i386-pc. This is only done for i386-pc because that is the only target that uses the images. By loading the symbols for these images, these images can be more easily debugged by allowing the setting of break- points

[PATCH v5 00/14] GDB script fixes and improvements

2022-12-23 Thread Glenn Washburn
This series has been substantially rewritten since v4, although a large minority of the patches haven't changed much. The biggest change is that the implementation has been converted to Python instead of what was done in shell script. I have always felt it should be done in Python, but it seemed da

[PATCH v5 14/14] docs: Add debugging chapter to development documentation

2022-12-23 Thread Glenn Washburn
Debugging GRUB can be tricky and require arcane knowledge. This will help those unfamiliar with the process to get started debugging GRUB with less effort. Signed-off-by: Glenn Washburn --- docs/grub-dev.texi | 233 + 1 file changed, 233 insertions(+)

[PATCH v5 09/14] gdb: Add more support for debugging on EFI platforms

2022-12-23 Thread Glenn Washburn
If the configure option --enable-efi-debug is given, then enable the printing early in EFI startup of 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 o

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

2022-12-23 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 v5 01/14] gdb: Fix redirection issue in dump_module_sections

2022-12-23 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 v5 11/14] gdb: Fix issue with breakpoints defined before the GRUB image is loaded

2022-12-23 Thread Glenn Washburn
On some platforms, notably x86, software breakpoints set in GDB before the GRUB image is loaded will be cleared when the image is loaded. This is because the breakpoints work by overwriting the memory of the break- point location with a special instruction which when hit will cause the debugger to

[PATCH v5 05/14] gdb: Conditionally run GDB script logic for dynamically or statically positioned GRUB

2022-12-23 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 v5 08/14] gdb: Add functions to make loading from dynamically positioned targets easier

2022-12-23 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