From 72ec399ad8d6348b6c74ea63d80c79784c8b84ae Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Mon, 3 Nov 2014 16:27:45 +0800 Subject: [PATCH 1/4] icmp6 fix no respond to neighbor solicit message The structure size used in grub_netbuff_pull to get the pointer to option header is apparently wrong, which leads to subsequent range check failed and therefore not responding to any neighbor solicit message in my testing. --- ChangeLog | 5 +++++ grub-core/net/icmp6.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 190d19d9b..87faadf48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-11-03 Michael Chang + + * grub-core/net/icmp6.c (grub_net_recv_icmp6_packet): Fix size + of neighbor solicitation packet in grub_netbuff_pull. + 2014-10-14 Andrei Borzenkov * grub-core/loader/arm/linux.c: Use full initializer for initrd_ctx to diff --git a/grub-core/net/icmp6.c b/grub-core/net/icmp6.c index bbc902014..796d549f6 100644 --- a/grub-core/net/icmp6.c +++ b/grub-core/net/icmp6.c @@ -205,7 +205,7 @@ grub_net_recv_icmp6_packet (struct grub_net_buff *nb, if (ttl != 0xff) break; nbh = (struct neighbour_solicit *) nb->data; - err = grub_netbuff_pull (nb, sizeof (struct router_adv)); + err = grub_netbuff_pull (nb, sizeof (*nbh)); if (err) { grub_netbuff_free (nb); From 004a2b1efdd782cf946387d2060ad9250d61c435 Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Mon, 17 Nov 2014 14:11:01 +0000 Subject: [PATCH 2/4] efi: check *path non-null before grub_strrchr The EFI version of grub_machine_get_bootlocation crops the boot image name back to the last / in order to get a directory path. However, it does not check that *name is actually set before calling grub_strrchr to do this, and neither does grub_strrchr before dereferencing a NULL pointer. Parent function, grub_set_prefix_and_root, does check the pointer before using. --- ChangeLog | 5 +++++ grub-core/kern/efi/init.c | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 87faadf48..07d06465d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-01-07 Leif Lindholm + + * grub-core/kern/efi/init.c: check value of *path before + dereferencing. + 2014-11-03 Michael Chang * grub-core/net/icmp6.c (grub_net_recv_icmp6_packet): Fix size diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c index 942ab0256..e9c85de12 100644 --- a/grub-core/kern/efi/init.c +++ b/grub-core/kern/efi/init.c @@ -63,10 +63,13 @@ grub_machine_get_bootlocation (char **device, char **path) if (!*device && grub_efi_net_config) grub_efi_net_config (image->device_handle, device, path); - /* Get the directory. */ - p = grub_strrchr (*path, '/'); - if (p) - *p = '\0'; + if (*path) + { + /* Get the directory. */ + p = grub_strrchr (*path, '/'); + if (p) + *p = '\0'; + } } void From 2ccaa3b9fdc3e71e9e2e68acfa3054233a2a30b2 Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Thu, 20 Nov 2014 20:54:49 +0300 Subject: [PATCH 3/4] Fix date in last ChangeLog entry --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 07d06465d..b86feea8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2014-01-07 Leif Lindholm +2014-11-07 Leif Lindholm * grub-core/kern/efi/init.c: check value of *path before dereferencing. From e2dd6daa8c33e3e7641e442dc269fcca479c6fda Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Thu, 20 Nov 2014 20:56:51 +0300 Subject: [PATCH 4/4] grub-fs-tester: consistently print output of grub ls if test fails --- ChangeLog | 5 +++++ tests/util/grub-fs-tester.in | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index b86feea8d..6fbec061d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-11-20 Andrei Borzenkov + + * tests/util/grub-fs-tester.in: Consistently print output + of grub ls if test fails. + 2014-11-07 Leif Lindholm * grub-core/kern/efi/init.c: check value of *path before diff --git a/tests/util/grub-fs-tester.in b/tests/util/grub-fs-tester.in index 669527a90..565692725 100644 --- a/tests/util/grub-fs-tester.in +++ b/tests/util/grub-fs-tester.in @@ -1065,6 +1065,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + : else echo NLIST FAIL + echo "$LSROUT" TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -lA "$MNTPOINTRO" exit 1 fi @@ -1082,6 +1083,7 @@ for ((LOGSECSIZE=MINLOGSECSIZE;LOGSECSIZE<=MAXLOGSECSIZE;LOGSECSIZE=LOGSECSIZE + : else echo LONG LIST FAIL + echo "$LSROUT" TZ=UTC ls --time-style=+%Y%m%d%H%M%S.%N -l "$MNTPOINTRO" exit 1 fi