AW: AW: AW: Adding --set to videoinfo to retrieve current video resolution

2022-12-14 Thread Markus Scholz
Dear Zhang, thank you a lot for your advice and review! I will address the pointed out improvements and then ask Daniel (as he suggested) to take a look. Thanks again & best Markus -Ursprüngliche Nachricht- Von: Zhang Boyang Gesendet: Dienstag, 13. Dezember 2022 12:07 An: Markus Scholz

Handling large allocations (bypassing mm?)

2022-12-14 Thread Julian Andres Klode
Hi, so I want to bring this discussion here that I had mostly with myself in the past days on IRC. As some of you know, we had a couple issues with large initrds in Ubuntu, Jeremy posted a patch series earlier about mmunlimited. I wanted to propose a more fine-grained approach, as well as a more

Re: [PATCH v2 6/6] ibmvtpm: Add support for trusted boot using a vTPM 2.0

2022-12-14 Thread Daniel Kiper
On Tue, Dec 13, 2022 at 01:18:34PM -0500, Stefan Berger wrote: > On 12/13/22 11:35, Daniel Kiper wrote: > > On Thu, Dec 01, 2022 at 04:12:01PM -0500, Stefan Berger wrote: > > > Add support for trusted boot using a vTPM 2.0 on the IBM IEEE1275 > > > PowerPC platform. With this patch grub now measure

Re: [v6 PATCH 2/3] RISC-V: Update image header

2022-12-14 Thread Daniel Kiper
On Tue, Dec 06, 2022 at 01:24:30AM -0800, Atish Patra wrote: > On Wed, Nov 23, 2022 at 1:11 AM Xiaotian Wu wrote: > > > > Is there a new patch? > > Not sure if you are asking about this series or Ard's series [1]. > I got busy with other day jobs and did not get time to revise this > series as tha

Re: Handling large allocations (bypassing mm?)

2022-12-14 Thread Daniel Kiper
Adding a few folks who may be interested in this discussion too... On Wed, Dec 14, 2022 at 02:21:49PM +0100, Julian Andres Klode wrote: > Hi, > > so I want to bring this discussion here that I had mostly with myself > in the past days on IRC. > > As some of you know, we had a couple issues with la

Re: [PATCH v2 3/6] ieee1275: support runtime memory claiming

2022-12-14 Thread Daniel Kiper
Adding Zhang... On Tue, Dec 13, 2022 at 02:10:01PM -0500, Stefan Berger wrote: > On 12/13/22 11:14, Daniel Kiper wrote: > > On Thu, Dec 01, 2022 at 04:11:58PM -0500, Stefan Berger wrote: > > > From: Daniel Axtens > > > > > > On powerpc-ieee1275, we are running out of memory trying to verify > > >

[PATCH 3/4] fs/iso9660: Avoid reading past the entry boundary

2022-12-14 Thread Lidong Chen
Added a check for the SP entry data boundary before reading it. Signed-off-by: Lidong Chen --- grub-core/fs/iso9660.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c index 9170fa820..67aa8451c 100644 --- a/grub

[PATCH 4/4] fs/iso9660: Incorrect check for entry boudary

2022-12-14 Thread Lidong Chen
An entry consists of the entry info and the component area. The entry info should take up 5 bytes instead of sizeof (*entry). The area after the first 5 bytes is the component area. The code uses the sizeof (*entry) to check the boundary which is incorrect. Also, an entry may not have component rec

[PATCH 2/4] fs/iso9660: Prevent read past the end of system use area

2022-12-14 Thread Lidong Chen
In the code, the for loop advanced the entry pointer to the next entry before checking if the next entry is within the system use area boundary. Another issue in the code was that there is no check for the size of system use area. For a corrupted system, the size of system use area can be less than

[PATCH 0/4] fs/iso9660: Fix out-of-bounds read

2022-12-14 Thread Lidong Chen
This patches set fix a few out-of-bound reads and an infinite loop in fs/iso9660. The main issues are that there is no validation for the SUSP/RRIP entry size and no check for the boundary before read. Lidong Chen (4): fs/iso9660: Add check to prevent infinite loop fs/iso9660: Prevent read pa

[PATCH 1/4] fs/iso9660: Add check to prevent infinite loop

2022-12-14 Thread Lidong Chen
There is no check for the end of block When reading directory extents. It resulted in read_node() always read from the same offset in the while loop, thus caused infinite loop. The fix added a check for the end of the block and ensure the read is within directory boundary. Signed-off-by: Lidong Ch

Re: [PATCH 0/4] fs/iso9660: Fix out-of-bounds read

2022-12-14 Thread Thomas Schmitt
Hi, i will review the patches hopefully tomorrow. But in [PATCH 2/4] and [4/4] i stumble over the statement that a SUSP entry has 5 bytes of size. This is not true. The minimum size is 4. In SUSP there are "Padding" PD (if its byte LEN_PD is 0) and "Stop" ST, which have 4 bytes. In RRIP there is

Re: [PATCH v2 6/6] ibmvtpm: Add support for trusted boot using a vTPM 2.0

2022-12-14 Thread Stefan Berger
On 12/14/22 09:20, Daniel Kiper wrote: On Tue, Dec 13, 2022 at 01:18:34PM -0500, Stefan Berger wrote: On 12/13/22 11:35, Daniel Kiper wrote: On Thu, Dec 01, 2022 at 04:12:01PM -0500, Stefan Berger wrote: Add support for trusted boot using a vTPM 2.0 on the IBM IEEE1275 PowerPC platform. With

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

2022-12-14 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 v3 11/15] gdb: Only connect to remote target once when first sourced

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

2022-12-14 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 v3 00/15] GDB script fixes and improvements

2022-12-14 Thread Glenn Washburn
v3 changes: Use correct automake macro for target cpu 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

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

2022-12-14 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 f76fc658bf..8171e91c33 100644 --- a/docs/grub-dev.texi +++ b/docs/grub-dev.texi @@ -79,6 +79,7 @@

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

2022-12-14 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 v3 12/15] gdb: Allow user defined "onload_" command to be run when module is loaded

2022-12-14 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 v3 05/15] gdb: Get correct mod variable value

2022-12-14 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 v3 09/15] gdb: If enabled, print line used to load EFI kernel symbols when using gdb_grub script

2022-12-14 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 v3 10/15] gdb: Conditionally run GDB script logic for dynamically or statically positioned GRUB

2022-12-14 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 v3 02/15] gdb: Prevent wrapping when writing to .segments.tmp

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

2022-12-14 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 77491816f4..61dc4644fb 100644 --- a/grub-core/gdb_grub.in +++ b/grub-core/gdb_grub.in @@ -70,16 +70

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

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

2022-12-14 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 v3 03/15] gdb: If no modules have been loaded, do not try to load module symbols

2022-12-14 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 v3 14/15] gdb: Add ability to turn on shell tracing for gdb helper script

2022-12-14 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_