[PATCH V2 8/9] fs/squash4: Fix memeory leak in grub_squash_iterate_dir

2022-11-29 Thread t.feng via Grub-devel
Fix memory leaks in grub_squash_iterate_dir. Fixes: 20dd511c8(Handle "." and ".." on squashfs.) Signed-off-by: "t.feng" Reviewed-by: Daniel Kiper --- grub-core/fs/squash4.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/grub-core/fs/squash4.c b/grub-c

[PATCH V2 9/9] fs/xfs: Fix memory leaks in xfs

2022-11-29 Thread t.feng via Grub-devel
Fix memory leaks in xfs. Signed-off-by: "t.feng" Reviewed-by: Daniel Kiper --- grub-core/fs/xfs.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c index d6de7f1a2..b67407690 100644 --- a/grub-core/fs/xfs.c +++ b/grub-core/fs

[PATCH V2 7/9] fs/iso9660: Fix memory leak in grub_iso9660_susp_iterate

2022-11-29 Thread t.feng via Grub-devel
Fix memory leak in grub_iso9660_susp_iterate. Fixes: 99373ce47(iso9660.c: Remove nested functions.) Signed-off-by: "t.feng" Reviewed-by: Thomas Schmitt Reviewed-by: Daniel Kiper --- grub-core/fs/iso9660.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/grub-core

[PATCH V2 4/9] fs/ntfs: Fix memory leak in grub_ntfs_read_symlink

2022-11-29 Thread t.feng via Grub-devel
Fix memory leaks in grub_ntfs_read_symlink. Fixes: 5773fb641(Support NTFS reparse points.) Signed-off-by: "t.feng" --- grub-core/fs/ntfs.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c index 3511e4e2c..

[PATCH V2 1/9] fs/affs:Fix memory leaks in grub_affs_create_node

2022-11-29 Thread t.feng via Grub-devel
hashtable is unfreed in case GRUB_AFFS_FILETYPE_HARDLINK if grub_disk_read failed. Because, if grub_affs_create_node return not zero, the hashtable should be freed. By the way hashtable is unused in grub_affs_create_node, so we can remove the parameter and take care of it in grub_affs_iterate_dir.

[PATCH V2 3/9] fs/minix: Fix memory leak in grub_minix_lookup_symlink

2022-11-29 Thread t.feng via Grub-devel
Fix memory leaks in grub_minix_lookup_symlink. Fixes: a07e6ad01(Remove variable length arrays) Signed-off-by: "t.feng" --- grub-core/fs/minix.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c index 953df1191..5354951d1 100644

[PATCH V2 2/9] fs/btrfs: Fix memory leak in find_path

2022-11-29 Thread t.feng via Grub-devel
Fix memory leak in find_path. Fixs: 82591fa6e(Make / in btrfe refer to real root) Signed-off-by: "t.feng" Reviewed-by: Daniel Kiper --- grub-core/fs/btrfs.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index ec72f7be3..19

[PATCH V2 5/9] fs/bfs: Fix memory leak in read_bfs_file

2022-11-29 Thread t.feng via Grub-devel
Fix memory leaks in read_bfs_file. l1_entries and l2_entries are forgotten to be freed if end of reading file. Fixes: 5825b3794(BFS implementation based on the specification.) Signed-off-by: "t.feng" Reviewed-by: Daniel Kiper --- grub-core/fs/bfs.c | 2 ++ 1 file changed, 2 insertions(+) diff

[PATCH V2 0/9] fix memory leaks in fs module

2022-11-29 Thread t.feng via Grub-devel
Hi all, I am doing code review in grub-core/fs module and I found some memory leaks. V2: use goto statement in fs/minix and fs/ntfs. ** t.feng (9): fs/affs:Fix memory leaks in grub_affs_create_node fs/btrfs: Fix memory leak in find_path fs/minix: Fix memory leak i

[PATCH V2 6/9] fs/hfsplus: Fix memory leak in grub_hfsplus_btree_search

2022-11-29 Thread t.feng via Grub-devel
Fix memory leak in grub_hfsplus_btree_search. Fixes: 58ea11d5b(Don't fetch a key beyond the end of the node) Signed-off-by: "t.feng" Reviewed-by: Daniel Kiper --- grub-core/fs/hfsplus.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/grub-core/fs/hfsplus.c b/grub-core/f

Re: Possible memory fault in fs/iso9660 (correction)

2022-11-29 Thread Fengtao (fengtao, Euler) via Grub-devel
Hi, Thomas Sorry for the delay, I am also not familiar with ISO format. But, i have check the cdrkit src-code[1] and syslinux src-code[2] I think: (char *) entry < (char *) sua + sua_size - 3 && entry->len > 0 is ok, or: (char *) entry <= (char *) sua + sua_size - 4 && entry->len >

Re: [PATCH V2 0/9] fix memory leaks in fs module

2022-11-29 Thread Daniel Kiper
On Tue, Nov 29, 2022 at 05:14:06PM +0800, t.feng via Grub-devel wrote: > Hi all, > I am doing code review in grub-core/fs module and I found some > memory leaks. > > V2: > use goto statement in fs/minix and fs/ntfs. > > ** > > t.feng (9): > fs/affs:Fix memory leaks in gr

Re: [PATCH 0/2] Fix command line underflows and out-of-bounds write

2022-11-29 Thread Daniel Kiper
On Sat, Nov 26, 2022 at 05:22:50PM -0500, Ryan Cohen wrote: > Hello everyone, > > I was messing around in the GRUB command line and I found two related > integer underflows that occur on all platforms. I also found an > out-of-bounds write that occurs only on i386 systems using the VGA text > termi

Re: [PATCH v2] loader: Ensure the newc pathname is NULL-terminated

2022-11-29 Thread Daniel Kiper
On Fri, Nov 25, 2022 at 03:37:35PM +0800, Gary Lin via Grub-devel wrote: > Per "man 5 cpio", the namesize in the cpio header includes the trailing > NUL byte of the pathname and the pathname is followed by NUL bytes, but > the current implementation ignores the trailing NUL byte when making > the n

[PATCH 1/2] mm: Adjust new region size to take management cost into account

2022-11-29 Thread Zhang Boyang
When grub_memalign() encounters out-of-memory, it will try grub_mm_add_region_fn() to request more memory from system firmware. However, the size passed to it doesn't take region management cost into account. Adding a memory area of `size` bytes will result in a heap region of less than `size` byte

[PATCH 0/2] mm: Better handling of adding new regions

2022-11-29 Thread Zhang Boyang
This patchset is splitted from the patch at https://lists.gnu.org/archive/html/grub-devel/2022-10/msg00077.html Sending as new patchset since some part of previous patchset have been merged. Changes: Renamed `guarantee` to `bound`. New region size is now adjuested before comparing to GRUB_MM_HEAP

[PATCH 2/2] mm: Preallocate some space when adding new regions

2022-11-29 Thread Zhang Boyang
When grub_memalign() encounters out-of-memory, it will try grub_mm_add_region_fn() to request more memory from system firmware. However, it doesn't preallocate memory space for future allocation requests. In extreme cases, it requires one call to grub_mm_add_region_fn() for each memory allocation r

Re: Possible memory fault in fs/iso9660 (correction)

2022-11-29 Thread Daniel Kiper
On Tue, Nov 29, 2022 at 05:32:56PM +0800, Fengtao (fengtao, Euler) via Grub-devel wrote: > Hi, Thomas > Sorry for the delay, I am also not familiar with ISO format. > But, i have check the cdrkit src-code[1] and syslinux src-code[2] > > I think: > (char *) entry < (char *) sua + sua_size - 3

Re: [PATCH v2] tpm: Disable tpm verifier if tpm is not present

2022-11-29 Thread Daniel Kiper
On Fri, Nov 25, 2022 at 03:00:48PM +0800, Michael Chang via Grub-devel wrote: > On Thu, Nov 24, 2022 at 05:04:48PM +0100, Daniel Kiper wrote: > > On Mon, Oct 17, 2022 at 01:19:08PM +0800, Michael Chang via Grub-devel > > wrote: > > > On Fri, Oct 14, 2022 at 11:40:01AM +0200, Daniel Kiper wrote: >

Re: [PATCH 2/2] bash-completion:fix shellcheck warning

2022-11-29 Thread Fengtao (fengtao, Euler) via Grub-devel
On 2022/11/24 0:09, Daniel Kiper wrote: > On Mon, Sep 19, 2022 at 09:20:14AM +0800, t.feng via Grub-devel wrote: >> SC2207 (warning): Prefer mapfile or read -a to split >> command output (or quote to avoid splitting). >> SC2120 (warning): __grub_get_options_from_help references arguments, >> but

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

2022-11-29 Thread Daniel Kiper
First of all, sorry for late reply. I hope I will be able to review next version of this patch much faster. On Sat, Oct 29, 2022 at 05:40:42PM +, Maxim Fomin wrote: > From 2b1d2deb3f2416cbc3e7d25cbc4141a3078eaf68 Mon Sep 17 00:00:00 2001 > From: Maxim Fomin > Date: Sat, 29 Oct 2022 18:18:58 +

[PATCH v2 1/2] efi: libstub: Always enable initrd command line loader and bump version

2022-11-29 Thread Ard Biesheuvel
In preparation for setting a cross-architecture baseline for EFI boot support, remove the Kconfig option that permits the command line initrd loader to be disabled. Also, bump the minor version so that any image built with the new version can be identified as supporting this. Signed-off-by: Ard Bi

[PATCH v2 0/2] efi: Add generic magic number in header

2022-11-29 Thread Ard Biesheuvel
This is a minimal respin of the RFC patch I sent out a few week ago. No changes were applied except the /0x30/0x38 typo fix and some additional wording in the commit log. I also added a patch to make the command line initrd loader always built-in. The purpose of all of this is to create *and docum

[PATCH v2 2/2] efi: Put Linux specific magic number in the DOS header

2022-11-29 Thread Ard Biesheuvel
GRUB currently relies on the magic number in the image header of ARM and arm64 EFI kernel images to decide whether or not the image in question is a bootable kernel. However, the purpose of the magic number is to identify the image as one that implements the bare metal boot protocol, and so GRUB,

Fonts and theming and what to do in future with SB

2022-11-29 Thread Steve McIntyre
Hey folks! So, with the latest set of GRUB CVE patches we've fixed up a bunch of potential crashes in font-handling code that could lead to Secure Boot holes. These are good and useful fixes, and thanks to Zhang Boyang and everyone else involved! There were also a few other changes: * In SB mod

Re: Possible memory fault in fs/iso9660 (correction)

2022-11-29 Thread Thomas Schmitt
Hi, Fengtao wrote: > I think: > (char *) entry < (char *) sua + sua_size - 3 && entry->len > 0 > is ok, or: > (char *) entry <= (char *) sua + sua_size - 4 && entry->len > 0 "4" would be overdone. There are SUSP and RRIP entries of length 4, which would be ignored if appearing at

Re: Possible memory fault in fs/iso9660 (correction)

2022-11-29 Thread Thomas Schmitt
Hi, i wrote: > > > I will think about creating such an ISO by help of xorriso and dd. Daniel Kiper wrote: > Yeah, that would be perfect... I believe to have created one. But grub-fstest does not produce a memory fault. See my mail Date: Tue, 29 Nov 2022 19:47:22 +0100 Message-Id: <5036388200

Re: [PATCH v2 0/2] efi: Add generic magic number in header

2022-11-29 Thread Leif Lindholm
On Tue, Nov 29, 2022 at 18:56:14 +0100, Ard Biesheuvel wrote: > This is a minimal respin of the RFC patch I sent out a few week ago. No > changes were applied except the /0x30/0x38 typo fix and some additional > wording in the commit log. I also added a patch to make the command line > initrd loade

Re: Fonts and theming and what to do in future with SB

2022-11-29 Thread Robbie Harwood
Steve McIntyre writes: > Hey folks! > > So, with the latest set of GRUB CVE patches we've fixed up a bunch of > potential crashes in font-handling code that could lead to Secure Boot > holes. These are good and useful fixes, and thanks to Zhang Boyang and > everyone else involved! > > There were

[PATCH] util/grub.d/30_uefi-firmware.in: Re-arrange if conditions

2022-11-29 Thread Dimitri John Ledkov
Only perform call to fwsetup if one is on EFI platform. On all other platorms fwsetup command does not exists, and thus returns 0 and a useless uefi-firmware menuentry gets generated. Signed-off-by: Dimitri John Ledkov --- util/grub.d/30_uefi-firmware.in | 12 +++- 1 file changed, 7 inse

Re: Fonts and theming and what to do in future with SB

2022-11-29 Thread Michael Chang via Grub-devel
On Tue, Nov 29, 2022 at 03:24:51PM -0500, Robbie Harwood wrote: > Steve McIntyre writes: > > > Hey folks! > > > > So, with the latest set of GRUB CVE patches we've fixed up a bunch of > > potential crashes in font-handling code that could lead to Secure Boot > > holes. These are good and useful f