Re: [PATCH 9/9] grub-shell: Explicitly specify firmware for i386-ieee1275

2024-09-19 Thread Glenn Washburn
On Wed, 11 Sep 2024 12:37:35 +0300 Vladimir Serbinenko wrote: > Signed-off-by: Vladimir Serbinenko > --- > tests/util/grub-shell.in | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in > index 4b0900a32..de1eba83e 100644 > --- a/tes

Re: [PATCH 07/24] mmap: Add grub_mmap_get_lowest() and grub_mmap_get_highest()

2024-09-19 Thread Sergii Dmytruk
Sent 0-7 and part of 11 separately taking all the comments into account: https://lists.gnu.org/archive/html/grub-devel/2024-09/msg00194.html Regards, Sergii On Tue, Sep 17, 2024 at 11:06:51AM -0700, Ross Philipson via Grub-devel wrote: > On 8/26/24 5:44 AM, Sergii Dmytruk wrote: > > From: Da

Re: [PATCH 07/24] mmap: Add grub_mmap_get_lowest() and grub_mmap_get_highest()

2024-09-19 Thread Ross Philipson via Grub-devel
On 9/19/24 3:23 PM, Sergii Dmytruk wrote: Sent 0-7 and part of 11 separately taking all the comments into account: https://lists.gnu.org/archive/html/grub-devel/2024-09/msg00194.html Great thanks. I will look them over, thanks for doing that. This should make them easy to get in. Ross

Re: [PATCH 1/9] grub-shell: Support riscv64-efi

2024-09-19 Thread Glenn Washburn
On Wed, 11 Sep 2024 12:37:27 +0300 Vladimir Serbinenko wrote: > Signed-off-by: Vladimir Serbinenko > --- > tests/util/grub-shell.in | 43 +++- > 1 file changed, 42 insertions(+), 1 deletion(-) > > diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell

Re: [PATCH 6/9] cmd_set_date: Ignore garbage line at shutdown

2024-09-19 Thread Glenn Washburn
On Wed, 11 Sep 2024 12:37:32 +0300 Vladimir Serbinenko wrote: > Fedora arm-efi and riscv64-efi are verbose and add a garbage line > when shutting down. Ignore it Shouldn't the trim_tail modifications in patch 1 and 5 obviate the need for this? And why is the text being tested changed? I presume

[PATCH v2 3/8] i386/msr: Extract and improve MSR support detection code

2024-09-19 Thread Sergii Dmytruk
From: Daniel Kiper Currently rdmsr and wrmsr commands have own MSR support detection code. This code is the same. So, it is duplicated. Additionally, this code cannot be reused by others. Hence, extract this code to a function and make it public. By the way, improve a code a bit. Additionally, u

[PATCH v2 2/8] i386/msr: Rename grub_msr_read() and grub_msr_write()

2024-09-19 Thread Sergii Dmytruk
From: Daniel Kiper Use more obvious names which match corresponding instructions: * grub_msr_read() => grub_rdmsr() * grub_msr_write() => grub_wrmsr() Signed-off-by: Daniel Kiper Signed-off-by: Sergii Dmytruk --- grub-core/commands/i386/rdmsr.c | 2 +- grub-core/commands/i386/wrmsr.c | 2 +

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

2024-09-19 Thread Sergii Dmytruk
From: Ross Philipson Signed-off-by: Ross Philipson Signed-off-by: Daniel Kiper Signed-off-by: Krystian Hebel Signed-off-by: Sergii Dmytruk --- include/grub/i386/cpuid.h | 11 include/grub/i386/crfr.h | 127 ++ include/grub/i386/mmio.h | 72 +++

[PATCH v2 4/8] i386/memory: Rename PAGE_SHIFT to GRUB_PAGE_SHIFT

2024-09-19 Thread Sergii Dmytruk
From: Daniel Kiper This fixes naming inconsistency that goes against coding style as well as helps to avoid potential conflicts and confusion. Signed-off-by: Daniel Kiper Signed-off-by: Sergii Dmytruk --- grub-core/lib/i386/xen/relocator.S | 6 +++--- grub-core/lib/x86_64/xen/relocator.S |

[PATCH v2 5/8] i386/memory: Rename PAGE_SIZE to GRUB_PAGE_SIZE and make it global

2024-09-19 Thread Sergii Dmytruk
From: Daniel Kiper Subsequent patches will use that constant. Signed-off-by: Daniel Kiper Signed-off-by: Sergii Dmytruk --- grub-core/loader/i386/xen.c | 35 +-- include/grub/i386/memory.h | 1 + 2 files changed, 18 insertions(+), 18 deletions(-) diff --git

[PATCH v2 1/8] i386/msr: Merge rdmsr.h and wrmsr.h into msr.h

2024-09-19 Thread Sergii Dmytruk
From: Daniel Kiper It does not make sense to have separate headers for individual static functions. Additionally, we have to add some constants with MSR addresses in subsequent patches. So, make one common place to store them. Signed-off-by: Daniel Kiper Signed-off-by: Sergii Dmytruk --- grub

[PATCH v2 0/8] i386: memory/MSR/CR code updates

2024-09-19 Thread Sergii Dmytruk
Hi, These are generally useful x86-related changes which were originally posted as part of DRTM patchset [0]. This version took comments there into account, hence v2. The changes can also be viewed on GitHub [1]. Best regards, Sergii [0]: https://lists.gnu.org/archive/html/grub-devel/2024-08/m

[PATCH v2 6/8] i386/memory: Define GRUB_PAGE_MASK constant and GRUB_PAGE_{UP, DOWN} macros

2024-09-19 Thread Sergii Dmytruk
From: Krystian Hebel Subsequent patches will use those macros and constant. Signed-off-by: Krystian Hebel Signed-off-by: Sergii Dmytruk --- include/grub/i386/memory.h | 5 + 1 file changed, 5 insertions(+) diff --git a/include/grub/i386/memory.h b/include/grub/i386/memory.h index c645296

[PATCH v2 7/8] mmap: Add grub_mmap_get_lowest() and grub_mmap_get_highest()

2024-09-19 Thread Sergii Dmytruk
From: Daniel Kiper The functions calculate lowest and highest available RAM addresses respectively. Signed-off-by: Daniel Kiper Signed-off-by: Sergii Dmytruk --- grub-core/mmap/mmap.c | 83 +++ include/grub/memory.h | 3 ++ 2 files changed, 86 insertio

Re: [PATCH v19 22/33] key_protector: Add TPM2 Key Protector

2024-09-19 Thread Gary Lin via Grub-devel
On Thu, Sep 19, 2024 at 11:05:13AM -0400, Stefan Berger wrote: > > > On 9/19/24 3:45 AM, Gary Lin wrote: > > On Wed, Sep 18, 2024 at 11:22:16AM -0400, Stefan Berger wrote: > > > > > > > > > > *handle = (TPM_HANDLE_t) num; > > > > > How about this change? > > > > - return grub_error (GRUB

Re: [PATCH v19 00/33] Automatic Disk Unlock with TPM2

2024-09-19 Thread Gary Lin via Grub-devel
On Mon, Sep 16, 2024 at 01:42:18PM -0400, Stefan Berger wrote: > > > On 9/15/24 11:35 PM, Gary Lin wrote: > > On Mon, Sep 16, 2024 at 10:24:03AM +0800, Gary Lin wrote: > > > On Fri, Sep 13, 2024 at 10:32:39AM -0400, Stefan Berger wrote: > > > > > > > > > > > > On 9/6/24 5:10 AM, Gary Lin wrote:

Re: [PATCH v19 22/33] key_protector: Add TPM2 Key Protector

2024-09-19 Thread Gary Lin via Grub-devel
On Wed, Sep 18, 2024 at 11:22:16AM -0400, Stefan Berger wrote: > > > On 9/6/24 5:11 AM, Gary Lin via Grub-devel wrote: > > From: Hernan Gatta > > > > The TPM2 key protector is a module that enables the automatic retrieval > > of a fully-encrypted disk's unlocking key from a TPM 2.0. > > > > Th

Re: [PATCH v19 22/33] key_protector: Add TPM2 Key Protector

2024-09-19 Thread Stefan Berger
On 9/19/24 3:45 AM, Gary Lin wrote: On Wed, Sep 18, 2024 at 11:22:16AM -0400, Stefan Berger wrote: *handle = (TPM_HANDLE_t) num; How about this change? - return grub_error (GRUB_ERR_OUT_OF_RANGE, "Value %lu is too large to be a TPM handle, TPM handles are unsigned 32-bit integers"

[PATCH v6 02/10] modules: strip .llvm_addrsig sections and similar.

2024-09-19 Thread Mate Kukri
From: Peter Jones Currently grub modules built with clang or gcc have several sections which we don't actually need or support. We already have a list of section to skip in genmod.sh, and this patch adds the following sections to that list (as well as a few newlines): .note.gnu.property .llvm*

[PATCH v6 04/10] modules: load module sections at page-aligned addresses

2024-09-19 Thread Mate Kukri
Currently we load module sections at whatever alignment gcc+ld happened to dump into the ELF section header, which is often less then the page size. Since NX protections are page based, this alignment must be rounded up to page size on platforms supporting NX protections. This patch switches most

[PATCH v6 03/10] modules: Don't allocate space for non-allocable sections.

2024-09-19 Thread Mate Kukri
From: Peter Jones Currently when loading grub modules, we allocate space for all sections, including those without SHF_ALLOC set. We then copy the sections that /do/ have SHF_ALLOC set into the allocated memory, leaving some of our allocation untouched forever. Additionally, on platforms with G

[PATCH v6 06/10] nx: set page permissions for loaded modules.

2024-09-19 Thread Mate Kukri
For NX, we need to set write and executable permissions on the sections of grub modules when we load them. On sections with SHF_ALLOC set, which is typically everything except .modname and the symbol and string tables, this patch clears the Read Only flag on sections that have the ELF flag SHF_WRI

[PATCH v6 09/10] efi: Use shim's loader protocol for EFI image verification and loading

2024-09-19 Thread Mate Kukri
Signed-off-by: Mate Kukri --- grub-core/kern/efi/sb.c | 39 +--- grub-core/loader/efi/linux.c | 16 --- include/grub/efi/api.h | 5 + include/grub/efi/efi.h | 19 +++--- include/grub/efi/sb.h| 3 --- 5 files ch

[PATCH v6 08/10] efi: Provide wrappers for load_image, start_image, unload_image

2024-09-19 Thread Mate Kukri
From: Julian Andres Klode These can be used to register a different implementation later, for example, when shim provides a protocol with those functions. Signed-off-by: Mate Kukri --- grub-core/kern/efi/efi.c | 57 ++ grub-core/loader/efi/chainloader.c |

[PATCH v6 07/10] nx: set the nx compatible flag in EFI GRUB images

2024-09-19 Thread Mate Kukri
For NX, we need the GRUB binary to announce that it is compatible with the NX feature. This implies that when loading the executable GRUB image, several attributes are true: - the binary doesn't need an executable stack - the binary doesn't need sections to be both executable and writable - the b

[PATCH v6 01/10] modules: make .module_license read-only

2024-09-19 Thread Mate Kukri
From: Peter Jones Currently .module_license is set writable (that is, the section has the SHF_WRITE flag set) in the module's ELF headers. This probably never actually matters, but it can't possibly be correct. This patch sets that data as "const", which causes that flag not to be set. Signed-

[PATCH v6 05/10] nx: add memory attribute get/set API

2024-09-19 Thread Mate Kukri
For NX, we need to set the page access permission attributes for write and execute permissions. This patch adds two new primitives, grub_set_mem_attrs() and grub_clear_mem_attrs(), and associated constant definitions, to be used for that purpose. For most platforms, it adds a dummy implementation

[PATCH v6 00/10] UEFI NX support and NX Linux loader using shim loader protocol

2024-09-19 Thread Mate Kukri
This consists of: - Derivative of Fedora NX patches to make GRUB itself work under NX. - Julian Andres Klode's loader framework patch (used in Debian and Ubuntu for the downstream loader). - Shim loader protocol integration using the above loader framework. - Check to disallow using the legacy Lin

[PATCH v6 10/10] efi: Disallow fallback to legacy Linux loader when shim says NX is required.

2024-09-19 Thread Mate Kukri
Signed-off-by: Mate Kukri --- grub-core/kern/efi/sb.c | 28 grub-core/loader/efi/linux.c | 12 +++- include/grub/efi/api.h | 2 ++ include/grub/efi/sb.h| 2 ++ 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/grub-core/kern/