Petitboot: Carry build-time fixes from upstream
Some upstream fixes are still not available as a release after 1.10.4,
add them as build-time patches.
In support of that, force gettext and autoreconf on petitboot.mk since
we're touching Makefile.am files (so that we can build fine)
Summary of changes for post 1.10.4 patches:
Jeremy Kerr (15):
discover/grub2: 'search' set-variable defaults to root
discover/grub2: Use getopt for `search` argument parsing
discover/grub2: test for (ignored) --no-floppy argument
discover/grub2: Add support for UUID and label for 'search' command
discover/grub2: expose a struct for grub2 file references
discover/grub2: Add parsing code for grub2 file specifiers
discover/grub2: add support for grub2-style path specifiers in resources
discover/grub2: Allow (device)/path references in general script usage
discover/grub2: Add a reference from script to parser
discover/grub2: expose internal parse function
discover/grub2: make statements_execute non-static
discover/grub2: implement 'source' command
test/parser: Add test for recent RHCOS grub2 config
test/parser: Add RHEL8 grub config test
lib/pb-protocol: fix ordering of system info length calculation
Maxim Polyakov (3):
discover/platform-powerpc: add missing mbox block selector
discover/platform-powerpc: limit mailbox response size
discover/platform-powerpc: return the actual mailbox size
Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
diff --git a/openpower/package/petitboot/0002-discover-platform-powerpc-limit-mailbox-response-siz.patch b/openpower/package/petitboot/0002-discover-platform-powerpc-limit-mailbox-response-siz.patch
new file mode 100644
index 0000000..feecd41
--- /dev/null
+++ b/openpower/package/petitboot/0002-discover-platform-powerpc-limit-mailbox-response-siz.patch
@@ -0,0 +1,68 @@
+From 40fd13ec2c7518dc7afa67dae2cf5c460b92997c Mon Sep 17 00:00:00 2001
+From: Maxim Polyakov <m.polyakov@yadro.com>
+Date: Mon, 8 Jul 2019 12:12:59 +0300
+Subject: [PATCH 02/18] discover/platform-powerpc: limit mailbox response size
+
+The maximum size of the mailbox with Boot Initiator info is defined in
+the specification (1). The code should not extract data from the IPMI
+response message if its size exceeds the maximum limit from the
+specification.
+
+[1] page 398, IPMI Specification v2.0, Revision 1.1, October 1, 2013
+
+Signed-off-by: Maxim Polyakov <m.polyakov@yadro.com>
+(cherry picked from commit 1088a8ab532bfe008a714613497909d19bcfb8c4)
+Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
+---
+ discover/platform-powerpc.c | 31 +++++++++++++++++--------------
+ 1 file changed, 17 insertions(+), 14 deletions(-)
+
+diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
+index 6651e3f..1e33bf1 100644
+--- a/discover/platform-powerpc.c
++++ b/discover/platform-powerpc.c
+@@ -461,24 +461,27 @@ static int get_ipmi_boot_mailbox_block(struct platform_powerpc *platform,
+ return -1;
+ }
+
+- if (resp_len < sizeof(resp)) {
+- if (resp_len < 4) {
+- pb_log("platform: unexpected length (%d) in "
+- "boot options mailbox response\n",
+- resp_len);
+- return -1;
+- }
++ if (resp_len > sizeof(resp)) {
++ pb_debug("platform: invalid mailbox response size!\n");
++ return -1;
++ }
+
+- if (resp_len == 4) {
+- pb_debug_fn("block %hu empty\n", block);
+- return 0;
+- }
++ if (resp_len < 4) {
++ pb_log("platform: unexpected length (%d) in "
++ "boot options mailbox response\n",
++ resp_len);
++ return -1;
++ }
+
+- blocksize = sizeof(resp) - 4;
+- pb_debug_fn("Mailbox block %hu returns only %zu bytes in block\n",
+- block, blocksize);
++ if (resp_len == 4) {
++ pb_debug_fn("block %hu empty\n", block);
++ return 0;
+ }
+
++ blocksize = sizeof(resp) - 4;
++ pb_debug_fn("Mailbox block %hu returns only %zu bytes in block\n",
++ block, blocksize);
++
+ debug_buf = format_buffer(platform, resp, resp_len);
+ pb_debug_fn("IPMI bootdev mailbox block %hu:\n%s\n", block, debug_buf);
+ talloc_free(debug_buf);
+--
+2.17.1
+