Skip to contentSkip to conversation

Avoid segfault on x86-64 with invalid EFI boot entries

PATCH In review Rhidian De Wit 1 participant 3 messages Sep 1

lore
Share & tools
lore
#0 lore raw

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

---
 ...bootcurrent-is-valid-before-using-it.patch | 41 +++++++++++++++++++
 1 file changed, 41 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 +41 -0
new file mode 100644
index 0000000000..a70ab29fa0
@@ -0,0 +1,41 @@
+From 48a0c8b2e647fe34cc53a4b55a43d4106fe45735 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
+
+Upstream: https://github.com/rauc/rauc/pull/2029
+
+Signed-off-by: Rhidian De Wit <[email protected]>
+---
+ src/bootloaders/efi.c | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/src/bootloaders/efi.c b/src/bootloaders/efi.c
+index 19224118..65875c9f 100644
+--- a/src/bootloaders/efi.c
++++ b/src/bootloaders/efi.c
+@@ -625,12 +625,15 @@ 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;
++			}
+ 		}
+ 	}
+ 
+-- 
+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

---
 ...i-slot-bootname-to-avoid-double-free.patch | 43 +++++++++++++++++++
 1 file changed, 43 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 +43 -0
new file mode 100644
index 0000000000..d8a429e06f
@@ -0,0 +1,43 @@
+From 240d8ae22adea51667346854e6f863b558dfc470 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
+
+Upstream: https://github.com/rauc/rauc/pull/2028
+
+Signed-off-by: Rhidian De Wit <[email protected]>
+---
+ src/bootloaders/efi.c | 3 +--
+ test/bootchooser.c    | 1 +
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/bootloaders/efi.c b/src/bootloaders/efi.c
+index 65875c9f..e6eb0351 100644
+--- a/src/bootloaders/efi.c
++++ b/src/bootloaders/efi.c
+@@ -632,9 +632,8 @@ 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);
+ 			}
+-		}
+ 	}
+ 
+ 	g_set_error(error,
+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