Compare commits

..

No commits in common. "0ee3e16f0e1da572dcc5fa95a7689ed15e61ea29" and "983551687bea41a6752320f452f817f2c0c5981d" have entirely different histories.

10 changed files with 75 additions and 168 deletions

BIN
18.tar.gz

Binary file not shown.

View File

@ -1,26 +0,0 @@
From b0f81089481c10af6e6ac404755830fefee60e93 Mon Sep 17 00:00:00 2001
From: kamillo <kamilgolunski@gmail.com>
Date: Fri, 17 Feb 2023 21:55:17 +0100
Subject: [PATCH] Add missing short option handling for --index (-I)
Signed-off-by: kamillo <kamilgolunski@gmail.com>
---
src/efibootmgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
index 4b15d6d..255f61f 100644
--- a/src/efibootmgr.c
+++ b/src/efibootmgr.c
@@ -1509,7 +1509,7 @@ parse_opts(int argc, char **argv)
};
c = getopt_long(argc, argv,
- "aAb:BcCd:De:E:fFgi:kl:L:m:M:n:No:Op:qrt:Tuv::Vwy@:h",
+ "aAb:BcCd:De:E:fFgi:I:kl:L:m:M:n:No:Op:qrt:Tuv::Vwy@:h",
long_options, &option_index);
if (c == -1)
break;
--
2.27.0

View File

@ -1,31 +0,0 @@
From 4a8d9c69050bd01a0be66695fea3b35b72f5a425 Mon Sep 17 00:00:00 2001
From: kamillo <kamilgolunski@gmail.com>
Date: Fri, 17 Feb 2023 22:02:22 +0100
Subject: [PATCH] Fix segfault when passed --index is greater than current
boot order size
Size of the order entry size (uint16_t) hasn't been taken into account for all calculations and caused memory corruption.
Signed-off-by: kamillo <kamilgolunski@gmail.com>
---
src/efibootmgr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
index 255f61f..ded21a1 100644
--- a/src/efibootmgr.c
+++ b/src/efibootmgr.c
@@ -420,8 +420,8 @@ add_to_order(const char *name, uint16_t num, uint16_t insert_at)
return -1;
if (insert_at != 0) {
- if (insert_at > order->data_size)
- insert_at = order->data_size;
+ if (insert_at * sizeof(uint16_t) > order->data_size)
+ insert_at = order->data_size / sizeof(uint16_t);
memcpy(new_data, old_data, insert_at * sizeof(uint16_t));
}
new_data[insert_at] = num;
--
2.27.0

View File

@ -1,25 +0,0 @@
From af5b168d1ca205d9fee20142cf9d0d47962a2a0b Mon Sep 17 00:00:00 2001
From: century6 <zhangqiumiao1@huawei.com>
Date: Fri, 3 Nov 2023 11:22:12 +0800
Subject: [PATCH] Fix the incorrect long parameter in help messages
- fix the incorrect long parameter of --device
Signed-off-by: Qiumiao Zhang <zhangqiumiao1@huawei.com>
---
src/efibootmgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
index 7e8cdab..b35fcf4 100644
--- a/src/efibootmgr.c
+++ b/src/efibootmgr.c
@@ -1404,7 +1404,7 @@ usage()
printf("\t-d | --disk disk Disk containing boot loader (defaults to /dev/sda).\n");
printf("\t-D | --remove-dups Remove duplicate values from BootOrder.\n");
printf("\t-e | --edd [1|3] Force boot entries to be created using EDD 1.0 or 3.0 info.\n");
- printf("\t-E | --device num EDD 1.0 device number (defaults to 0x80).\n");
+ printf("\t-E | --edd-device num EDD 1.0 device number (defaults to 0x80).\n");
printf("\t --full-dev-path Use a full device path.\n");
printf("\t --file-dev-path Use an abbreviated File() device path.\n");
printf("\t-f | --reconnect Re-connect devices after driver is loaded.\n");

View File

@ -1,27 +0,0 @@
From 3eac27c5fccf93d2d6e634d6fe2a76d06708ec6e Mon Sep 17 00:00:00 2001
From: kmicki <1463619+kmicki@users.noreply.github.com>
Date: Tue, 15 Nov 2022 14:37:25 +0100
Subject: [PATCH] Update efibootmgr.c
get_entry: return entry if it was found before reaching the end of the list
Signed-off-by: kmicki <1463619+kmicki@users.noreply.github.com>
---
src/efibootmgr.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
index b980bcd..4b15d6d 100644
--- a/src/efibootmgr.c
+++ b/src/efibootmgr.c
@@ -1192,6 +1192,7 @@ get_entry(list_t *entries, uint16_t num)
entry = NULL;
continue;
}
+ return entry;
}
return entry;
--
2.27.0

View File

@ -1,32 +0,0 @@
From 0ca99d442e9d0a49d3ec373413d781ca392b57bc Mon Sep 17 00:00:00 2001
From: Dima Zavin <dmitriyz@waymo.com>
Date: Mon, 8 Jan 2024 11:23:20 -0800
Subject: [PATCH] efibootmgr: delete_bootnext is just a boolean, not an entry
id
When deleting bootnext, there's nothing to validate (other than
the variable existing, in which case del will fail as expected).
This appears to be a copy/paste error when adding the delete-bootnext
option from the [create] bootnext option.
Signed-off-by: Dima Zavin <dmitriyz@waymo.com>
---
src/efibootmgr.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
index b35fcf4..6f51d33 100644
--- a/src/efibootmgr.c
+++ b/src/efibootmgr.c
@@ -1928,10 +1928,6 @@ main(int argc, char **argv)
}
if (opts.delete_bootnext) {
- if (!is_current_entry(opts.delete_bootnext))
- errorx(17, "Boot entry %04X does not exist",
- opts.delete_bootnext);
-
ret = efi_del_variable(EFI_GLOBAL_GUID, "BootNext");
if (ret < 0)
error(10, "Could not delete BootNext");

View File

@ -0,0 +1,44 @@
From d9eb7f1536ed6262fc8c6518c6afe6053a450e9d Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 28 May 2019 17:00:31 -0400
Subject: [PATCH] Get rid of a memory leak of deleted boot entries.
Signed-off-by: Peter Jones <pjones@redhat.com>
Conflict:NA
Reference:https://github.com/rhboot/efibootmgr/commit/d9eb7f1536ed6262fc8c6518c6afe6053a450e9d
---
src/efibootmgr.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
index 19a6edc..afcfc77 100644
--- a/src/efibootmgr.c
+++ b/src/efibootmgr.c
@@ -106,13 +106,12 @@ read_vars(char **namelist,
for (i=0; namelist[i] != NULL; i++) {
if (namelist[i]) {
- entry = malloc(sizeof(var_entry_t));
+ entry = calloc(1, sizeof(var_entry_t));
if (!entry) {
- efi_error("malloc(%zd) failed",
+ efi_error("calloc(1, %zd) failed",
sizeof(var_entry_t));
goto err;
}
- memset(entry, 0, sizeof(var_entry_t));
rc = efi_get_variable(EFI_GLOBAL_GUID, namelist[i],
&entry->data, &entry->data_size,
@@ -611,6 +610,10 @@ delete_var(const char *prefix, uint16_t num)
return rc;
}
list_del(&(entry->list));
+ free(entry->name);
+ free(entry->data);
+ memset(entry, 0, sizeof(*entry));
+ free(entry);
break; /* short-circuit since it was found */
}
}

BIN
efibootmgr-17.tar.gz Normal file

Binary file not shown.

View File

@ -1,19 +1,16 @@
Name: efibootmgr
Release: 5
Version: 18
Release: 2
Version: 17
Summary: A tool manipulating the EFI Boot Manager
License: GPLv2+
URL: https://github.com/rhboot/%{name}/
Source0: https://github.com/rhboot/%{name}/archive/refs/tags/%{version}.tar.gz
Source0: https://github.com/rhboot/%{name}/releases/download/%{version}/%{name}-%{version}.tar.gz
Patch6000: backport-Update-efibootmgr.c.patch
Patch6001: backport-Add-missing-short-option-handling-for-index-I.patch
Patch6002: backport-Fix-segfault-when-passed-index-is-greater-than-curre.patch
Patch6003: backport-Fix-the-incorrect-long-parameter-in-help-messages.patch
Patch6004: backport-efibootmgr-delete_bootnext-is-just-a-boolean-not-an-entry-id.patch
Patch0: remove_extra_decl.patch
Patch6000: backport-get-rid-of-a-memory-leak-of-deleted-boot-entries.patch
BuildRequires: gcc
BuildRequires: efi-srpm-macros >= 3-2 efi-filesystem git popt-devel efivar-libs >= 38-1 efivar-devel >= 38-1
BuildRequires: efi-srpm-macros >= 3-2 efi-filesystem git popt-devel efivar-libs >= 35-2 efivar-devel >= 35-2
Requires: efi-filesystem
ExclusiveArch: %{efi}
Conflicts: elilo <= 3.6-6
@ -35,7 +32,7 @@ Help package contains some readme, man and other related files for efibootmgr.
git config --local --add %{name}.efidir %{efi_vendor}
%build
%make_build CFLAGS='%{optflags}' LDFLAGS='%{build_ldflags}'
%make_build
%install
rm -rf %{buildroot}
@ -52,23 +49,6 @@ rm -rf %{buildroot}
%{_mandir}/*/*.?.gz
%changelog
* Mon Jun 17 2024 zhangxingrong <zhangxingrong@uniontech.com> - 18-5
- Fix the incorrect long parameter in help messages
- efibootmgr: delete_bootnext is just a boolean, not an entry id
* Mon Mar 13 2023 zhangqiumiao <zhangqiumiao1@huawei.com> - 18-4
- Fix segfault when passed --index is greater than current boot order size
Add missing short option handling for --index (-I)
* Mon Feb 20 2023 zhangqiumiao <zhangqiumiao1@huawei.com> - 18-3
- get_entry: return entry if it was found before reaching the end of the list
* Fri Nov 25 2022 zhangqiumiao <zhangqiumiao1@huawei.com> - 18-2
- Fix the wrong url of Source0 and modify the name of the source tarball
* Tue Oct 18 2022 zhangqiumiao <zhangqiumiao1@huawei.com> - 18-1
- update to verion 18
* Mon Apr 25 2022 yangcheng <yangcheng87@h-partners.com> - 17-2
- rebuild efibootmgr

24
remove_extra_decl.patch Normal file
View File

@ -0,0 +1,24 @@
From 99b578501643377e0b1994b2a068b790d189d5ad Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Wed, 13 Jun 2018 09:41:01 -0400
Subject: [PATCH] remove extra decl
Signed-off-by: Peter Jones <pjones@redhat.com>
---
src/efibootmgr.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/efibootmgr.c b/src/efibootmgr.c
index de38f01..4e1a680 100644
--- a/src/efibootmgr.c
+++ b/src/efibootmgr.c
@@ -1536,9 +1536,6 @@ parse_opts(int argc, char **argv)
"invalid numeric value %s\n",
optarg);
}
- /* XXX efivar-36 accidentally doesn't have a public
- * header for this */
- extern int efi_set_verbose(int verbosity, FILE *errlog);
efi_set_verbose(opts.verbose - 2, stderr);
break;
case 'V':