Merge ~xnox/grub:do-not-finalize-twice into ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 5649e23f82323d7113813c612216a82d7e10222e
Proposed branch: ~xnox/grub:do-not-finalize-twice
Merge into: ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu
Diff against target: 125 lines (+22/-16)
5 files modified
debian/.git-dpm (+2/-2)
debian/changelog (+1/-0)
debian/patches/ubuntu-dejavu-font-path.patch (+1/-1)
debian/patches/ubuntu-linuxefi-arm64.patch (+18/-10)
grub-core/loader/arm64/linux.c (+0/-3)
Reviewer Review Type Date Requested Status
Julian Andres Klode Approve
Łukasz Zemczak Approve
Review via email: mp+391700@code.launchpad.net

Commit message

grub_err_t
grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
{
...
  retval = finalize_params_linux ();
...
}

static grub_err_t
grub_linux_boot (void)
{
  if (finalize_params_linux () != GRUB_ERR_NONE)
    return grub_errno;

  return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,
                                          kernel_size, linux_args));
}

Calling finalize_params_linux () twice doesn't do anything good. Drop calling that in grub_linux_boot, since grub_arch_efi_linux_boot_image calls that already.

As we have observed loading fdt twice, corrupts things, on certain hardware.

To post a comment you must log in.
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Oh! Ok, looking at the code, this new change makes sense. Since I see Julian already does finalize_params_linux () in grub_arch_efi_linux_boot_image() indeed. I feel like this fix is very straightforward.

review: Approve
Revision history for this message
Julian Andres Klode (juliank) wrote :

Sounds right

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/.git-dpm b/debian/.git-dpm
2index fa79372..63f5a6e 100644
3--- a/debian/.git-dpm
4+++ b/debian/.git-dpm
5@@ -1,6 +1,6 @@
6 # see git-dpm(1) from git-dpm package
7-de16b027e2e63f3ef4852fff6433bd009a364731
8-de16b027e2e63f3ef4852fff6433bd009a364731
9+26335cb229a6b969449f80dc6c5aed949ee1d86c
10+26335cb229a6b969449f80dc6c5aed949ee1d86c
11 578bb115fbd47e1c464696f1f8d6183e5443975d
12 578bb115fbd47e1c464696f1f8d6183e5443975d
13 grub2_2.04.orig.tar.xz
14diff --git a/debian/changelog b/debian/changelog
15index 3d6e540..3b0ce0a 100644
16--- a/debian/changelog
17+++ b/debian/changelog
18@@ -3,6 +3,7 @@ grub2 (2.04-1ubuntu35) UNRELEASED; urgency=medium
19 * postinst.in, grub-multi-install: fix logic of skipping installing onto
20 any device, if one chose to not install bootloader on any device. LP:
21 #1896608
22+ * Do not finalize params twice on arm64. LP: #1897819
23
24 -- Dimitri John Ledkov <xnox@ubuntu.com> Mon, 28 Sep 2020 14:05:26 +0100
25
26diff --git a/debian/patches/ubuntu-dejavu-font-path.patch b/debian/patches/ubuntu-dejavu-font-path.patch
27index 539ce34..1faea8d 100644
28--- a/debian/patches/ubuntu-dejavu-font-path.patch
29+++ b/debian/patches/ubuntu-dejavu-font-path.patch
30@@ -1,4 +1,4 @@
31-From de16b027e2e63f3ef4852fff6433bd009a364731 Mon Sep 17 00:00:00 2001
32+From 26335cb229a6b969449f80dc6c5aed949ee1d86c Mon Sep 17 00:00:00 2001
33 From: Dimitri John Ledkov <xnox@ubuntu.com>
34 Date: Mon, 14 Sep 2020 10:51:32 +0100
35 Subject: configure.ac: one more dejavu font search path
36diff --git a/debian/patches/ubuntu-linuxefi-arm64.patch b/debian/patches/ubuntu-linuxefi-arm64.patch
37index 6086de2..dd7c9e9 100644
38--- a/debian/patches/ubuntu-linuxefi-arm64.patch
39+++ b/debian/patches/ubuntu-linuxefi-arm64.patch
40@@ -1,4 +1,4 @@
41-From ea1b168fb36e6819f9ad435d16d9dd2f91d75b42 Mon Sep 17 00:00:00 2001
42+From f38282a2ced47589ab05b2184a57d87cbbd7db40 Mon Sep 17 00:00:00 2001
43 From: Julian Andres Klode <julian.klode@canonical.com>
44 Date: Fri, 11 Sep 2020 11:28:08 +0200
45 Subject: Cherry-pick back parts of "Load arm with SB enabled."
46@@ -13,11 +13,11 @@ Bug-Ubuntu: https://bugs.launchpad.net/1862279
47 Origin: vendor, https://github.com/rhboot/grub2/commit/2786ab864cf00c15123320671f653e9a36ba12b4
48 Patch-Name: ubuntu-linuxefi-arm64.patch
49 ---
50- grub-core/loader/arm64/linux.c | 103 ++++++++++++++++++---------------
51- 1 file changed, 56 insertions(+), 47 deletions(-)
52+ grub-core/loader/arm64/linux.c | 106 +++++++++++++++++----------------
53+ 1 file changed, 56 insertions(+), 50 deletions(-)
54
55 diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
56-index 3f5496fc55..39ebcf5b52 100644
57+index 3f5496fc55..130e9c09b4 100644
58 --- a/grub-core/loader/arm64/linux.c
59 +++ b/grub-core/loader/arm64/linux.c
60 @@ -43,6 +43,8 @@ static int loaded;
61@@ -67,7 +67,7 @@ index 3f5496fc55..39ebcf5b52 100644
62 return GRUB_ERR_NONE;
63
64 failure:
65-@@ -118,62 +142,43 @@ failure:
66+@@ -118,70 +142,48 @@ failure:
67 return grub_error(GRUB_ERR_BAD_OS, "failed to install/update FDT");
68 }
69
70@@ -107,12 +107,12 @@ index 3f5496fc55..39ebcf5b52 100644
71 - mempath[0].memory_type = GRUB_EFI_LOADER_DATA;
72 - mempath[0].start_address = addr;
73 - mempath[0].end_address = addr + size;
74--
75++ grub_err_t retval;
76+
77 - mempath[1].header.type = GRUB_EFI_END_DEVICE_PATH_TYPE;
78 - mempath[1].header.subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
79 - mempath[1].header.length = sizeof (grub_efi_device_path_t);
80-+ grub_err_t retval;
81-
82+-
83 - b = grub_efi_system_table->boot_services;
84 - status = b->load_image (0, grub_efi_image_handle,
85 - (grub_efi_device_path_t *) mempath,
86@@ -157,7 +157,15 @@ index 3f5496fc55..39ebcf5b52 100644
87 }
88
89 static grub_err_t
90-@@ -297,6 +302,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
91+ grub_linux_boot (void)
92+ {
93+- if (finalize_params_linux () != GRUB_ERR_NONE)
94+- return grub_errno;
95+-
96+ return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,
97+ kernel_size, linux_args));
98+ }
99+@@ -297,6 +299,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
100 {
101 grub_file_t file = 0;
102 struct linux_arch_kernel_header lh;
103@@ -165,7 +173,7 @@ index 3f5496fc55..39ebcf5b52 100644
104 grub_err_t err;
105 int rc;
106
107-@@ -354,6 +360,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
108+@@ -354,6 +357,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
109 }
110 }
111
112diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
113index 39ebcf5..130e9c0 100644
114--- a/grub-core/loader/arm64/linux.c
115+++ b/grub-core/loader/arm64/linux.c
116@@ -184,9 +184,6 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, grub_size_t size, char *args)
117 static grub_err_t
118 grub_linux_boot (void)
119 {
120- if (finalize_params_linux () != GRUB_ERR_NONE)
121- return grub_errno;
122-
123 return (grub_arch_efi_linux_boot_image((grub_addr_t)kernel_addr,
124 kernel_size, linux_args));
125 }

Subscribers

People subscribed via source and target branches