- Update from version 37 to 38 - Update of rootfile - mandoc is now a build dependency for efivar - Old compile fixes patches are no longer required with version 38 - Details for lfs build of version 38 obtained from Beyond Linux From Scratch - Changelog bug fixes Rework some makefile bits to make overriding some options simpler. by @vathpela in #140 Handle /sys/devices/virtual/{nvme-fabrics,nvme-subsystem} devices by @vathpela in #139 guids.S: Include <cet.h> when CET is enabled by @hjl-tools in #149 Fix /sys/block sysfs parsing for eMMC-s by @jwrdegoede in #150 Properly check mmap return error by @hannob in #152 Fix s{yt,ty}le typo in efi_get_variable(3) by @nabijaczleweli in #162 Handle NULL set_variable() by @lcp in #159 Fix parsing for nvme-subsystem devices by @dannf in #158 Attempt to fix the identified thread safety bugs by @vathpela in #155 Make thread-test depend on libefivar.so by @hjl-tools in #176 Upstream a local patch from rawhide by @frozencemetery in #177 Fix conversion from UTF8 to UCS2 by @freedge in #171 efivar: make docs match current code for 'efivar -A' by @vathpela in #178 Migrate CI to Github actions by @frozencemetery in #179 Add code of conduct by @frozencemetery in #180 Misc minor fixes by @vathpela in #182 Add efi_time_t declarations and helper functions. by @vathpela in #183 More misc fixes by @vathpela in #185 Run CI on more targets by @vathpela in #187 Coverity fixes 20211208 by @vathpela in #189 CI: run abicheck by @frozencemetery in #190 Fix linux virtual root device parsing by @vathpela in #188 efivar.spec.in: fix license to be valid SPDX by @frozencemetery in #192 Add efisecdb tooling by @vathpela in #184 Fix linker string comparison for dash by @frozencemetery in #194 Full changelog diff between version 37 and 38 is available in github repo https://github.com/rhboot/efivar/compare/37...38
Signed-off-by: Adolf Belka adolf.belka@ipfire.org --- config/rootfiles/common/x86_64/efivar | 15 +- lfs/efivar | 12 +- src/patches/efivar-37-compile-fixes-1.patch | 56 ------- src/patches/efivar-37-compile-fixes-2.patch | 168 -------------------- 4 files changed, 18 insertions(+), 233 deletions(-) delete mode 100644 src/patches/efivar-37-compile-fixes-1.patch delete mode 100644 src/patches/efivar-37-compile-fixes-2.patch
diff --git a/config/rootfiles/common/x86_64/efivar b/config/rootfiles/common/x86_64/efivar index 4fd100167..e83c62d98 100644 --- a/config/rootfiles/common/x86_64/efivar +++ b/config/rootfiles/common/x86_64/efivar @@ -1,19 +1,30 @@ +usr/bin/efisecdb usr/bin/efivar #usr/include/efivar #usr/include/efivar/efiboot-creator.h #usr/include/efivar/efiboot-loadopt.h #usr/include/efivar/efiboot.h +#usr/include/efivar/efisec-secdb.h +#usr/include/efivar/efisec-types.h +#usr/include/efivar/efisec.h #usr/include/efivar/efivar-dp.h #usr/include/efivar/efivar-guids.h +#usr/include/efivar/efivar-time.h +#usr/include/efivar/efivar-types.h #usr/include/efivar/efivar.h #usr/lib/libefiboot.so usr/lib/libefiboot.so.1 -usr/lib/libefiboot.so.1.37 +usr/lib/libefiboot.so.1.38 +#usr/lib/libefisec.so +usr/lib/libefisec.so.1 +usr/lib/libefisec.so.1.38 #usr/lib/libefivar.so usr/lib/libefivar.so.1 -usr/lib/libefivar.so.1.37 +usr/lib/libefivar.so.1.38 #usr/lib/pkgconfig/efiboot.pc +#usr/lib/pkgconfig/efisec.pc #usr/lib/pkgconfig/efivar.pc +#usr/share/man/man1/efisecdb.1 #usr/share/man/man1/efivar.1 #usr/share/man/man3/efi_append_variable.3 #usr/share/man/man3/efi_del_variable.3 diff --git a/lfs/efivar b/lfs/efivar index c5d2c8f44..6a54ee091 100644 --- a/lfs/efivar +++ b/lfs/efivar @@ -24,7 +24,7 @@
include Config
-VER = 37 +VER = 38
THISAPP = efivar-$(VER) DL_FILE = $(THISAPP).tar.bz2 @@ -41,7 +41,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_BLAKE2 = 813d477d31562b773f6e19f20e9e237b94beed437ce221771770e7d46ff0e657530285f035dc942cc20609185be92dc50319bfe8e10dee642c8bd88403ef6ffe +$(DL_FILE)_BLAKE2 = 0b96f3d71ddc2246e6a11a5cd32af3d007823c4a283186a428c3f145cd74425a31bd22c4671ad1ab252a3c572991bb1698381cb8bdf51efcbebd62befdc6c070
install : $(TARGET)
@@ -72,11 +72,9 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
- cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/efivar-37-compile-fixes-1.patch - cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/efivar-37-compile-fixes-2.patch - - # -Werror, not even once - cd $(DIR_APP) && sed -e "s/-Werror//g" -i gcc.specs + # fix an issue in Makefile causing the package to be rebuilt during installation + # obtained from https://linuxfromscratch.org/blfs/view/11.1/postlfs/efivar.html + cd $(DIR_APP) && sed '/prep :/a\ttouch prep' -i src/Makefile
cd $(DIR_APP) && make CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" $(MAKETUNING) cd $(DIR_APP) && make install diff --git a/src/patches/efivar-37-compile-fixes-1.patch b/src/patches/efivar-37-compile-fixes-1.patch deleted file mode 100644 index f40942f45..000000000 --- a/src/patches/efivar-37-compile-fixes-1.patch +++ /dev/null @@ -1,56 +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); \ diff --git a/src/patches/efivar-37-compile-fixes-2.patch b/src/patches/efivar-37-compile-fixes-2.patch deleted file mode 100644 index bbb6a99a3..000000000 --- a/src/patches/efivar-37-compile-fixes-2.patch +++ /dev/null @@ -1,168 +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; - }; -