Accepting request 1072154 from Base:System
- Update to 38 + Rework some makefile bits to make overriding some options simpler + Handle /sys/devices/virtual/{nvme-fabrics,nvme-subsystem} devices + guids.S: Include <cet.h> when CET is enabled + Fix /sys/block sysfs parsing for eMMC-s + Properly check mmap return error + Fix s{yt,ty}le typo in efi_get_variable(3) + Handle NULL set_variable() + Fix parsing for nvme-subsystem devices + Attempt to fix the identified thread safety bugs + Make thread-test depend on libefivar.so + Upstream a local patch from rawhide + Fix conversion from UTF8 to UCS2 + efivar: make docs match current code for 'efivar -A' + Add code of conduct + Misc minor fixes + Add efi_time_t declarations and helper functions + More misc fixes + Coverity fixes 20211208 + Fix linux virtual root device parsing + efivar.spec.in: fix license to be valid SPDX + Add efisecdb tooling + Fix linker string comparison for dash - Add efivar-bsc1206388-revamp-efi_well_known-variable-handling.patch to remove the ld script hack for efi_well_known_* variables that caused build failure with LTO (bsc#1206388) - Add mandoc to BuildRequires to build efisecdb man page - Add efivar-adjust-dependency.patch to avoid 'make install' from OBS-URL: https://build.opensuse.org/request/show/1072154 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/efivar?expand=0&rev=22factory
commit
1863933d82
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3c67feb93f901b98fbb897d5ca82931a6698b5bcd6ac34f0815f670d77747b9f
|
||||
size 109431
|
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f018ed6e49c5f1c16d336d9fd7687ce87023276591921db1e49a314ad6515349
|
||||
size 320221
|
@ -1,171 +0,0 @@
|
||||
From c3c553db85ff10890209d0fe48fb4856ad68e4e0 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 21 Feb 2019 15:20:12 -0500
|
||||
Subject: [PATCH] Fix all the places -Werror=address-of-packed-member catches.
|
||||
|
||||
This gets rid of all the places GCC 9's -Werror=address-of-packed-member
|
||||
flags as problematic.
|
||||
|
||||
Fixes github issue #123
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
src/dp-message.c | 6 ++++--
|
||||
src/dp.h | 12 ++++--------
|
||||
src/guid.c | 2 +-
|
||||
src/include/efivar/efivar.h | 2 +-
|
||||
src/ucs2.h | 27 +++++++++++++++++++--------
|
||||
5 files changed, 29 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/src/dp-message.c b/src/dp-message.c
|
||||
index 3724e5f..9f96466 100644
|
||||
--- a/src/dp-message.c
|
||||
+++ b/src/dp-message.c
|
||||
@@ -620,11 +620,13 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
|
||||
) / sizeof(efi_ip_addr_t);
|
||||
format(buf, size, off, "Dns", "Dns(");
|
||||
for (int i=0; i < end; i++) {
|
||||
- const efi_ip_addr_t *addr = &dp->dns.addrs[i];
|
||||
+ efi_ip_addr_t addr;
|
||||
+
|
||||
+ memcpy(&addr, &dp->dns.addrs[i], sizeof(addr));
|
||||
if (i != 0)
|
||||
format(buf, size, off, "Dns", ",");
|
||||
format_ip_addr(buf, size, off, "Dns",
|
||||
- dp->dns.is_ipv6, addr);
|
||||
+ dp->dns.is_ipv6, &addr);
|
||||
}
|
||||
format(buf, size, off, "Dns", ")");
|
||||
break;
|
||||
diff --git a/src/dp.h b/src/dp.h
|
||||
index 20cb608..1f921d5 100644
|
||||
--- a/src/dp.h
|
||||
+++ b/src/dp.h
|
||||
@@ -71,13 +71,9 @@
|
||||
int _rc; \
|
||||
char *_guidstr = NULL; \
|
||||
efi_guid_t _guid; \
|
||||
- const efi_guid_t * const _guid_p = \
|
||||
- likely(__alignof__(guid) == sizeof(guid)) \
|
||||
- ? guid \
|
||||
- : &_guid; \
|
||||
- \
|
||||
- if (unlikely(__alignof__(guid) == sizeof(guid))) \
|
||||
- memmove(&_guid, guid, sizeof(_guid)); \
|
||||
+ const efi_guid_t * const _guid_p = &_guid; \
|
||||
+ \
|
||||
+ memmove(&_guid, guid, sizeof(_guid)); \
|
||||
_rc = efi_guid_to_str(_guid_p, &_guidstr); \
|
||||
if (_rc < 0) { \
|
||||
efi_error("could not build %s GUID DP string", \
|
||||
@@ -86,7 +82,7 @@
|
||||
_guidstr = onstack(_guidstr, \
|
||||
strlen(_guidstr)+1); \
|
||||
_rc = format(buf, size, off, dp_type, "%s", \
|
||||
- _guidstr); \
|
||||
+ _guidstr); \
|
||||
} \
|
||||
_rc; \
|
||||
})
|
||||
diff --git a/src/guid.c b/src/guid.c
|
||||
index 306c9ff..3156b3b 100644
|
||||
--- a/src/guid.c
|
||||
+++ b/src/guid.c
|
||||
@@ -31,7 +31,7 @@
|
||||
extern const efi_guid_t efi_guid_zero;
|
||||
|
||||
int NONNULL(1, 2) PUBLIC
|
||||
-efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b)
|
||||
+efi_guid_cmp(const void * const a, const void * const b)
|
||||
{
|
||||
return memcmp(a, b, sizeof (efi_guid_t));
|
||||
}
|
||||
diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
|
||||
index 316891c..ad6449d 100644
|
||||
--- a/src/include/efivar/efivar.h
|
||||
+++ b/src/include/efivar/efivar.h
|
||||
@@ -128,7 +128,7 @@ extern int efi_symbol_to_guid(const char *symbol, efi_guid_t *guid)
|
||||
|
||||
extern int efi_guid_is_zero(const efi_guid_t *guid);
|
||||
extern int efi_guid_is_empty(const efi_guid_t *guid);
|
||||
-extern int efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b);
|
||||
+extern int efi_guid_cmp(const void * const a, const void * const b);
|
||||
|
||||
/* import / export functions */
|
||||
typedef struct efi_variable efi_variable_t;
|
||||
diff --git a/src/ucs2.h b/src/ucs2.h
|
||||
index dbb5900..edd8367 100644
|
||||
--- a/src/ucs2.h
|
||||
+++ b/src/ucs2.h
|
||||
@@ -23,16 +23,21 @@
|
||||
(((val) & ((mask) << (shift))) >> (shift))
|
||||
|
||||
static inline size_t UNUSED
|
||||
-ucs2len(const uint16_t * const s, ssize_t limit)
|
||||
+ucs2len(const void *vs, ssize_t limit)
|
||||
{
|
||||
ssize_t i;
|
||||
- for (i = 0; i < (limit >= 0 ? limit : i+1) && s[i] != (uint16_t)0; i++)
|
||||
+ const uint16_t *s = vs;
|
||||
+ const uint8_t *s8 = vs;
|
||||
+
|
||||
+ for (i = 0;
|
||||
+ i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
|
||||
+ i++, s8 += 2, s++)
|
||||
;
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline size_t UNUSED
|
||||
-ucs2size(const uint16_t * const s, ssize_t limit)
|
||||
+ucs2size(const void *s, ssize_t limit)
|
||||
{
|
||||
size_t rc = ucs2len(s, limit);
|
||||
rc *= sizeof (uint16_t);
|
||||
@@ -69,10 +74,11 @@ utf8size(uint8_t *s, ssize_t limit)
|
||||
}
|
||||
|
||||
static inline unsigned char * UNUSED
|
||||
-ucs2_to_utf8(const uint16_t * const chars, ssize_t limit)
|
||||
+ucs2_to_utf8(const void * const voidchars, ssize_t limit)
|
||||
{
|
||||
ssize_t i, j;
|
||||
unsigned char *ret;
|
||||
+ const uint16_t * const chars = voidchars;
|
||||
|
||||
if (limit < 0)
|
||||
limit = ucs2len(chars, -1);
|
||||
@@ -124,10 +130,12 @@ ucs2_to_utf8(const uint16_t * const chars, ssize_t limit)
|
||||
}
|
||||
|
||||
static inline ssize_t UNUSED NONNULL(4)
|
||||
-utf8_to_ucs2(uint16_t *ucs2, ssize_t size, int terminate, uint8_t *utf8)
|
||||
+utf8_to_ucs2(void *ucs2void, ssize_t size, int terminate, uint8_t *utf8)
|
||||
{
|
||||
ssize_t req;
|
||||
ssize_t i, j;
|
||||
+ uint16_t *ucs2 = ucs2void;
|
||||
+ uint16_t val16;
|
||||
|
||||
if (!ucs2 && size > 0) {
|
||||
errno = EINVAL;
|
||||
@@ -162,10 +170,13 @@ utf8_to_ucs2(uint16_t *ucs2, ssize_t size, int terminate, uint8_t *utf8)
|
||||
val = utf8[i] & 0x7f;
|
||||
i += 1;
|
||||
}
|
||||
- ucs2[j] = val;
|
||||
+ val16 = val;
|
||||
+ ucs2[j] = val16;
|
||||
+ }
|
||||
+ if (terminate) {
|
||||
+ val16 = 0;
|
||||
+ ucs2[j++] = val16;
|
||||
}
|
||||
- if (terminate)
|
||||
- ucs2[j++] = (uint16_t)0;
|
||||
return j;
|
||||
};
|
||||
|
||||
--
|
||||
2.20.1
|
||||
|
@ -0,0 +1,36 @@
|
||||
From 26ad6858b7ca2093677a8a13d367436f5c1a22fe Mon Sep 17 00:00:00 2001
|
||||
From: Mike Gilbert <floppym@gentoo.org>
|
||||
Date: Mon, 17 Jan 2022 11:42:53 -0500
|
||||
Subject: [PATCH] Adjust dependency for libefivar and libefiboot objects
|
||||
|
||||
Depending on 'prep' causes all objects to be rebuilt every time 'make'
|
||||
is invoked.
|
||||
|
||||
Depending on '$(GENERATED_SOURCES)' causes a build failure because
|
||||
guid-symbols.c gets passed to the compiler due to a rule in rules.mk.
|
||||
|
||||
Depend on 'include/efivar/efivar-guids.h' directly to avoid these
|
||||
issues.
|
||||
|
||||
Fixes: https://github.com/rhboot/efivar/issues/199
|
||||
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
|
||||
---
|
||||
src/Makefile | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/Makefile b/src/Makefile
|
||||
index a86abdc..e04357a 100644
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -88,7 +88,7 @@ $(MAKEGUIDS_OUTPUT) : guids.txt
|
||||
|
||||
prep : makeguids $(GENERATED_SOURCES)
|
||||
|
||||
-$(LIBEFIVAR_OBJECTS) $(LIBEFIBOOT_OBJECTS) : prep
|
||||
+$(LIBEFIVAR_OBJECTS) $(LIBEFIBOOT_OBJECTS) : include/efivar/efivar-guids.h
|
||||
|
||||
libefivar.a : | $(GENERATED_SOURCES)
|
||||
libefivar.a : $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS))
|
||||
--
|
||||
2.35.3
|
||||
|
@ -1,67 +0,0 @@
|
||||
From fdb803402fb32fa6d020bac57a40c7efe4aabb7d Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Tue, 5 Mar 2019 17:23:24 +0100
|
||||
Subject: [PATCH 1/2] ucs2.h: remove unused variable
|
||||
|
||||
The const uint16_t pointer is not used since now the two bytes of the
|
||||
UCS-2 chars are checked to know if is the termination of the string.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
src/ucs2.h | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/ucs2.h b/src/ucs2.h
|
||||
index edd8367..e0390c3 100644
|
||||
--- a/src/ucs2.h
|
||||
+++ b/src/ucs2.h
|
||||
@@ -26,12 +26,11 @@ static inline size_t UNUSED
|
||||
ucs2len(const void *vs, ssize_t limit)
|
||||
{
|
||||
ssize_t i;
|
||||
- const uint16_t *s = vs;
|
||||
const uint8_t *s8 = vs;
|
||||
|
||||
for (i = 0;
|
||||
i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
|
||||
- i++, s8 += 2, s++)
|
||||
+ i++, s8 += 2)
|
||||
;
|
||||
return i;
|
||||
}
|
||||
--
|
||||
2.20.1
|
||||
|
||||
|
||||
From 4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Tue, 5 Mar 2019 17:23:32 +0100
|
||||
Subject: [PATCH 2/2] ucs2.h: fix logic that checks for UCS-2 string
|
||||
termination
|
||||
|
||||
Currently the loop to count the lenght of the UCS-2 string ends if either
|
||||
of the two bytes are 0, but 0 is a valid value for UCS-2 character codes.
|
||||
|
||||
So only break the loop when 0 is the value for both UCS-2 char bytes.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
src/ucs2.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/ucs2.h b/src/ucs2.h
|
||||
index e0390c3..fd8b056 100644
|
||||
--- a/src/ucs2.h
|
||||
+++ b/src/ucs2.h
|
||||
@@ -29,7 +29,7 @@ ucs2len(const void *vs, ssize_t limit)
|
||||
const uint8_t *s8 = vs;
|
||||
|
||||
for (i = 0;
|
||||
- i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
|
||||
+ i < (limit >= 0 ? limit : i+1) && !(s8[0] == 0 && s8[1] == 0);
|
||||
i++, s8 += 2)
|
||||
;
|
||||
return i;
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,56 +0,0 @@
|
||||
From a98844ea72b04f8b0d3cc8e71089a6340e7149eb Mon Sep 17 00:00:00 2001
|
||||
From: Gary Lin <glin@suse.com>
|
||||
Date: Tue, 8 Sep 2020 17:13:02 +0800
|
||||
Subject: [PATCH] Handle NULL set_variable()
|
||||
|
||||
Add the check of NULL set_variable() to avoid segfault in a non-EFI
|
||||
system.
|
||||
|
||||
Signed-off-by: Gary Lin <glin@suse.com>
|
||||
---
|
||||
src/lib.c | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
diff --git a/src/lib.c b/src/lib.c
|
||||
index 107e7ef..4a0a161 100644
|
||||
--- a/src/lib.c
|
||||
+++ b/src/lib.c
|
||||
@@ -33,6 +33,11 @@ _efi_set_variable(efi_guid_t guid, const char *name, uint8_t *data,
|
||||
size_t data_size, uint32_t attributes)
|
||||
{
|
||||
int rc;
|
||||
+ if (!ops->set_variable) {
|
||||
+ efi_error("set_variable() is not implemented");
|
||||
+ errno = ENOSYS;
|
||||
+ return -1;
|
||||
+ }
|
||||
rc = ops->set_variable(guid, name, data, data_size, attributes, 0600);
|
||||
if (rc < 0)
|
||||
efi_error("ops->set_variable() failed");
|
||||
@@ -45,6 +50,11 @@ _efi_set_variable_variadic(efi_guid_t guid, const char *name, uint8_t *data,
|
||||
size_t data_size, uint32_t attributes, ...)
|
||||
{
|
||||
int rc;
|
||||
+ if (!ops->set_variable) {
|
||||
+ efi_error("set_variable() is not implemented");
|
||||
+ errno = ENOSYS;
|
||||
+ return -1;
|
||||
+ }
|
||||
rc = ops->set_variable(guid, name, data, data_size, attributes, 0600);
|
||||
if (rc < 0)
|
||||
efi_error("ops->set_variable() failed");
|
||||
@@ -57,6 +67,11 @@ _efi_set_variable_mode(efi_guid_t guid, const char *name, uint8_t *data,
|
||||
size_t data_size, uint32_t attributes, mode_t mode)
|
||||
{
|
||||
int rc;
|
||||
+ if (!ops->set_variable) {
|
||||
+ efi_error("set_variable() is not implemented");
|
||||
+ errno = ENOSYS;
|
||||
+ return -1;
|
||||
+ }
|
||||
rc = ops->set_variable(guid, name, data, data_size, attributes, mode);
|
||||
if (rc < 0)
|
||||
efi_error("ops->set_variable() failed");
|
||||
--
|
||||
2.28.0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,56 +0,0 @@
|
||||
From 046f92b28c1d8114307b4588ee4ff33b8bab5904 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 22 Apr 2020 19:33:01 +0200
|
||||
Subject: [PATCH] Fix /sys/block sysfs parsing for eMMC-s
|
||||
|
||||
Commit 471869409464 ("sysfs parsers: make all the /sys/block link
|
||||
parsers work the same way") has broken sysfs parsing for eMMC-s when
|
||||
the passed in path points to the whole block device.
|
||||
|
||||
In that case pos2 will stay at its -1 initializaton value, because we
|
||||
only do 4 conversions; and when we then do:
|
||||
|
||||
current += pos2
|
||||
|
||||
We end up moving current one char position backwards and we end up
|
||||
returning -1.
|
||||
|
||||
The correct position to use is always pos1 independent if we got
|
||||
passed the whole disk; or a partition, as we always want to return
|
||||
only the part which points to whole disk which ends at pos1.
|
||||
|
||||
Note that it seems that before commit 471869409464, the case where
|
||||
path points to the partition was likely broken as the old code then
|
||||
would return the entire path including the partition element.
|
||||
|
||||
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1826864
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
(cherry picked from commit f0d3ed17ef3b2bbdfdff4dde12ec0a82d1ccdd33)
|
||||
---
|
||||
src/linux-emmc.c | 9 +++------
|
||||
1 file changed, 3 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/linux-emmc.c b/src/linux-emmc.c
|
||||
index bafa9cd..b68c51a 100644
|
||||
--- a/src/linux-emmc.c
|
||||
+++ b/src/linux-emmc.c
|
||||
@@ -70,13 +70,10 @@ parse_emmc(struct device *dev, const char *path, const char *root UNUSED)
|
||||
dev->emmc_info.slot_id = slot_id;
|
||||
dev->interface_type = emmc;
|
||||
|
||||
- if (rc == 6) {
|
||||
- if (dev->part == -1)
|
||||
- dev->part = partition;
|
||||
+ if (rc == 6 && dev->part == -1)
|
||||
+ dev->part = partition;
|
||||
|
||||
- pos2 = pos1;
|
||||
- }
|
||||
- current += pos2;
|
||||
+ current += pos1;
|
||||
|
||||
debug("current:'%s' sz:%zd", current, current - path);
|
||||
return current - path;
|
||||
--
|
||||
2.31.1
|
||||
|
@ -0,0 +1,262 @@
|
||||
From 06a27de4468c879494db0e34d37b4ad2e5788af4 Mon Sep 17 00:00:00 2001
|
||||
From: Nicholas Vinson <nvinson234@gmail.com>
|
||||
Date: Mon, 10 Oct 2022 14:22:36 -0400
|
||||
Subject: [PATCH] Revamp efi_well_known_* variable handling
|
||||
|
||||
The current implementation attempts to use the linker to create aliases
|
||||
for efi_well_known_guids and efi_well_known_names. It also tries to use
|
||||
the linker to generate the variables efi_well_known_guids_end and
|
||||
efi_well_known_names_end.
|
||||
|
||||
When building with clang, the generated linker result results in a
|
||||
broken libefivar.so that causes programs to segfault when linked against
|
||||
it. This change does away with linker script hacker and instead
|
||||
introduces pointers to store the locations of efi_well_known_guids_end
|
||||
and efi_well_known_names_end.
|
||||
|
||||
Additionally, efi_well_known_guids and efi_well_known_names are now
|
||||
created as pointers that point to the beginning of their respective
|
||||
arrays.
|
||||
|
||||
Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
|
||||
Fixes: #234
|
||||
---
|
||||
src/Makefile | 7 ++--
|
||||
src/include/rules.mk | 5 +--
|
||||
src/include/workarounds.mk | 24 -------------
|
||||
src/makeguids.c | 72 +++++++++++++-------------------------
|
||||
4 files changed, 27 insertions(+), 81 deletions(-)
|
||||
delete mode 100644 src/include/workarounds.mk
|
||||
|
||||
diff --git a/src/Makefile b/src/Makefile
|
||||
index 0e423c4..a655a56 100644
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -4,7 +4,6 @@ include $(TOPDIR)/src/include/deprecated.mk
|
||||
include $(TOPDIR)/src/include/version.mk
|
||||
include $(TOPDIR)/src/include/rules.mk
|
||||
include $(TOPDIR)/src/include/defaults.mk
|
||||
-include $(TOPDIR)/src/include/workarounds.mk
|
||||
|
||||
LIBTARGETS=libefivar.so libefiboot.so libefisec.so
|
||||
STATICLIBTARGETS=libefivar.a libefiboot.a libefisec.a
|
||||
@@ -30,7 +29,7 @@ EFISECDB_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(EFISECDB_SOURCES)))
|
||||
GENERATED_SOURCES = include/efivar/efivar-guids.h guid-symbols.c
|
||||
MAKEGUIDS_SOURCES = makeguids.c util.c
|
||||
MAKEGUIDS_OBJECTS = $(patsubst %.S,%.o,$(patsubst %.c,%.o,$(MAKEGUIDS_SOURCES)))
|
||||
-MAKEGUIDS_OUTPUT = $(GENERATED_SOURCES) guids.lds
|
||||
+MAKEGUIDS_OUTPUT = $(GENERATED_SOURCES)
|
||||
|
||||
ALL_SOURCES=$(LIBEFISEC_SOURCES) $(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES) \
|
||||
$(MAKEGUIDS_SOURCES) $(GENERATED_SOURCES) $(EFIVAR_SOURCES) \
|
||||
@@ -81,7 +80,7 @@ $(MAKEGUIDS_OUTPUT) : guids.txt
|
||||
if [ "$${missing}" != "no" ]; then \
|
||||
exit 1 ; \
|
||||
fi
|
||||
- ./makeguids $(LD_DASH_T) guids.txt guid-symbols.c include/efivar/efivar-guids.h guids.lds
|
||||
+ ./makeguids guids.txt guid-symbols.c include/efivar/efivar-guids.h
|
||||
|
||||
prep : makeguids $(GENERATED_SOURCES)
|
||||
|
||||
@@ -93,7 +92,6 @@ libefivar.a : $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS))
|
||||
libefivar.so : $(LIBEFIVAR_OBJECTS)
|
||||
libefivar.so : | $(GENERATED_SOURCES) libefivar.map
|
||||
libefivar.so : LIBS=dl
|
||||
-libefivar.so : LDSCRIPTS=guids.lds
|
||||
libefivar.so : MAP=libefivar.map
|
||||
|
||||
efivar : $(EFIVAR_OBJECTS) | libefivar.so
|
||||
@@ -134,7 +132,6 @@ deps : $(ALL_SOURCES)
|
||||
clean :
|
||||
@rm -rfv *~ *.o *.a *.E *.so *.so.* *.pc *.bin .*.d *.map \
|
||||
makeguids guid-symbols.c include/efivar/efivar-guids.h \
|
||||
- guids.lds \
|
||||
$(TARGETS) $(STATICTARGETS)
|
||||
@# remove the deps files we used to create, as well.
|
||||
@rm -rfv .*.P .*.h.P *.S.P include/efivar/.*.h.P
|
||||
diff --git a/src/include/rules.mk b/src/include/rules.mk
|
||||
index f309f86..8d0b68a 100644
|
||||
--- a/src/include/rules.mk
|
||||
+++ b/src/include/rules.mk
|
||||
@@ -3,7 +3,6 @@ default : all
|
||||
.PHONY: default all clean install test
|
||||
|
||||
include $(TOPDIR)/src/include/version.mk
|
||||
-include $(TOPDIR)/src/include/workarounds.mk
|
||||
|
||||
comma:= ,
|
||||
empty:=
|
||||
@@ -36,9 +35,7 @@ family = $(foreach FAMILY_SUFFIX,$(FAMILY_SUFFIXES),$($(1)_$(FAMILY_SUFFIX)))
|
||||
$(CCLD) $(CCLDFLAGS) $(CPPFLAGS) -o $@ $(sort $^) $(LDLIBS)
|
||||
|
||||
%.so :
|
||||
- $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) $(SOFLAGS) \
|
||||
- $(foreach LDS,$(LDSCRIPTS),$(LD_DASH_T) $(LDS)) \
|
||||
- -o $@ $^ $(LDLIBS)
|
||||
+ $(CCLD) $(CCLDFLAGS) $(CPPFLAGS) $(SOFLAGS) -o $@ $^ $(LDLIBS)
|
||||
ln -vfs $@ $@.1
|
||||
|
||||
%.abixml : %.so
|
||||
diff --git a/src/include/workarounds.mk b/src/include/workarounds.mk
|
||||
deleted file mode 100644
|
||||
index 3118834..0000000
|
||||
--- a/src/include/workarounds.mk
|
||||
+++ /dev/null
|
||||
@@ -1,24 +0,0 @@
|
||||
-# SPDX-License-Identifier: SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
-#
|
||||
-# workarounds.mk - workarounds for weird stuff behavior
|
||||
-
|
||||
-LD_FLAVOR := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/ .*//g')
|
||||
-LD_VERSION := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/.* //')
|
||||
-# I haven't tested 2.36 here; 2.35 is definitely broken and 2.37 seems to work
|
||||
-LD_DASH_T := $(shell \
|
||||
- if [ "x${LD_FLAVOR}" = xLLD ] ; then \
|
||||
- echo '-T' ; \
|
||||
- elif [ "x${LD_FLAVOR}" = xGNU ] ; then \
|
||||
- if echo "${LD_VERSION}" | grep -q -E '^2\.3[789]|^2\.[456789]|^[3456789]|^[[:digit:]][[:digit:]]' ; then \
|
||||
- echo '-T' ; \
|
||||
- else \
|
||||
- echo "" ; \
|
||||
- fi ; \
|
||||
- else \
|
||||
- echo "Your linker is not supported" ; \
|
||||
- exit 1 ; \
|
||||
- fi)
|
||||
-
|
||||
-export LD_DASH_T
|
||||
-
|
||||
-# vim:ft=make
|
||||
diff --git a/src/makeguids.c b/src/makeguids.c
|
||||
index e4ff411..b9e9312 100644
|
||||
--- a/src/makeguids.c
|
||||
+++ b/src/makeguids.c
|
||||
@@ -107,51 +107,46 @@ write_guidnames(FILE *out, const char *listname,
|
||||
gn->symbol, gn->name, gn->description);
|
||||
}
|
||||
fprintf(out, "};\n");
|
||||
+ fprintf(out, "const struct efivar_guidname\n"
|
||||
+ "\t__attribute__((__visibility__ (\"default\")))\n"
|
||||
+ "\t* const %s = %s_;\n", listname, listname);
|
||||
+ fprintf(out, "const struct efivar_guidname\n"
|
||||
+ "\t__attribute__((__visibility__ (\"default\")))\n"
|
||||
+ "\t* const %s_end = %s_\n\t+ %zd;\n",
|
||||
+ listname, listname, n - 1);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int rc;
|
||||
- int argstart = 0;
|
||||
- FILE *symout, *header, *ldsout;
|
||||
- int dash_t = 0;
|
||||
+ FILE *symout, *header;
|
||||
|
||||
- if (argc < 5) {
|
||||
+ if (argc < 4) {
|
||||
errx(1, "Not enough arguments.\n");
|
||||
- } else if (argc > 5 && !strcmp(argv[1],"-T")) {
|
||||
- argstart = 1;
|
||||
- dash_t = 1;
|
||||
- } else if (argc > 5) {
|
||||
+ } else if (argc > 4) {
|
||||
errx(1, "Too many arguments.\n");
|
||||
}
|
||||
|
||||
- symout = fopen(argv[argstart + 2], "w");
|
||||
+ symout = fopen(argv[2], "w");
|
||||
if (symout == NULL)
|
||||
- err(1, "could not open \"%s\"", argv[argstart + 2]);
|
||||
- rc = chmod(argv[argstart + 2], 0644);
|
||||
+ err(1, "could not open \"%s\"", argv[2]);
|
||||
+ rc = chmod(argv[2], 0644);
|
||||
if (rc < 0)
|
||||
- warn("chmod(%s, 0644)", argv[argstart + 2]);
|
||||
+ warn("chmod(%s, 0644)", argv[2]);
|
||||
|
||||
- header = fopen(argv[argstart + 3], "w");
|
||||
+ header = fopen(argv[3], "w");
|
||||
if (header == NULL)
|
||||
- err(1, "could not open \"%s\"", argv[argstart + 3]);
|
||||
- rc = chmod(argv[argstart + 3], 0644);
|
||||
- if (rc < 0)
|
||||
- warn("chmod(%s, 0644)", argv[argstart + 3]);
|
||||
-
|
||||
- ldsout = fopen(argv[argstart + 4], "w");
|
||||
- if (ldsout == NULL)
|
||||
- err(1, "could not open \"%s\"", argv[argstart + 4]);
|
||||
- rc = chmod(argv[argstart + 4], 0644);
|
||||
+ err(1, "could not open \"%s\"", argv[3]);
|
||||
+ rc = chmod(argv[3], 0644);
|
||||
if (rc < 0)
|
||||
- warn("chmod(%s, 0644)", argv[argstart + 4]);
|
||||
+ warn("chmod(%s, 0644)", argv[3]);
|
||||
|
||||
struct guidname_index *guidnames = NULL;
|
||||
|
||||
- rc = read_guids_at(AT_FDCWD, argv[argstart + 1], &guidnames);
|
||||
+ rc = read_guids_at(AT_FDCWD, argv[1], &guidnames);
|
||||
if (rc < 0)
|
||||
- err(1, "could not read \"%s\"", argv[argstart + 1]);
|
||||
+ err(1, "could not read \"%s\"", argv[1]);
|
||||
|
||||
struct efivar_guidname *outbuf;
|
||||
|
||||
@@ -239,12 +234,11 @@ struct efivar_guidname {\n\
|
||||
fprintf(header,
|
||||
"extern const struct efivar_guidname\n"
|
||||
"\t__attribute__((__visibility__ (\"default\")))\n"
|
||||
- "\tefi_well_known_guids[%d];\n",
|
||||
- i);
|
||||
+ "\t* const efi_well_known_guids;\n");
|
||||
fprintf(header,
|
||||
"extern const struct efivar_guidname\n"
|
||||
"\t__attribute__((__visibility__ (\"default\")))\n"
|
||||
- "\tefi_well_known_guids_end;\n");
|
||||
+ "\t* const efi_well_known_guids_end;\n");
|
||||
fprintf(header,
|
||||
"extern const uint64_t\n"
|
||||
"\t__attribute__((__visibility__ (\"default\")))\n"
|
||||
@@ -252,12 +246,11 @@ struct efivar_guidname {\n\
|
||||
fprintf(header,
|
||||
"extern const struct efivar_guidname\n"
|
||||
"\t__attribute__((__visibility__ (\"default\")))\n"
|
||||
- "\tefi_well_known_names[%d];\n",
|
||||
- i);
|
||||
+ "\t* const efi_well_known_names;\n");
|
||||
fprintf(header,
|
||||
"extern const struct efivar_guidname\n"
|
||||
"\t__attribute__((__visibility__ (\"default\")))\n"
|
||||
- "\tefi_well_known_names_end;\n");
|
||||
+ "\t* const efi_well_known_names_end;\n");
|
||||
fprintf(header,
|
||||
"extern const uint64_t\n"
|
||||
"\t__attribute__((__visibility__ (\"default\")))\n"
|
||||
@@ -302,23 +295,6 @@ struct efivar_guidname {\n\
|
||||
|
||||
fclose(symout);
|
||||
|
||||
- fprintf(ldsout,
|
||||
- "SECTIONS\n"
|
||||
- "{\n"
|
||||
- " .data :\n"
|
||||
- " {\n"
|
||||
- " efi_well_known_guids = efi_well_known_guids_;\n"
|
||||
- " efi_well_known_guids_end = efi_well_known_guids_ + %zd;\n"
|
||||
- " efi_well_known_names = efi_well_known_names_;\n"
|
||||
- " efi_well_known_names_end = efi_well_known_names_ + %zd;\n"
|
||||
- " }\n"
|
||||
- "}%s;\n",
|
||||
- (line - 1) * sizeof(struct efivar_guidname),
|
||||
- (line - 1) * sizeof(struct efivar_guidname),
|
||||
- dash_t ? " INSERT AFTER .data" : "");
|
||||
-
|
||||
- fclose(ldsout);
|
||||
-
|
||||
free(guidnames->strtab);
|
||||
free(guidnames);
|
||||
|
||||
--
|
||||
2.35.3
|
||||
|
@ -0,0 +1,29 @@
|
||||
From 85419ca09d225630cd1740e554bfb65c560e3904 Mon Sep 17 00:00:00 2001
|
||||
From: Gary Lin <glin@suse.com>
|
||||
Date: Wed, 21 Dec 2022 14:49:34 +0800
|
||||
Subject: [PATCH] Exclude '-march=native' from ppc64le and riscv64
|
||||
|
||||
Since gcc of ppc64le and riscv64 doesn't support '-march=native', remove
|
||||
it from HOST_CPPFLAGS.
|
||||
|
||||
Signed-off-by: Gary Lin <glin@suse.com>
|
||||
---
|
||||
src/include/defaults.mk | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
|
||||
index 9da5182..94502ed 100644
|
||||
--- a/src/include/defaults.mk
|
||||
+++ b/src/include/defaults.mk
|
||||
@@ -70,7 +70,7 @@ override SOFLAGS = $(_SOFLAGS) \
|
||||
$(call family,SOFLAGS)
|
||||
|
||||
HOST_ARCH=$(shell uname -m)
|
||||
-ifneq ($(HOST_ARCH),ia64)
|
||||
+ifeq (, $(filter ia64 riscv64 ppc64le, $(HOST_ARCH)))
|
||||
HOST_MARCH=-march=native
|
||||
else
|
||||
HOST_MARCH=
|
||||
--
|
||||
2.35.3
|
||||
|
@ -1,44 +0,0 @@
|
||||
From 836461e480e2249de134efeaef79588cab045d5c Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Tue, 5 Mar 2019 17:23:36 +0100
|
||||
Subject: [PATCH] dp-message: fix efidp_ipv4_addr fields assignment
|
||||
|
||||
The efidp_ipv4_addr structure has some 4-byte array fields to store IPv4
|
||||
addresses and network mask. But the efidp_make_ipv4() function wrongly
|
||||
casts these as a char * before dereferencing them to store a value.
|
||||
|
||||
Instead, cast it to a uint32_t * so the 32-bit value is correctly stored.
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
src/dp-message.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/dp-message.c b/src/dp-message.c
|
||||
index 6b8e907..55fa781 100644
|
||||
--- a/src/dp-message.c
|
||||
+++ b/src/dp-message.c
|
||||
@@ -678,16 +678,16 @@ efidp_make_ipv4(uint8_t *buf, ssize_t size, uint32_t local, uint32_t remote,
|
||||
EFIDP_MSG_IPv4, sizeof (*ipv4));
|
||||
ssize_t req = sizeof (*ipv4);
|
||||
if (size && sz == req) {
|
||||
- *((char *)ipv4->local_ipv4_addr) = htonl(local);
|
||||
- *((char *)ipv4->remote_ipv4_addr) = htonl(remote);
|
||||
+ *((uint32_t *)ipv4->local_ipv4_addr) = htonl(local);
|
||||
+ *((uint32_t *)ipv4->remote_ipv4_addr) = htonl(remote);
|
||||
ipv4->local_port = htons(local_port);
|
||||
ipv4->remote_port = htons(remote_port);
|
||||
ipv4->protocol = htons(protocol);
|
||||
ipv4->static_ip_addr = 0;
|
||||
if (is_static)
|
||||
ipv4->static_ip_addr = 1;
|
||||
- *((char *)ipv4->gateway) = htonl(gateway);
|
||||
- *((char *)ipv4->netmask) = htonl(netmask);
|
||||
+ *((uint32_t *)ipv4->gateway) = htonl(gateway);
|
||||
+ *((uint32_t *)ipv4->netmask) = htonl(netmask);
|
||||
}
|
||||
|
||||
if (sz < 0)
|
||||
--
|
||||
2.20.1
|
||||
|
@ -1,59 +0,0 @@
|
||||
From b98ba8921010d03f46704a476c69861515deb1ca Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 7 Jan 2019 10:30:59 -0500
|
||||
Subject: [PATCH] dp.h: make format_guid() handle misaligned guid pointers
|
||||
safely.
|
||||
|
||||
GCC 9 adds -Werror=address-of-packed-member, which causes us to see the
|
||||
build error reported at
|
||||
https://bugzilla.opensuse.org/show_bug.cgi?id=1120862 .
|
||||
|
||||
That bug report shows us the following:
|
||||
|
||||
In file included from dp.c:26:
|
||||
dp.h: In function 'format_vendor_helper':
|
||||
dp.h:120:37: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
|
||||
120 | format_guid(buf, size, off, label, &dp->hw_vendor.vendor_guid);
|
||||
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
dp.h:74:25: note: in definition of macro 'format_guid'
|
||||
74 | _rc = efi_guid_to_str(guid, &_guidstr); \
|
||||
| ^~~~
|
||||
cc1: all warnings being treated as errors
|
||||
|
||||
This patch makes format_guid() use a local variable as a bounce buffer
|
||||
in the case that the guid we're passed is aligned as chaotic neutral.
|
||||
|
||||
Note that this only fixes this instance and there may be others that bz
|
||||
didn't show because it exited too soon, and I don't have a gcc 9 build
|
||||
in front of me right now.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
src/dp.h | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/dp.h b/src/dp.h
|
||||
index aa4e390..20cb608 100644
|
||||
--- a/src/dp.h
|
||||
+++ b/src/dp.h
|
||||
@@ -70,8 +70,15 @@
|
||||
#define format_guid(buf, size, off, dp_type, guid) ({ \
|
||||
int _rc; \
|
||||
char *_guidstr = NULL; \
|
||||
- \
|
||||
- _rc = efi_guid_to_str(guid, &_guidstr); \
|
||||
+ efi_guid_t _guid; \
|
||||
+ const efi_guid_t * const _guid_p = \
|
||||
+ likely(__alignof__(guid) == sizeof(guid)) \
|
||||
+ ? guid \
|
||||
+ : &_guid; \
|
||||
+ \
|
||||
+ if (unlikely(__alignof__(guid) == sizeof(guid))) \
|
||||
+ memmove(&_guid, guid, sizeof(_guid)); \
|
||||
+ _rc = efi_guid_to_str(_guid_p, &_guidstr); \
|
||||
if (_rc < 0) { \
|
||||
efi_error("could not build %s GUID DP string", \
|
||||
dp_type); \
|
||||
--
|
||||
2.20.1
|
||||
|
Loading…
Reference in New Issue