[PATCH] Add efi getenv command

2017-01-23 Thread Matthew Garrett
Add a command to obtain the contents of EFI firmware variables. --- docs/grub.texi | 7 ++ grub-core/Makefile.core.def | 7 ++ grub-core/commands/efi/getenv.c | 153 3 files changed, 167 insertions(+) create mode 100644 grub-core/c

[PATCH] Add fwconfig command

2017-01-23 Thread Matthew Garrett
Add a command to read values from the qemu fwcfg store. This allows data to be passed from the qemu command line to grub. Example use: echo '(hd0,1)' >rootdev qemu -fw_cfg opt/rootdev,file=rootdev fwconfig opt/rootdev root --- docs/grub.texi| 6 +++ grub-core/Makefile.core.def

Misc network boot patches

2017-01-23 Thread Matthew Garrett
Various patches that we're using to support network boot in our setup. Only number 3 is a bugfix. ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel

[PATCH 1/4] Allow non-default ports for HTTP requests

2017-01-23 Thread Matthew Garrett
Add support for passing ports in HTTP requests. This takes the form of: (http,serverip:portnum)/file --- grub-core/net/http.c | 8 ++-- grub-core/net/net.c | 10 +- include/grub/net.h | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/grub-core/net/http.c b/gru

[PATCH 2/4] Send a user class identifier in bootp requests and tag it as DHCP discover

2017-01-23 Thread Matthew Garrett
It's helpful to determine that a request was sent by grub in order to permit the server to provide different information at different stages of the boot process. Send GRUB2 as a type 77 DHCP option when sending bootp packets in order to make this possible and tag the request as a DHCP discover to c

[PATCH 4/4] Allow protocol to be separated from host with a semicolon

2017-01-23 Thread Matthew Garrett
Some DHCP servers (such as dnsmasq) tokenise parameters with commas, making it impossible to pass boot files with commas in them. Allow using a semicolon to separate the protocol from host if a comma wasn't found. --- grub-core/net/net.c | 4 1 file changed, 4 insertions(+) diff --git a/grub

[PATCH 3/4] Don't allocate a new address buffer if we receive multiple DNS responses

2017-01-23 Thread Matthew Garrett
The current logic in the DNS resolution code allocates an address buffer based on the number of addresses in the response packet. If we receive multiple response packets in response to a single query packet, this means that we will reallocate a new buffer large enough for only the addresses in that

Support for TPM measurements on UEFI systems

2017-01-23 Thread Matthew Garrett
This patchset adds support for measuring components of grub and what it's loading into the TPM. It supports both TPM 1.2 and 2.0 devices via the standard UEFI protocols. ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listin

[PATCH 2/7] Rework linux command

2017-01-23 Thread Matthew Garrett
We want a single buffer that contains the entire kernel image in order to perform a TPM measurement. Allocate one and copy the entire kernel into it before pulling out the individual blocks later on. --- grub-core/loader/i386/linux.c | 34 +- 1 file changed, 21 inse

[PATCH 1/7] Core TPM support

2017-01-23 Thread Matthew Garrett
Add support for performing basic TPM measurements. Right now this only supports extending PCRs statically and only on UEFI and BIOS systems, but will measure all modules as they're loaded. --- grub-core/Makefile.am| 1 + grub-core/Makefile.core.def | 3 + grub-core/kern/dl.c

[PATCH 7/7] Measure multiboot images and modules

2017-01-23 Thread Matthew Garrett
--- grub-core/loader/i386/multiboot_mbi.c | 4 grub-core/loader/multiboot.c | 3 +++ grub-core/loader/multiboot_mbi2.c | 4 3 files changed, 11 insertions(+) diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c index fd7b41b..42372bf 1

[PATCH 4/7] Measure kernel and initrd

2017-01-23 Thread Matthew Garrett
Measure the kernel and initrd at load time --- grub-core/loader/i386/linux.c| 6 ++ grub-core/loader/i386/pc/linux.c | 4 grub-core/loader/linux.c | 3 +++ 3 files changed, 13 insertions(+) diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c index 5e54e

[PATCH 3/7] Rework linux16 command

2017-01-23 Thread Matthew Garrett
We want a single buffer that contains the entire kernel image in order to perform a TPM measurement. Allocate one and copy the entire kernel int it before pulling out the individual blocks later on. --- grub-core/loader/i386/pc/linux.c | 34 +- 1 file changed, 21 in

[PATCH 6/7] Measure commands

2017-01-23 Thread Matthew Garrett
From: Matthew Garrett Measure each command executed by grub, which includes script execution. --- grub-core/script/execute.c | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c index a8502d9..cf994

[PATCH 5/7] Measure the kernel commandline

2017-01-23 Thread Matthew Garrett
Measure the kernel commandline to ensure that it hasn't been modified --- grub-core/lib/cmdline.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grub-core/lib/cmdline.c b/grub-core/lib/cmdline.c index d5e10ee..055b7aa 100644 --- a/grub-core/lib/cmdline.c +++ b/grub-core/l

Re: [PATCH] Add efi getenv command

2017-01-23 Thread SevenBits
As someone who wrote a similar patch several years ago for a personal project and submitted it to the list, what's the advantage of this patch over the previous ones that have been submitted (other than, I believe, the ability to set the GUID)? On Mon, Jan 23, 2017 at 7:25 PM Matthew Garrett wrot

Re: Support for TPM measurements on UEFI systems

2017-01-23 Thread Vladimir 'phcoder' Serbinenko
For policy reasons we can't put any TPM code into GNU project. Can we use verifiers framework for this rather than custom hooks? This would allow your code to be a single module that can be put into a separate repo rather than a complex patch set. Verifiers framework is in separate branch verifiers

Re: Why is stdint.h so little used?

2017-01-23 Thread Vladimir 'phcoder' Serbinenko
All files in posix_wrap are only for porting code to GRUB with little modification. No GRUB-specific code should use it. On Wed, 30 Nov 2016, 13:17 Bjørn Forsman wrote: > Hi all, > > I see that grub has an stdint.h header in > grub-core/lib/posix_wrap/stdint.h. But hardly any code use it. Why is

Re: Support for TPM measurements on UEFI systems

2017-01-23 Thread Matthew Garrett
On Mon, Jan 23, 2017 at 5:29 PM, Vladimir 'phcoder' Serbinenko wrote: > For policy reasons we can't put any TPM code into GNU project. Can we use > verifiers framework for this rather than custom hooks? This would allow your > code to be a single module that can be put into a separate repo rather

Re: Unreachable code in mkimagexx (Fwd: New Defects reported by Coverity Scan for GRUB)

2017-01-23 Thread Vladimir 'phcoder' Serbinenko
They're used only for arm (32-bit). So they don't need to work for 64-bit. On Mon, 14 Mar 2016, 10:01 Andrei Borzenkov wrote: > On Sun, Mar 13, 2016 at 10:38 AM, Andrei Borzenkov > wrote: > > > > We probably need to #ifdef this section for MKIMAGE_ELF64 case only, it > > makes no sense to compi

Re: Support for TPM measurements on UEFI systems

2017-01-23 Thread Vladimir 'phcoder' Serbinenko
Ok. Good. Still, can we use verifiers framework ? We can adjust it if needed. Also it's still post-release material On Tue, 24 Jan 2017, 04:34 Matthew Garrett wrote: > On Mon, Jan 23, 2017 at 5:29 PM, Vladimir 'phcoder' Serbinenko > wrote: > > For policy reasons we can't put any TPM code into G

Re: Support for TPM measurements on UEFI systems

2017-01-23 Thread Matthew Garrett
On Mon, Jan 23, 2017 at 6:03 PM, Vladimir 'phcoder' Serbinenko wrote: > Ok. Good. Still, can we use verifiers framework ? We can adjust it if > needed. Also it's still post-release material Where's the branch? I wasn't able to find it on Savannah. ___

Re: [PATCH 3/4] Don't allocate a new address buffer if we receive multiple DNS responses

2017-01-23 Thread Andrei Borzenkov
24.01.2017 03:36, Matthew Garrett пишет: > The current logic in the DNS resolution code allocates an address buffer > based on the number of addresses in the response packet. If we receive > multiple response packets in response to a single query packet, this means > that we will reallocate a new b

Re: [PATCH 4/4] Allow protocol to be separated from host with a semicolon

2017-01-23 Thread Andrei Borzenkov
24.01.2017 03:36, Matthew Garrett пишет: > Some DHCP servers (such as dnsmasq) tokenise parameters with commas, making > it impossible to pass boot files with commas in them. Allow using a grub_net_open() operates on devices, not files. Please give more details about your problem. > semicolon to

Re: [PATCH 2/4] Send a user class identifier in bootp requests and tag it as DHCP discover

2017-01-23 Thread Michael Marineau
On Mon, Jan 23, 2017 at 4:35 PM, Matthew Garrett wrote: > It's helpful to determine that a request was sent by grub in order to permit > the server to provide different information at different stages of the boot > process. Send GRUB2 as a type 77 DHCP option when sending bootp packets in > order

Re: Why is stdint.h so little used?

2017-01-23 Thread Bjørn Forsman
On 24 January 2017 at 02:33, Vladimir 'phcoder' Serbinenko wrote: > All files in posix_wrap are only for porting code to GRUB with little > modification. No GRUB-specific code should use it. That only explains half of it :-) What is better about writing grub_uint32_t instead of uint32_t? (To me

Re: Why is stdint.h so little used?

2017-01-23 Thread Andrei Borzenkov
On Tue, Jan 24, 2017 at 10:08 AM, Bjørn Forsman wrote: > On 24 January 2017 at 02:33, Vladimir 'phcoder' Serbinenko > wrote: >> All files in posix_wrap are only for porting code to GRUB with little >> modification. No GRUB-specific code should use it. > > That only explains half of it :-) > > Wha