efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch

Resolves: #873629
- efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch - improve
  spec conformance
- efibootmgr-0.5.4-fix-minor-memory-leak.patch - from upstream
- efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch - from upstream
- efibootmgr-0.5.4-make_boot_var-does-not-check-for-failed-status-with-.patch -
  from upstream
This commit is contained in:
Matthew Garrett 2012-11-28 17:35:29 -05:00 committed by Matthew Garrett
parent c20640d5d8
commit 6940e36b33
6 changed files with 180 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From 2d8f962284f40b918c0fc8385e58fcba219ddc12 Mon Sep 17 00:00:00 2001
From: Fedora Ninjas <pjones@fedoraproject.org>
Date: Wed, 28 Nov 2012 17:13:24 -0500
Subject: [PATCH 2/5] Remove device path padding on non-Itanium
This code predates EFI support on any x86 hardware, and it's a strict
violation of the specification. Windows doesn't do it either.
---
src/include/efi.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/include/efi.h b/src/include/efi.h
index be667ae..c2ac853 100644
--- a/src/include/efi.h
+++ b/src/include/efi.h
@@ -294,7 +294,9 @@ typedef struct {
uint8_t signature[16];
uint8_t mbr_type;
uint8_t signature_type;
+#ifdef __ia64
uint8_t padding[6]; /* Emperically needed */
+#endif
} __attribute__((packed)) HARDDRIVE_DEVICE_PATH;
typedef struct {
--
1.8.0

View File

@ -0,0 +1,30 @@
From 6edc3ed5479b575f87eb51e335957b05fdd04fe8 Mon Sep 17 00:00:00 2001
From: Fedora Ninjas <pjones@fedoraproject.org>
Date: Wed, 28 Nov 2012 16:49:18 -0500
Subject: [PATCH 1/5] Work around broken Apple firmware
Alex Murray found that Apple's firmware sets an invalid EFI attribute on
BootCurrent, which newer versions of the kernel then reject. This patch
from him simply masks off the extraneous bit.
---
src/lib/efivars_sysfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lib/efivars_sysfs.c b/src/lib/efivars_sysfs.c
index 182c70f..ea87325 100644
--- a/src/lib/efivars_sysfs.c
+++ b/src/lib/efivars_sysfs.c
@@ -55,6 +55,10 @@ sysfs_read_variable(const char *name, efi_variable_t *var)
return EFI_INVALID_PARAMETER;
}
close(fd);
+ /* latest apple firmware sets high bit which appears invalid
+ to the linux kernel if we write it back so lets zero it out
+ if it is set since it would be invalid to set it anyway */
+ var->Attributes = var->Attributes & ~(1 << 31);
return var->Status;
}
--
1.8.0

View File

@ -0,0 +1,29 @@
From f9f4ee75ad745637a47bf17ed968101b1ffbcc1d Mon Sep 17 00:00:00 2001
From: Matt Domsch <Matt_Domsch@dell.com>
Date: Thu, 23 Jul 2009 14:20:19 -0500
Subject: [PATCH 4/5] fix disk minor number discovery
Raymund Will noted disk_info_from_fd() incorrectly used logical &&
instead of bitwise & when obtaining the minor number.
Reported in https://bugzilla.novell.com/show_bug.cgi?id=524529#c1
---
src/lib/disk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/disk.c b/src/lib/disk.c
index ebfe619..8ad590b 100644
--- a/src/lib/disk.c
+++ b/src/lib/disk.c
@@ -55,7 +55,7 @@ disk_info_from_fd(int fd,
return 1;
}
major = buf.st_dev >> 8;
- minor = buf.st_dev && 0xFF;
+ minor = buf.st_dev & 0xFF;
/* IDE disks can have up to 64 partitions, or 6 bits worth,
* and have one bit for the disk number.
--
1.8.0

View File

@ -0,0 +1,29 @@
From 36c3a19c62cc3b6841e363712c3c78ef5915122d Mon Sep 17 00:00:00 2001
From: Matt Domsch <Matt_Domsch@dell.com>
Date: Thu, 23 Jul 2009 14:18:11 -0500
Subject: [PATCH 3/5] fix minor memory leak
David Binderman noted new_data was being allocated but not freed. Not
a big deal as the program exits soon thereafter (and is thus freed),
but worth fixing anyhow.
Fixes https://bugzilla.novell.com/show_bug.cgi?id=524529#c1
---
src/efibootmgr/efibootmgr.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
index b984143..de67af0 100644
--- a/src/efibootmgr/efibootmgr.c
+++ b/src/efibootmgr/efibootmgr.c
@@ -328,6 +328,7 @@ add_to_boot_order(uint16_t num)
/* Now new_data has what we need */
memcpy(&(boot_order.Data), new_data, new_data_size);
boot_order.DataSize = new_data_size;
+ free(new_data);
return create_or_edit_variable(&boot_order);
}
--
1.8.0

View File

@ -0,0 +1,47 @@
From 5fcfccb39089febb89945b841f489b5acc7638ce Mon Sep 17 00:00:00 2001
From: Lane Winner <lane.winner@oracle.com>
Date: Tue, 24 Apr 2012 12:58:57 -0500
Subject: [PATCH 5/5] make_boot_var does not check for failed status with
create_variable. This can result in a memory leak.
Additionally the user should be notified of the
problem.
We encounter this issue on one system after filling up the UEFI boot list
with dummy devices.
The patch fix the problem. It was verified on a Mensa system using RHEL 6.0
Signed-off-by: Yinghai Lu<yinghai@kernel.org>
---
src/efibootmgr/efibootmgr.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c
index de67af0..236365a 100644
--- a/src/efibootmgr/efibootmgr.c
+++ b/src/efibootmgr/efibootmgr.c
@@ -239,6 +239,7 @@ warn_duplicate_name(list_t *boot_list)
static var_entry_t *
make_boot_var(list_t *boot_list)
{
+ efi_status_t status;
var_entry_t *boot;
int free_number;
list_t *pos;
@@ -271,7 +272,12 @@ make_boot_var(list_t *boot_list)
free(boot);
return NULL;
}
- create_variable(&boot->var_data);
+
+ status = create_variable(&boot->var_data);
+ if (status != EFI_SUCCESS) {
+ free(boot);
+ return NULL;
+ }
list_add_tail(&boot->list, boot_list);
return boot;
}
--
1.8.0

View File

@ -1,7 +1,7 @@
Summary: EFI Boot Manager
Name: efibootmgr
Version: 0.5.4
Release: 14%{?dist}
Release: 15%{?dist}
Group: System Environment/Base
License: GPLv2+
URL: http://linux.dell.com/%{name}/
@ -17,6 +17,11 @@ Obsoletes: elilo <= 3.6-5
Source0: http://linux.dell.com/%{name}/permalink/%{name}-%{version}.tar.gz
Patch0: efibootmgr-0.5.4-default-to-grub.patch
Patch1: efibootmgr-0.5.4-support-4k-sectors.patch
Patch2: efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch
Patch3: efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch
Patch4: efibootmgr-0.5.4-fix-minor-memory-leak.patch
Patch5: efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch
Patch6: efibootmgr-0.5.4-make_boot_var-does-not-check-for-failed-status-with-.patch
%description
%{name} displays and allows the user to edit the Intel Extensible
@ -54,6 +59,17 @@ rm -rf %{buildroot}
%doc README INSTALL COPYING
%changelog
* Thu Apr 25 2013 Matthew Garrett <mjg59@srcf.ucam.org> - 0.5.4-15
- efibootmgr-0.5.4-Work-around-broken-Apple-firmware.patch
Resolves: #873629
- efibootmgr-0.5.4-Remove-device-path-padding-on-non-Itanium.patch - improve
spec conformance
- efibootmgr-0.5.4-fix-minor-memory-leak.patch - from upstream
- efibootmgr-0.5.4-fix-disk-minor-number-discovery.patch - from upstream
- efibootmgr-0.5.4-make_boot_var-does-not-check-for-failed-status-with-.patch -
from upstream
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.4-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild