[SECURITY PATCH 077/117] fs/jfs: Limit the extents that getblk() can consider

2021-03-02 Thread Daniel Kiper
From: Daniel Axtens getblk() implicitly trusts that treehead->count is an accurate count of the number of extents. However, that value is read from disk and is not trustworthy, leading to OOB reads and crashes. I am not sure to what extent the data read from OOB can influence subsequent program

[SECURITY PATCH 005/117] efi: Lockdown the GRUB when the UEFI Secure Boot is enabled

2021-03-02 Thread Daniel Kiper
From: Javier Martinez Canillas If the UEFI Secure Boot is enabled then the GRUB must be locked down to prevent executing code that can potentially be used to subvert its verification mechanisms. Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Kiper --- grub-core/kern/efi/init.c |

[SECURITY PATCH 000/117] Multiple GRUB2 vulnerabilities - 2021/03/02 round

2021-03-02 Thread Daniel Kiper
Hi all, The BootHole vulnerability [1][2] announced last year encouraged many people to take a closer look at the security of boot process in general and the GRUB bootloader in particular. Due to that, during past few months we were getting reports of, and also discovering various security flaws

[SECURITY PATCH 008/117] mmap: Don't register cutmem and badram commands when lockdown is enforced

2021-03-02 Thread Daniel Kiper
From: Javier Martinez Canillas The cutmem and badram commands can be used to remove EFI memory regions and potentially disable the UEFI Secure Boot. Prevent the commands to be registered if the GRUB is locked down. Fixes: CVE-2020-27779 Reported-by: Teddy Reed Signed-off-by: Javier Martinez

[SECURITY PATCH 016/117] usb: Avoid possible out-of-bound accesses caused by malicious devices

2021-03-02 Thread Daniel Kiper
From: Javier Martinez Canillas The maximum number of configurations and interfaces are fixed but there is no out-of-bound checking to prevent a malicious USB device to report large values for these and cause accesses outside the arrays' memory. Fixes: CVE-2020-25647 Reported-by: Joseph Tartaro

[SECURITY PATCH 029/117] zstd: Initialize seq_t structure fully

2021-03-02 Thread Daniel Kiper
From: Darren Kenny While many compilers will initialize this to zero, not all will, so it is better to be sure that fields not being explicitly set are at known values, and there is code that checks this fields value elsewhere in the code. Fixes: CID 292440 Signed-off-by: Darren Kenny

[SECURITY PATCH 106/117] util/mkimage: Reorder PE optional header fields set-up

2021-03-02 Thread Daniel Kiper
From: Peter Jones This makes the PE32 and PE32+ header fields set-up easier to follow by setting them closer to the initialization of their related sections. Signed-off-by: Peter Jones Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Kiper --- util/mkimage.c | 16

[SECURITY PATCH 112/117] kern/misc: Split parse_printf_args() into format parsing and va_list handling

2021-03-02 Thread Daniel Kiper
From: Thomas Frauendorfer | Miray Software This patch is preparing for a follow up patch which will use the format parsing part to compare the arguments in a printf() format from an external source against a printf() format with expected arguments. Signed-off-by: Thomas Frauendorfer | Miray

[SECURITY PATCH 080/117] fs/nilfs2: Don't search children if provided number is too large

2021-03-02 Thread Daniel Kiper
From: Daniel Axtens NILFS2 reads the number of children a node has from the node. Unfortunately, that's not trustworthy. Check if it's beyond what the filesystem permits and reject it if so. This blocks some OOB reads. I'm not sure how controllable the read is and what could be done with

[SECURITY PATCH 091/117] disk/lvm: Sanitize rlocn->offset to prevent wild read

2021-03-02 Thread Daniel Kiper
From: Daniel Axtens rlocn->offset is read directly from disk and added to the metadatabuf pointer to create a pointer to a block of metadata. It's a 64-bit quantity so as long as you don't overflow you can set subsequent pointers to point anywhere in memory. Require that rlocn->offset fits

[SECURITY PATCH 085/117] io/gzio: Zero gzio->tl/td in init_dynamic_block() if huft_build() fails

2021-03-02 Thread Daniel Kiper
From: Daniel Axtens If huft_build() fails, gzio->tl or gzio->td could contain pointers that are no longer valid. Zero them out. This prevents a double free when grub_gzio_close() comes through and attempts to free them again. Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper ---

[SECURITY PATCH 105/117] util/mkimage: Unify more of the PE32 and PE32+ header set-up

2021-03-02 Thread Daniel Kiper
From: Peter Jones There's quite a bit of code duplication in the code that sets the optional header for PE32 and PE32+. The two are very similar with the exception of a few fields that have type grub_uint64_t instead of grub_uint32_t. Factor out the common code and add a PE_OHDR() macro that

[SECURITY PATCH 108/117] util/mkimage: Refactor section setup to use a helper

2021-03-02 Thread Daniel Kiper
From: Peter Jones Add a init_pe_section() helper function to setup PE sections. This makes the code simpler and easier to read. Signed-off-by: Peter Jones Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Kiper --- util/mkimage.c | 141

Re: [SECURITY PATCH 000/117] Multiple GRUB2 vulnerabilities - 2021/03/02 round

2021-03-02 Thread John Paul Adrian Glaubitz
Hi Daniel! On 3/2/21 7:00 PM, Daniel Kiper wrote: > The BootHole vulnerability [1][2] announced last year encouraged many people > to > take a closer look at the security of boot process in general and the GRUB > bootloader in particular. Due to that, during past few months we were getting >

Re: [SECURITY PATCH 000/117] Multiple GRUB2 vulnerabilities - 2021/03/02 round

2021-03-02 Thread Bruce Dubbs
On 3/2/21 1:37 PM, John Paul Adrian Glaubitz wrote: Hi Daniel! On 3/2/21 7:00 PM, Daniel Kiper wrote: The BootHole vulnerability [1][2] announced last year encouraged many people to take a closer look at the security of boot process in general and the GRUB bootloader in particular. Due to

Re: [SECURITY PATCH 116/117] templates: Disable the os-prober by default

2021-03-02 Thread Didier Spaier
Le 02/03/2021 à 19:02, Daniel Kiper a écrit : From: Alex Burmashev diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 1b91c102f..80685b15f 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -26,7 +26,8 @@ export TEXTDOMAINDIR="@localedir@"

[SECURITY PATCH 110/117] grub-install-common: Add --sbat option

2021-03-02 Thread Daniel Kiper
From: Dimitri John Ledkov Signed-off-by: Dimitri John Ledkov Reviewed-by: Daniel Kiper --- include/grub/util/install.h | 5 - util/grub-install-common.c | 12 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/grub/util/install.h

[SECURITY PATCH 081/117] fs/nilfs2: Properly bail on errors in grub_nilfs2_btree_node_lookup()

2021-03-02 Thread Daniel Kiper
From: Daniel Axtens We just introduced an error return in grub_nilfs2_btree_node_lookup(). Make sure the callers catch it. At the same time, make sure that grub_nilfs2_btree_node_lookup() always inits the index pointer passed to it. Signed-off-by: Daniel Axtens Reviewed-by: Daniel Kiper ---

[SECURITY PATCH 099/117] kern/buffer: Add variable sized heap buffer

2021-03-02 Thread Daniel Kiper
From: Chris Coulson Add a new variable sized heap buffer type (grub_buffer_t) with simple operations for appending data, accessing the data and maintaining a read cursor. Signed-off-by: Chris Coulson Reviewed-by: Daniel Kiper --- grub-core/Makefile.core.def | 1 + grub-core/kern/buffer.c

[SECURITY PATCH 104/117] util/mkimage: Always use grub_host_to_target32() to initialize PE stack and heap stuff

2021-03-02 Thread Daniel Kiper
From: Peter Jones This change does not impact final result of initialization itself. However, it eases PE code unification in subsequent patches. Signed-off-by: Peter Jones Signed-off-by: Javier Martinez Canillas Reviewed-by: Daniel Kiper --- util/mkimage.c | 8 1 file changed, 4

[SECURITY PATCH 098/117] kern/parser: Refactor grub_parser_split_cmdline() cleanup

2021-03-02 Thread Daniel Kiper
From: Chris Coulson Introduce a common function epilogue used for cleaning up on all return paths, which will simplify additional error handling to be introduced in a subsequent commit. Signed-off-by: Chris Coulson Reviewed-by: Daniel Kiper --- grub-core/kern/parser.c | 35

Re: [SECURITY PATCH 000/117] Multiple GRUB2 vulnerabilities - 2021/03/02 round

2021-03-02 Thread Daniel Kiper
Hi Adrian, On Tue, Mar 02, 2021 at 08:37:14PM +0100, John Paul Adrian Glaubitz wrote: > Hi Daniel! > > On 3/2/21 7:00 PM, Daniel Kiper wrote: > > The BootHole vulnerability [1][2] announced last year encouraged many > > people to > > take a closer look at the security of boot process in general

Re: [PATCH] disk/pata: Suppress error message "no device connected"

2021-03-02 Thread Paul Menzel
Dear Glenn, Am 01.03.21 um 20:36 schrieb Glenn Washburn: This error message comes from the grub_print_error in grub_pata_device_initialize, which does not pass on the error, and is raised in check_device. The function check_device needs to return this as an error because check_device is also

Re: [PATCH] password: Fix backspace in username prompt

2021-03-02 Thread Egor Ignatov
I used grub_printf 3 times, because for some reason (line wrapping I guess) if you print "\b \b" at once the backspace key doesn't work on the second last character in the terminal line. The visual cursor gets stuck there and doesn't remove characters anymore, although you can still type more.

<    1   2