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

2017-01-24 Thread Andrei Borzenkov
On Wed, Jan 25, 2017 at 10:16 AM, Matthew Garrett wrote: > On Tue, Jan 24, 2017 at 10:56 PM, Andrei Borzenkov > wrote: >> On Wed, Jan 25, 2017 at 7:25 AM, Matthew Garrett wrote: >>> If prefix isn't set then won't bootfile be interpreted as the device plus >>> file? >>> >> >> No. That would mea

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

2017-01-24 Thread Matthew Garrett
On Tue, Jan 24, 2017 at 10:56 PM, Andrei Borzenkov wrote: > On Wed, Jan 25, 2017 at 7:25 AM, Matthew Garrett wrote: >> If prefix isn't set then won't bootfile be interpreted as the device plus >> file? >> > > No. That would mean "parsing URI" that I mentioned. My experience is that configfile (

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

2017-01-24 Thread Andrei Borzenkov
On Wed, Jan 25, 2017 at 7:25 AM, Matthew Garrett wrote: > On Tue, Jan 24, 2017 at 8:15 PM, Andrei Borzenkov wrote: >> 25.01.2017 07:06, Matthew Garrett пишет: >>> I don't understand - grub_net_open_real() already handles this case: >> >> Because bootfile from DHCP packet is not used to set device

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

2017-01-24 Thread Matthew Garrett
On Tue, Jan 24, 2017 at 10:18 PM, Michael Chang wrote: > On Tue, Jan 24, 2017 at 12:50:37PM -0800, Matthew Garrett wrote: >> The DHCP server will return a string in the boot_file field. If you >> want to indicate that this file should be obtained over http, the >> easiest way to handle this is to

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

2017-01-24 Thread Michael Chang
On Tue, Jan 24, 2017 at 12:50:37PM -0800, Matthew Garrett wrote: > On Mon, Jan 23, 2017 at 8:02 PM, Andrei Borzenkov wrote: > > 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 comma

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

2017-01-24 Thread Matthew Garrett
On Tue, Jan 24, 2017 at 8:15 PM, Andrei Borzenkov wrote: > 25.01.2017 07:06, Matthew Garrett пишет: >> I don't understand - grub_net_open_real() already handles this case: > > Because bootfile from DHCP packet is not used to set device part of > $prefix. Setting bootfile to (http,host)filename wil

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

2017-01-24 Thread Andrei Borzenkov
25.01.2017 07:06, Matthew Garrett пишет: > On Tue, Jan 24, 2017 at 7:48 PM, Andrei Borzenkov wrote: >> 24.01.2017 23:50, Matthew Garrett пишет: >>> On Mon, Jan 23, 2017 at 8:02 PM, Andrei Borzenkov >>> wrote: 24.01.2017 03:36, Matthew Garrett пишет: > Some DHCP servers (such as dnsmasq)

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

2017-01-24 Thread Matthew Garrett
On Tue, Jan 24, 2017 at 7:48 PM, Andrei Borzenkov wrote: > 24.01.2017 23:50, Matthew Garrett пишет: >> On Mon, Jan 23, 2017 at 8:02 PM, Andrei Borzenkov >> wrote: >>> 24.01.2017 03:36, Matthew Garrett пишет: Some DHCP servers (such as dnsmasq) tokenise parameters with commas, making it

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

2017-01-24 Thread Andrei Borzenkov
24.01.2017 23:50, Matthew Garrett пишет: > On Mon, Jan 23, 2017 at 8:02 PM, Andrei Borzenkov wrote: >> 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 >>

[PATCH v2] disk/mdraid1x: Fix >2TB RAID detection with BIOS

2017-01-24 Thread Robert LeBlanc
Changes in v2: - Only continue checking for other metadata versions if we get an out of range error and reset grub_errno if we continue. When a mdadm RAID array is on a drive larger than 2TB, the array is not able to be detected and as such even if the array has a partition that holds /boot

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

2017-01-24 Thread Matthew Garrett
On Mon, Jan 23, 2017 at 7:55 PM, Andrei Borzenkov wrote: > This was noted previously by Josef, we discussed it and my position is > that resolver code requires redesign to correctly merge multiple answers > and prioritize A vs requests. > > Do you get actual errors with current master? If yes

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

2017-01-24 Thread Matthew Garrett
On Mon, Jan 23, 2017 at 8:02 PM, Andrei Borzenkov wrote: > 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 fil

Re: [PATCH] Add fwconfig command

2017-01-24 Thread Daniel Kiper
On Mon, Jan 23, 2017 at 04:32:26PM -0800, Matthew Garrett wrote: > 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/rootde

Re: [PATCH] Add fwconfig command

2017-01-24 Thread Lennart Sorensen
On Tue, Jan 24, 2017 at 07:18:13PM +0100, Thomas Schmitt wrote: > One should emphasize that the FSF when designing new license versions only > considers compatibility to older FSF licenses if they bear the "or later" > clause. > > E.g. it is not possible to combine GPL version 2 software with LGPL

Re: [PATCH] Add fwconfig command

2017-01-24 Thread Thomas Schmitt
Hi, Colin Watson wrote: > https://www.gnu.org/licenses/gpl.html#howto One should emphasize that the FSF when designing new license versions only considers compatibility to older FSF licenses if they bear the "or later" clause. E.g. it is not possible to combine GPL version 2 software with LGPL v

Re: [PATCH] Add fwconfig command

2017-01-24 Thread Colin Watson
On Tue, Jan 24, 2017 at 11:40:57AM -0500, Konrad Rzeszutek Wilk wrote: > On Tue, Jan 24, 2017 at 04:36:03PM +, Colin Watson wrote: > > This language indicates that it's at the option of the person > > redistributing or modifying it whether they do so under the terms of > > version 3 or of some

Re: [PATCH] disk/mdraid1x: Fix >2TB RAID detection with BIOS

2017-01-24 Thread Robert LeBlanc
OK, I'll rework the patch and resubmit it. Thanks for the feedback. Robert LeBlanc PGP Fingerprint 79A2 9CA4 6CC4 45DD A904 C70E E654 3BB2 FA62 B9F1 On Tue, Jan 24, 2017 at 2:57 AM, Vladimir 'phcoder' Serbinenko wrote: > This fix is buggy as you don't reset grub_errno on this p

Re: [PATCH v2] osdep/linux: handle autofs entries in /proc/self/mountinfo

2017-01-24 Thread Andrei Borzenkov
19.01.2017 19:37, Andrei Borzenkov пишет: > These entries have placeholder for device name and so are useless for our > purpose. grub failed with something like > > grub-install: error: failed to get canonical path of `systemd-1'. > > When we see autofs entry, record it (to keep parent-child rela

Re: [PATCH] Add fwconfig command

2017-01-24 Thread Konrad Rzeszutek Wilk
On Tue, Jan 24, 2017 at 04:36:03PM +, Colin Watson wrote: > On Tue, Jan 24, 2017 at 09:52:35AM -0500, Konrad Rzeszutek Wilk wrote: > > On Mon, Jan 23, 2017 at 03:43:32PM -0800, Matthew Garrett wrote: > > > + * GRUB is free software: you can redistribute it and/or modify > > > + * it under the

Re: [PATCH] Add fwconfig command

2017-01-24 Thread Colin Watson
On Tue, Jan 24, 2017 at 09:52:35AM -0500, Konrad Rzeszutek Wilk wrote: > On Mon, Jan 23, 2017 at 03:43:32PM -0800, Matthew Garrett wrote: > > + * GRUB is free software: you can redistribute it and/or modify > > + * it under the terms of the GNU General Public License as published by > > + * the

Re: [PATCH] Add fwconfig command

2017-01-24 Thread Konrad Rzeszutek Wilk
On Mon, Jan 23, 2017 at 03:43:32PM -0800, Matthew Garrett wrote: > 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/roo

Re: [PATCH] disk/mdraid1x: Fix >2TB RAID detection with BIOS

2017-01-24 Thread Vladimir 'phcoder' Serbinenko
This fix is buggy as you don't reset grub_errno on this path. Also you probably want to ignore only a single error type GRUB_ERR_OUT_OF_RANGE as others are likely still fatal. On Wed, 11 Jan 2017, 20:26 Robert LeBlanc wrote: > Can we get this fix merged in? > > Thanks > > Robert

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

2017-01-24 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

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

2017-01-24 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] Add fwconfig command

2017-01-24 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

[PATCH 5/7] Measure the kernel commandline

2017-01-24 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

[PATCH 7/7] Measure multiboot images and modules

2017-01-24 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-24 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

Add support for TPM measurements on UEFI systems

2017-01-24 Thread Matthew Garrett
This patchset adds support for measuring grub components and commands into TPMs on UEFI systems. It supports both the original TPM and the new TPM 2.0 protocols. Grub will measure each module it loads, along with any Linux kernels and initrds, multiboot images, the command line passed to Linux and

[PATCH 3/7] Rework linux16 command

2017-01-24 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 4/4] Allow protocol to be separated from host with a semicolon

2017-01-24 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 1/7] Core TPM support

2017-01-24 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 1/4] Allow non-default ports for HTTP requests

2017-01-24 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 6/7] Measure commands

2017-01-24 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] Add efi getenv command

2017-01-24 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 2/7] Rework linux command

2017-01-24 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