Skip to contentSkip to conversation

Avoid segfault on x86-64 with invalid EFI boot entries

PATCH New Rhidian De Wit 1 participant 2 messages Sep 1

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid segfault on x86-64 with invalid EFI boot entries

Upstream: https://github.com/rauc/rauc/pull/2029

---
 ...bootcurrent-is-valid-before-using-it.patch | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/rauc/0001-Check-if-bootcurrent-is-valid-before-using-it.patch
package/rauc/0001-Check-if-bootcurrent-is-valid-before-using-it.patch new file +43 -0
new file mode 100644
index 0000000000..38fc02c5bf
@@ -0,0 +1,43 @@
+From 931d0af0f66b9afd2a7c9d9532abef1ec67b1f69 Mon Sep 17 00:00:00 2001
+From: Rhidian De Wit <[email protected]>
+Date: Mon, 24 Aug 2026 10:04:24 +0200
+Subject: [PATCH] Check if bootcurrent is valid before using it
+
+Signed-off-by: Rhidian De Wit <[email protected]>
+---
+ src/bootloaders/efi.c | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/src/bootloaders/efi.c b/src/bootloaders/efi.c
+index 19224118..6de5f73d 100644
+--- a/src/bootloaders/efi.c
++++ b/src/bootloaders/efi.c
+@@ -625,14 +625,17 @@ gchar *r_efi_get_current_bootname(RaucConfig *config, GError **error)
+ 		return NULL;
+ 	}
+ 
+-	GHashTableIter iter;
+-	g_hash_table_iter_init(&iter, config->slots);
+-	RaucSlot *slot = NULL;
+-	while (g_hash_table_iter_next(&iter, NULL, (gpointer*) &slot)) {
+-		if (g_strcmp0(slot->bootname, bootcurrent->name) == 0) {
+-			return slot->bootname;
+-		}
+-	}
++  if (bootcurrent != NULL)
++  {
++    GHashTableIter iter;
++    g_hash_table_iter_init(&iter, config->slots);
++    RaucSlot *slot = NULL;
++    while (g_hash_table_iter_next(&iter, NULL, (gpointer*) &slot)) {
++      if (g_strcmp0(slot->bootname, bootcurrent->name) == 0) {
++        return slot->bootname;
++      }
++    }
++  }
+ 
+ 	g_set_error(error,
+ 			R_BOOTCHOOSER_ERROR,
+-- 
+2.51.0
+
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/1 Avoid double-free on x86-64 systems with no cmdline set

Upstream: https://github.com/rauc/rauc/pull/2028

---
 ...i-slot-bootname-to-avoid-double-free.patch | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 package/rauc/0002-Duplicate-efi-slot-bootname-to-avoid-double-free.patch
package/rauc/0002-Duplicate-efi-slot-bootname-to-avoid-double-free.patch new file +39 -0
new file mode 100644
index 0000000000..a062844659
@@ -0,0 +1,39 @@
+From 1b17578e90b2929e1a7ed1f3eec8d3b5f663b673 Mon Sep 17 00:00:00 2001
+From: Rhidian De Wit <[email protected]>
+Date: Fri, 21 Aug 2026 16:37:45 +0200
+Subject: [PATCH] Duplicate efi slot bootname to avoid double free
+
+Signed-off-by: Rhidian De Wit <[email protected]>
+---
+ src/bootloaders/efi.c | 2 +-
+ test/bootchooser.c    | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/bootloaders/efi.c b/src/bootloaders/efi.c
+index 19224118..8b0cf820 100644
+--- a/src/bootloaders/efi.c
++++ b/src/bootloaders/efi.c
+@@ -630,7 +630,7 @@ gchar *r_efi_get_current_bootname(RaucConfig *config, GError **error)
+ 	RaucSlot *slot = NULL;
+ 	while (g_hash_table_iter_next(&iter, NULL, (gpointer*) &slot)) {
+ 		if (g_strcmp0(slot->bootname, bootcurrent->name) == 0) {
+-			return slot->bootname;
++			return g_strdup(slot->bootname);
+ 		}
+ 	}
+ 
+diff --git a/test/bootchooser.c b/test/bootchooser.c
+index 43c45397..c35a78f1 100644
+--- a/test/bootchooser.c
++++ b/test/bootchooser.c
+@@ -970,6 +970,7 @@ bootname=system1\n";
+ 
+ 	bootname = r_boot_get_current_bootname(r_context()->config, "", &error);
+ 	g_assert_nonnull(bootname);
++	g_clear_pointer(&bootname, g_free);
+ }
+ 
+ /* If the underlying 'efibootmgr --bootorder ...' call fails (e.g. the
+-- 
+2.51.0
+
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot