[SPECIFICATION RFC v3] The firmware and bootloader log specification

2021-09-18 Thread Alec Brown
UTC). Come and join if you want to discuss the design. The schedule for the System Boot and Security Micro-conference can be found here [3]. Thanks! Alec Brown [1] https://lists.gnu.org/archive/html/grub-devel/2020-11/msg00100.html [2] https://lists.gnu.org/archive/html/grub-devel/2020-12/msg000

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

2021-10-19 Thread Alec Brown
On Sun, Sep 19, 2021 at 12:53:35AM +0200, Heinrich Schuchardt wrote: > > > Am 18. September 2021 18:04:13 MESZ schrieb Alec Brown > : > >Hi everyone, > > > >I've been working on improving the specification for the firmware and > >bootloader > >l

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

2021-10-19 Thread Alec Brown
On Tue, Sep 21, 2021 at 03:40:20PM +, Peter Stuge wrote: > Alec Brown wrote: > > Below is how the layout of these logs would store their data. > > > > bf_log_header: > >+---+ > > u32| version

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

2021-10-28 Thread Alec Brown
On Tue, Sep 21, 2021 at 03:07:25PM -0700, Julius Werner wrote: > > Since it doesn't seem possible to have each boot component using the same > > log > > format, we added a log_format and log_phys_addr fields to give flexibility > > in > > how logs are stored. An example of a different log format

[PATCH 1/2] commands/probe: Fix resource leaks

2021-11-10 Thread Alec Brown
errno, grub_error_push() should be called before either grub_device_close() or grub_disk_close() is called and grub_error_pop() should be called before grub_errno is returned. Fixes: 1fc860bb76bb (commands/probe: Fix a resource leak when probing disks) Fixes: CID 292443 Signed-off-by: Alec

[PATCH 0/2] Fix some Coverity resource leak bugs

2021-11-10 Thread Alec Brown
There were a couple of commits which made fixes to a few Coverity bugs addressing resource leaks, but missed some cases where a variable was not being freed before a return statement was called. The Coverity Bugs being addressed are: CID 292443 CID 73804 Alec Brown (2): commands/probe

[PATCH 2/2] disk/ldm: Fix resource leak

2021-11-10 Thread Alec Brown
been successfully allocated memory in the for loop. Fixes: 23e39f50ca7a (disk/ldm: Make sure comp data is freed before exiting from make_vg()) Fixes: CID 73804 Signed-off-by: Alec Brown --- grub-core/disk/ldm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/grub-core/disk/ldm.c b/grub

[PATCH] affs: Fix resource leaks

2022-02-02 Thread Alec Brown
73759 Signed-off-by: Alec Brown --- grub-core/fs/affs.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/grub-core/fs/affs.c b/grub-core/fs/affs.c index cafcd0fba..7b9e62064 100644 --- a/grub-core/fs/affs.c +++ b/grub-core/fs/affs.c @@ -370,17 +3

[PATCH 1/4] util/grub-module-verifierXX.c: Add function to calculate section headers

2022-02-02 Thread Alec Brown
isn't being used, it's actually required in order to use the macros grub_target_to_host*(x) which are unwinded to grub_target_to_host*_real(arch, (x)) based on defines earlier in the file. Signed-off-by: Alec Brown --- util/grub-module-verifierXX.c | 25 +++-- 1 file c

[PATCH 3/4] util/grub-module-verifierXX.c: Validate elf section header table index for section name string table

2022-02-02 Thread Alec Brown
_real(arch, (x)) based on defines earlier in the file. Signed-off-by: Alec Brown --- util/grub-module-verifierXX.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierXX.c index 61b82141f..3a5265aff

[PATCH 0/4] Clean up code and fix coverity bugs in util/grub-module-verifierXX.c

2022-02-02 Thread Alec Brown
Coverity identified several untrusted loop bounds in util/grub-module-verifierXX.c. This patch series addresses these bugs, cleans up lengthy equations, and makes checks to values based on the elf manual page. The Coverity Bugs being addressed are: CID 314021 CID 314027 CID 314033 Alec Brown (4

[PATCH 4/4] util/grub-module-verifierXX.c: Add module_size parameter to functions for sanity checking

2022-02-02 Thread Alec Brown
unction get_shdr(), but in order to do so, the parameter module_size must be added to functions so that the value of the module size can be used in get_shdr() from grub_module_verifyXX(). Signed-off-by: Alec Brown --- util/grub-module-verifierXX.c | 69 --- 1

[PATCH 2/4] util/grub-module-verifierXX.c: Validate number of elf section header table entries

2022-02-02 Thread Alec Brown
rlier in the file. Fixes: CID 314021 Fixes: CID 314027 Fixes: CID 314033 Signed-off-by: Alec Brown --- util/grub-module-verifierXX.c | 35 +-- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/util/grub-module-verifierXX.c b/util/grub-module-verifierX

[PATCH 0/7] Fix coverity uninitialized scalar variable bugs in grub-core

2022-03-15 Thread Alec Brown
Coverity identified multiple uninitialized scalar variable bugs in multiple components of the grub-core. These patches address these issues. The Coverity bugs being addressed are: CID 375026 CID 375028 CID 375030 CID 375031 CID 375033 CID 375035 CID 375036 Alec Brown (7): grub-core/loader

[PATCH 3/7] grub-core/net/arp.c: Fix uninitialized scalar variable

2022-03-15 Thread Alec Brown
r and target_addr to {}. Fixes: CID 375030 Signed-off-by: Alec Brown --- grub-core/net/arp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c index 54306e3b1..2b3765932 100644 --- a/grub-core/net/arp.c +++ b/grub-core/net/arp.c @@ -115,7 +

[PATCH 1/7] grub-core/loader/i386/bsd.c: Fix uninitialized scalar variable

2022-03-15 Thread Alec Brown
ff-by: Alec Brown --- grub-core/loader/i386/bsd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c index 5f3290ce1..b99344556 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c @@ -929,7 +

[PATCH 5/7] grub-core/net/net.c: Fix uninitialized scalar variable

2022-03-15 Thread Alec Brown
ff-by: Alec Brown --- grub-core/net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/net/net.c b/grub-core/net/net.c index 4d3eb5c1a..4e93365a7 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -287,7 +287,7 @@ grub_net_ipv6_get_link_local (s

[PATCH 4/7] grub-core/loader/i386/xnu.c: Fix uninitialized scalar variable

2022-03-15 Thread Alec Brown
In the function grub_xnu_boot_resume(), struct grub_relocator32_state state is called but isn't being initialized. To prevent contents of this structure from being filled with junk data from the stack, we can initialize it to 0 by setting state to {}. Fixes: CID 375031 Signed-off-by: Alec

[PATCH 2/7] grub-core/loader/i386/pc/linux.c: Fix uninitialized scalar variable

2022-03-15 Thread Alec Brown
In the function grub_linux16_boot(), struct grub_relocator16_state state is called but isn't being initialized. To prevent contents of this structure from being filled with junk data from the stack, we can initialize it to 0 by setting state to {}; Fixes: CID 375028 Signed-off-by: Alec

[PATCH 6/7] grub-core/loader/i386/xnu.c: Fix uninitialized scalar variable

2022-03-15 Thread Alec Brown
In the function grub_xnu_boot(), struct grub_relocator32_state state is called but isn't being initialized. To prevent contents of this structure from being filled with junk data from the stack, we can initialize it to 0 by setting state to {}. Fixes: CID 375035 Signed-off-by: Alec

[PATCH 7/7] grub-core/net/bootp.c: Fix uninitialized scalar variable

2022-03-15 Thread Alec Brown
ff-by: Alec Brown --- grub-core/net/bootp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c index 6fb562702..708d601df 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -232,7 +232,7 @@ grub_net_configure_by_dhcp_ack (

[PATCH v2 0/7] Fix coverity uninitialized scalar variable bugs in grub-core

2022-03-20 Thread Alec Brown
375028 CID 375030 CID 375031 CID 375033 CID 375035 CID 375036 Alec Brown (7): grub-core/loader/i386/bsd.c: Fix uninitialized scalar variable grub-core/loader/i386/pc/linux.c: Fix uninitialized scalar variable grub-core/net/arp.c: Fix uninitialized scalar variable grub-core

[PATCH v2 3/7] grub-core/net/arp.c: Fix uninitialized scalar variable

2022-03-20 Thread Alec Brown
junk data from the stack. To prevent this, we can set the option member in both structs to 0. Fixes: CID 375030 Signed-off-by: Alec Brown --- grub-core/net/arp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/grub-core/net/arp.c b/grub-core/net/arp.c index 54306e3b1..1d367436c 100644

[PATCH v2 4/7] grub-core/loader/i386/xnu.c: Fix uninitialized scalar variable

2022-03-20 Thread Alec Brown
ne of them are being set to any values. We can prevent this by setting state to {0}. Fixes: CID 375031 Signed-off-by: Alec Brown --- grub-core/loader/i386/xnu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c index a700

[PATCH v2 5/7] grub-core/net/net.c: Fix uninitialized scalar variable

2022-03-20 Thread Alec Brown
: CID 375033 Signed-off-by: Alec Brown --- grub-core/net/net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/grub-core/net/net.c b/grub-core/net/net.c index 4d3eb5c1a..b6eb1f951 100644 --- a/grub-core/net/net.c +++ b/grub-core/net/net.c @@ -292,6 +292,7 @@ grub_net_ipv6_get_link_local (s

[PATCH v2 7/7] grub-core/net/bootp.c: Fix uninitialized scalar variable

2022-03-20 Thread Alec Brown
: CID 375036 Signed-off-by: Alec Brown --- grub-core/net/bootp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c index 6fb562702..8dbd1b232 100644 --- a/grub-core/net/bootp.c +++ b/grub-core/net/bootp.c @@ -244,6 +244,7 @@ grub_net_configure_by_dhc

[PATCH v2 1/7] grub-core/loader/i386/bsd.c: Fix uninitialized scalar variable

2022-03-20 Thread Alec Brown
Fixes: CID 375026 Signed-off-by: Alec Brown --- grub-core/loader/i386/bsd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c index 5f3290ce1..de63ca8dc 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/

[PATCH v2 2/7] grub-core/loader/i386/pc/linux.c: Fix uninitialized scalar variable

2022-03-20 Thread Alec Brown
et to any values. We can prevent this by setting state to {0}. Fixes: CID 375028 Signed-off-by: Alec Brown --- grub-core/loader/i386/pc/linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c index 2a29

[PATCH v2 6/7] grub-core/loader/i386/xnu.c: Fix uninitialized scalar variable

2022-03-20 Thread Alec Brown
them are being set to any values. We can prevent this by setting state to {0}. Fixes: CID 375035 Signed-off-by: Alec Brown --- grub-core/loader/i386/xnu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c index 2bc1

[PATCH v3 0/5] Fix coverity bugs and add checks for elf values in grub-core

2022-04-20 Thread Alec Brown
8 CID 314030 CID 314031 CID 314039 Alec Brown (5): grub-core/loader/i386/bsdXX.c: Avoid downcasting (char *) to (Elf_Shdr *) elf: Validate number of elf section header table entries elf: Validate elf section header table index for section name string table elf: Validate numb

[PATCH v3 4/5] elf: Validate number of elf program header table entries

2022-04-20 Thread Alec Brown
located in grub-core/kern, they are compiled as modules and don't need the EXPORT_FUNC macro to define the functions in elf.h. Signed-off-by: Alec Brown --- grub-core/kern/elf.c | 3 +++ grub-core/kern/elfXX.c | 34 ++ grub-core/loader

[PATCH v3 2/5] elf: Validate number of elf section header table entries

2022-04-20 Thread Alec Brown
VE and sh_size isn't less than SHN_LORESERVE. Note that even though elf.c and elfXX.c are located in grub-core/kern, they are compiled as modules and don't need the EXPORT_FUNC macro to define the functions in elf.h. Signed-off-by: Alec Brown --- grub-core/kern/elf.c

[PATCH v3 1/5] grub-core/loader/i386/bsdXX.c: Avoid downcasting (char *) to (Elf_Shdr *)

2022-04-20 Thread Alec Brown
39 Signed-off-by: Alec Brown --- grub-core/loader/i386/bsdXX.c | 66 +++ 1 file changed, 28 insertions(+), 38 deletions(-) diff --git a/grub-core/loader/i386/bsdXX.c b/grub-core/loader/i386/bsdXX.c index e4f4aa365..6946cecbb 100644 --- a/grub-core/loader/i386/bsd

[PATCH v3 5/5] util/grub-module-verifierXX.c: Add e_shoff check in get_shdr()

2022-04-20 Thread Alec Brown
In util/grub-module-verifierXX.c, the function get_shdr() is used to obtain the section header at a given index but isn't checking that there is an offset for the section header table. To validate that there is, we can check that e_shoff isn't 0. Signed-off-by: Alec Brown --- util/g

[PATCH v3 3/5] elf: Validate elf section header table index for section name string table

2022-04-20 Thread Alec Brown
isn't less than SHN_LORESERVE. Note that even though elf.c and elfXX.c are located in grub-core/kern, they are compiled as modules and don't need the EXPORT_FUNC macro to define the functions in elf.h. Signed-off-by: Alec Brown --- grub-core/kern/elf.c | 3 +++

[PATCH 0/6] Fix coverity bugs and add checks for elf values in grub-core

2022-05-26 Thread Alec Brown
bugs being addressed are: CID 314018 CID 314030 CID 314031 CID 314039 Alec Brown (6): grub-core/loader/i386/bsdXX.c: Avoid downcasting (char *) to (Elf_Shdr *) elf: Validate number of elf section header table entries elf: Validate elf section header table index for section name s

[PATCH 5/6] util/grub-module-verifierXX.c: Add e_shoff check in get_shdr()

2022-05-26 Thread Alec Brown
In util/grub-module-verifierXX.c, the function get_shdr() is used to obtain the section header at a given index but isn't checking that there is an offset for the section header table. To validate that there is, we can check that e_shoff isn't 0. Signed-off-by: Alec Brown --- util/g

[PATCH 6/6] util/grub-module-verifierXX.c: Changed get_shnum() return type

2022-05-26 Thread Alec Brown
, depending on the architecture, but Elf_Word is only grub_uint32_t. To account for when sh_size is grub_uint64_t, we can set shnum to have type Elf_Shnum and have get_shnum() return an Elf_Shnum. Signed-off-by: Alec Brown --- util/grub-module-verifierXX.c | 10 ++ 1 file changed, 6

[PATCH 4/6] elf: Validate number of elf program header table entries

2022-05-26 Thread Alec Brown
located in grub-core/kern, they are compiled as modules and don't need the EXPORT_FUNC macro to define the functions in elf.h. Also, changed casts of phnum to match variables being set as well as dropped casts when unnecessary. Signed-off-by: Alec Brown --- grub-core/kern/elf.c

[PATCH 1/6] grub-core/loader/i386/bsdXX.c: Avoid downcasting (char *) to (Elf_Shdr *)

2022-05-26 Thread Alec Brown
't tainted. Also, switched use of (char *) to (grub_uint8_t *) to give a better indication of pointer arithmetic and not suggest use of a C string. Fixes: CID 314018 Fixes: CID 314030 Fixes: CID 314031 Fixes: CID 314039 Signed-off-by: Alec Brown --- grub-core/loader/i3

[PATCH 2/6] elf: Validate number of elf section header table entries

2022-05-26 Thread Alec Brown
being set as well as dropped casts when unnecessary and fixed spacing errors in bsdXX.c. Signed-off-by: Alec Brown --- grub-core/kern/elf.c | 12 + grub-core/kern/elfXX.c | 34 + grub-core/loader/i386/bsdXX.c | 82 ++

[PATCH 3/6] elf: Validate elf section header table index for section name string table

2022-05-26 Thread Alec Brown
isn't less than SHN_LORESERVE. Note that even though elf.c and elfXX.c are located in grub-core/kern, they are compiled as modules and don't need the EXPORT_FUNC macro to define the functions in elf.h. Signed-off-by: Alec Brown --- grub-core/kern/elf.c | 3 +++

Re: [PATCH] Initialize local relocator subchunk struct to all zeros

2022-07-15 Thread Alec Brown
-by: Darren Kenny I ran this through a private Coverity scan which marked the bug as eliminated and didn't have any issues running it on a VM. Tested-by: Alec Brown Alec Brown > > Thanks, > > Darren. > > > --- > > grub-core/lib/relocator.c | 2 +- &g

[PATCH v2 1/5] elf: Validate number of elf section header table entries

2022-08-12 Thread Alec Brown
num to match variables being set as well as dropped casts when unnecessary and fixed spacing errors in bsdXX.c. Also, shnum is an unsigned integer and is compared to int i in multiboot_elfxx.c, it should be unsigned to match shnum. Signed-off-by: Alec Brown --- grub-core/kern/elf.c

[PATCH v2 3/5] elf: Validate number of elf program header table entries

2022-08-12 Thread Alec Brown
located in grub-core/kern, they are compiled as modules and don't need the EXPORT_FUNC macro to define the functions in elf.h. Also, changed casts of phnum to match variables being set as well as dropped casts when unnecessary. Signed-off-by: Alec Brown --- grub-core/kern/elf.c

[PATCH v2 4/5] util/grub-module-verifierXX.c: Changed get_shnum() return type

2022-08-12 Thread Alec Brown
, depending on the architecture, but Elf_Word is only grub_uint32_t. To account for when sh_size is grub_uint64_t, we can set shnum to have type Elf_Shnum and have get_shnum() return an Elf_Shnum. Signed-off-by: Alec Brown --- util/grub-module-verifierXX.c | 10 ++ 1 file changed, 6

[PATCH v2 0/5] Fix coverity bugs and add checks for elf values in grub-core

2022-08-12 Thread Alec Brown
rXX.c that checks elf header values, and update error conditionals of the affected files. Also, I was able to verify that these patches work by using Multiboot and Multiboot2 to boot a Xen image. Alec Brown (5): elf: Validate number of elf section header table entries elf: Validate elf sect

[PATCH v2 2/5] elf: Validate elf section header table index for section name string table

2022-08-12 Thread Alec Brown
isn't less than SHN_LORESERVE. Note that even though elf.c and elfXX.c are located in grub-core/kern, they are compiled as modules and don't need the EXPORT_FUNC macro to define the functions in elf.h. Signed-off-by: Alec Brown --- grub-core/kern/elf.c | 3 +++

[PATCH v2 5/5] loader: Update error conditionals to use enums

2022-08-12 Thread Alec Brown
tionals to GRUB_ERR_NONE. Signed-off-by: Alec Brown --- grub-core/loader/i386/bsdXX.c | 38 +++--- grub-core/loader/multiboot_elfxx.c | 6 ++--- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/grub-core/loader/i386/bsdXX.c b/grub-core/loader/i386/bsdXX.c index

[PATCH] grub-core/disk/cryptodisk.c: Fix unintentional integer overflow

2022-10-13 Thread Alec Brown
etween these two values of different types, there may be potential for an integer overflow. To avoid this, we replace 1U with (grub_size_t) 1. Fixes: CID 307788 Signed-off-by: Alec Brown --- grub-core/disk/cryptodisk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-cor

[PATCH v2] grub-core/disk/cryptodisk.c: Fix unintentional integer overflow

2022-10-14 Thread Alec Brown
n a 32-bit value and assigning it to a 64-bit variable, the 64-bit variable may have incorrect values in the high 32-bits if the shift has an overflow. To avoid this, we replace 1U with (grub_size_t) 1. Fixes: CID 307788 Signed-off-by: Alec Brown --- There was a mistake in v1 of the commit m

[PATCH 2/2] video/readers/jpeg: Check next_marker is within file size

2022-10-20 Thread Alec Brown
ck is being added to the function. Signed-off-by: Alec Brown --- grub-core/video/readers/jpeg.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c index 0eeea0e63..c0f95fbf9 100644 --- a/grub-core/video/readers/jpeg.c +++ b

[PATCH 0/2] Fix Coverity untrusted loop bound bugs in jpeg.c

2022-10-20 Thread Alec Brown
econd bug. The Coverity bugs being addressed are: CID 292450 Alec Brown (2): video/readers: Add artificial limit to image dimensions video/readers/jpeg: Check next_marker is within file size docs/grub.texi | 3 ++- grub-core/video/readers/jpeg.c | 12 +++- grub

[PATCH 1/2] video/readers: Add artificial limit to image dimensions

2022-10-20 Thread Alec Brown
ing it. To prevent this, the constant IMAGE_HW_MAX_PX is being added to bitmap.h, which has a value of 16384, to act as an artifical limit and restrict the height and width of images. This value was picked as it is double the current max resolution size, which is 8K. Fixes: CID 292450 Signed-off-by:

Re: [External] : Re: [PATCH 2/2] video/readers/jpeg: Check next_marker is within file size

2022-10-26 Thread Alec Brown
On Sat, Oct 22, 2022 at 12:52:02AM +1100, Daniel Axtens wrote: > Alec Brown writes: > > > In grub-core/video/readers/jpeg.c, the function > > grub_jpeg_decode_huff_table() > > has the variable next_marker which reads data from grub_jpeg_get_word() and > > then

[PATCH v2] video/readers: Add artificial limit to image dimensions

2022-10-26 Thread Alec Brown
ing it. To prevent this, the constant IMAGE_HW_MAX_PX is being added to bitmap.h, which has a value of 16384, to act as an artifical limit and restrict the height and width of images. This value was picked as it is double the current max resolution size, which is 8K. Fixes: CID 292450 Signed-off-by:

[PATCH] net/bootp: Fix unchecked return value

2023-02-03 Thread Alec Brown
In the function send_dhcp_packet(), added an error check for the return value of grub_netbuff_push(). Fixes: CID 404614 Signed-off-by: Alec Brown --- grub-core/net/bootp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grub-core/net/bootp.c b/grub-core/net/bootp.c index

[PATCH] util/grub-module-verifierXX.c: Add module_size parameter to functions for sanity checking

2023-03-09 Thread Alec Brown
unction get_shdr(), but in order to do so, the parameter module_size must be added to functions so that the value of the module size can be used in get_shdr() from grub_module_verifyXX(). Also, had to rework some for loops to ensure the index passed to get_shdr() is within bounds. Signed-off-by

[PATCH 4/4] efi: Fix use-after-free in finish boot services

2023-05-22 Thread Alec Brown
. Signed-off-by: Alec Brown --- grub-core/kern/efi/mm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c index 3705b8b1b..c74ccbb05 100644 --- a/grub-core/kern/efi/mm.c +++ b/grub-core/kern/efi/mm.c @@ -263,6 +263,7

[PATCH 3/4] elf: check program header offset doesn't exceed constraints

2023-05-22 Thread Alec Brown
to insure that the program header offset isn't outside of the limits. Fixes: CID 314029 Fixes: CID 314038 Signed-off-by: Alec Brown --- grub-core/loader/multiboot_elfxx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/l

[PATCH 1/4] elf: Check program memory isn't larger than allocated memory size

2023-05-22 Thread Alec Brown
allocated memory region plus the memory size of the program is smaller than the allocated memory size. Fixes: CID 314029 Fixes: CID 314038 Signed-off-by: Alec Brown --- grub-core/loader/multiboot_elfxx.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/grub-c

[PATCH 2/4] elf: Check section header region before allocating memory

2023-05-22 Thread Alec Brown
CID 314029 Fixes: CID 314038 Signed-off-by: Alec Brown --- grub-core/loader/multiboot_elfxx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c index 69f567588..52eaf9184 100644 --- a/grub-core/loader/multiboot_elfxx.c

[PATCH 0/4] Address coverity untrusted loop bound bugs in multiboot_elfxx.c

2023-05-22 Thread Alec Brown
ore this since phnum is already getting checked earlier in the function. I've also bundled a use-after-free patch with this patch set at the end. Alec Brown (4): elf: Check program memory isn't larger than allocated memory size elf: Check section header region before allocatin

Re: [PATCH] bootstrap: Fix patching warnings

2023-06-22 Thread Alec Brown
> patching file mbswidth.c > patching file mbswidth.h > Hunk #1 succeeded at 40 (offset -5 lines). > > Let's fix it by amending line numbers in the patch. > > Signed-off-by: Daniel Kiper Looks good to me! Reviewed-by: Alec Brown > --- > grub-core/lib/gnulib-pa

[PATCH] gfxmenu/gui_image.c: Fix double free of bitmap

2023-12-13 Thread Alec Brown
ath that would free self->bitmap a second time in the function rescale_image(). Fixes: CID 292472 Signed-off-by: Alec Brown --- grub-core/gfxmenu/gui_image.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/grub-core/gfxmenu/gui_image.c b/grub-core/gfxmenu/g

[PATCH 0/3] Clean up unused values

2024-01-19 Thread Alec Brown
Coverity listed three unused value bugs in the GRUB. These patches help clean up and remove these uneccessary bits of code. The Coverity bugs being addressed are: CID 428875 CID 428876 CID 428877 Alec Brown (3): fs/jfs.c: Clean up redundant code osdep/unix/getroot.c: Clean up

[PATCH 3/3] loader/i386/multiboot_mbi.c: Clean up redundant code

2024-01-19 Thread Alec Brown
: Alec Brown --- grub-core/loader/i386/multiboot_mbi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c index 11a6e224f..fae5d6fb8 100644 --- a/grub-core/loader/i386/multiboot_mbi.c +++ b/grub-core

[PATCH 1/3] fs/jfs.c: Clean up redundant code

2024-01-19 Thread Alec Brown
In grub-core/fs/jfs.c, coverity spotted redundant code where the pointer diro was being set to 0 and then being overwritten later without being used. Since this is unnecessary, we can remove the code that sets diro to 0. Fixes: CID 428876 Signed-off-by: Alec Brown --- grub-core/fs/jfs.c | 1

[PATCH 2/3] osdep/unix/getroot.c: Clean up redundant code

2024-01-19 Thread Alec Brown
In grub-core/osdep/unix/getroot.c, coverity spotted redundant code where the double pointer os_dev was being set to 0 and then being overwritten later without being used. Since this is unnecessary, we can remove the code that sets os_dev to 0. Fixes: CID 428875 Signed-off-by: Alec Brown

[PATCH] cli_lock: Added build option to block command line interface

2024-01-23 Thread Alec Brown
Added functionality to disable command line interface access and editing of GRUB menu entries if GRUB image is built with --disable-cli. Signed-off-by: Alec Brown --- docs/grub.texi | 6 -- grub-core/kern/main.c | 28 grub-core/kern

RE: [External] : Re: [PATCH] Allow background to be set when theme is set

2024-11-05 Thread Alec Brown via Grub-devel
email with an updated version number, i.e. [PATCH v2]. You will also need a signed-off-by at the end of your commit message for the patch. Alec Brown On Tue, Oct 22, 2024 at 2:50 PM, Lin wrote: > On 13.06.24 17:28, Lin wrote: > > > > Hello, first time contributor here. > > I&#

RE: [External] : [PATCH v3 8/8] i386: Add CRx, MMIO, MSR and extend CPUID definitions

2024-10-01 Thread Alec Brown via Grub-devel
y of vendor, features > - Intel: VMX, SMX > - AMD: SVM > > Signed-off-by: Ross Philipson > Signed-off-by: Daniel Kiper > Signed-off-by: Krystian Hebel > Signed-off-by: Sergii Dmytruk Reviewed-by: Alec Brown > --- > include/grub/i386/cpuid.h | 11

[PATCH 0/3] Add commands to load BLS and UKI files

2025-02-14 Thread Alec Brown via Grub-devel
This patch set is introducing BootLoaderSpec support to upstream GRUB from Fedora GRUB. I've also added a uki command to load Unified Kernel Images since it shares similar code to loading BLS config files. Alec Brown Alec Brown (1): blsuki: Add uki command to load Unified Kernel

[PATCH 1/3] blsuki: Add blscfg command to parse Boot Loader Specification snippets

2025-02-14 Thread Alec Brown via Grub-devel
Signed-off-by: Alec Brown --- Makefile.util.def | 16 + docs/grub.texi | 27 + grub-core/Makefile.core.def| 10 + grub-core/commands/blsuki.c| 1030 grub-core/commands/legacycfg.c |4 +- grub-core/commands/menuentry.c

[PATCH 2/3] blsuki: Check for mounted /boot in emu

2025-02-14 Thread Alec Brown via Grub-devel
: Alec Brown --- grub-core/Makefile.core.def | 4 +++ grub-core/commands/blsuki.c | 50 + grub-core/osdep/linux/getroot.c | 8 ++ grub-core/osdep/unix/getroot.c | 10 +++ include/grub/emu/misc.h | 2 +- 5 files changed, 68 insertions(+), 6

[PATCH 3/3] blsuki: Add uki command to load Unified Kernel Image entries

2025-02-14 Thread Alec Brown via Grub-devel
A Unified Kernel Image is a single UEFI PE file that combines a UEFI boot stub, a Linux kernel image, an initrd, and further resources. The uki command will locate where the uki file is and create a GRUB menu entry to load it. Signed-off-by: Alec Brown --- docs/grub.texi | 26

[PATCH v2 3/3] blsuki: Add uki command to load Unified Kernel Image entries

2025-03-25 Thread Alec Brown via Grub-devel
A Unified Kernel Image is a single UEFI PE file that combines a UEFI boot stub, a Linux kernel image, an initrd, and further resources. The uki command will locate where the uki file is and create a GRUB menu entry to load it. Signed-off-by: Alec Brown --- docs/grub.texi | 26

[PATCH v2 1/3] blsuki: Add blscfg command to parse Boot Loader Specification snippets

2025-03-25 Thread Alec Brown via Grub-devel
Signed-off-by: Alec Brown --- Makefile.util.def | 16 + docs/grub.texi | 27 + grub-core/Makefile.core.def| 10 + grub-core/commands/blsuki.c| 1028 grub-core/commands/legacycfg.c |4 +- grub-core/commands/menuentry.c

[PATCH v2 2/3] blsuki: Check for mounted /boot in emu

2025-03-25 Thread Alec Brown via Grub-devel
: Alec Brown --- grub-core/Makefile.core.def | 4 +++ grub-core/commands/blsuki.c | 54 - grub-core/osdep/linux/getroot.c | 8 + grub-core/osdep/unix/getroot.c | 10 ++ include/grub/emu/misc.h | 2 +- 5 files changed, 70 insertions(+), 8

[PATCH v2 0/3] Add commands to load BLS and UKI files

2025-03-25 Thread Alec Brown via Grub-devel
since it shares similar code to loading BLS config files. Alec Brown Alec Brown (1): blsuki: Add uki command to load Unified Kernel Image entries Peter Jones (1): blsuki: Add blscfg command to parse Boot Loader Specification snippets Robbie Harwood (1): blsuki: Check for mount

RE: [PATCH v2 2/3] blsuki: Check for mounted /boot in emu

2025-03-27 Thread Alec Brown via Grub-devel
On Tue, Mar 25, 2025 at 8:26 AM, Vladimir 'phcoder' Serbinenko wrote: > Le mar. 25 mars 2025, 10:15, Alec Brown a écrit : > >> Irritatingly, BLS defines paths relatives to the mountpoint of the >> filesystem which contains its snippets, not / or any other fixed >

RE: [PATCH v2 3/3] blsuki: Add uki command to load Unified Kernel Image entries

2025-03-27 Thread Alec Brown via Grub-devel
On Wed, Mar 26, 2025 at 5:43 AM, Vladimir 'phcoder' Serbinenko wrote: >> >> >> >> +#ifdef GRUB_MACHINE_EFI >> +#include >> +#include >> +#include >> +#endif >> + >> > Can UKI work without EFI? I think of scenario of putting e.g. EFI disk into > coreboot or BIOS machine. No UKI only works EFI

[PATCH v3 2/3] blsuki: Check for mounted /boot in emu

2025-04-11 Thread Alec Brown via Grub-devel
: Alec Brown --- grub-core/Makefile.core.def | 4 ++ grub-core/commands/blsuki.c | 92 ++--- grub-core/osdep/linux/getroot.c | 8 +++ grub-core/osdep/unix/getroot.c | 10 include/grub/emu/misc.h | 2 +- 5 files changed, 107 insertions(+), 9

[PATCH v3 0/3] Add commands to load BLS and UKI files

2025-04-11 Thread Alec Brown via Grub-devel
load Unified Kernel Images since it shares similar code to loading BLS config files. Alec Brown Alec Brown (1): blsuki: Add uki command to load Unified Kernel Image entries Peter Jones (1): blsuki: Add blscfg command to parse Boot Loader Specification snippets Robbie Harwood (1):

[PATCH v3 1/3] blsuki: Add blscfg command to parse Boot Loader Specification snippets

2025-04-11 Thread Alec Brown via Grub-devel
Signed-off-by: Alec Brown --- Makefile.util.def | 16 + docs/grub.texi | 29 + grub-core/Makefile.core.def| 10 + grub-core/commands/blsuki.c| 1057 grub-core/commands/legacycfg.c |4 +- grub-core/commands/menuentry.c

[PATCH v3 3/3] blsuki: Add uki command to load Unified Kernel Image entries

2025-04-11 Thread Alec Brown via Grub-devel
A Unified Kernel Image is a single UEFI PE file that combines a UEFI boot stub, a Linux kernel image, an initrd, and further resources. The uki command will locate where the uki file is and create a GRUB menu entry to load it. Signed-off-by: Alec Brown --- docs/grub.texi | 26

RE: [PATCH v2 3/3] blsuki: Add uki command to load Unified Kernel Image entries

2025-04-11 Thread Alec Brown via Grub-devel
On Tue, Apr 1, 2025 at 6:35 AM, Vladimir 'phcoder' Serbinenko wrote: > Le jeu. 27 mars 2025, 23:44, Alec Brown a écrit : > >> On Wed, Mar 26, 2025 at 5:43 AM, Vladimir 'phcoder' Serbinenko < >> phco...@gmail.com> wrote: >> >> &g