diff options
Diffstat (limited to 'sys-libs/efivar')
-rw-r--r-- | sys-libs/efivar/Manifest | 4 | ||||
-rw-r--r-- | sys-libs/efivar/efivar-38.ebuild | 2 | ||||
-rw-r--r-- | sys-libs/efivar/files/efivar-38-efisecdb-musl.patch | 179 | ||||
-rw-r--r-- | sys-libs/efivar/files/efivar-38-efisecdb-optarg.patch | 51 |
4 files changed, 235 insertions, 1 deletions
diff --git a/sys-libs/efivar/Manifest b/sys-libs/efivar/Manifest index bd1c41338b23..26cd8a917f76 100644 --- a/sys-libs/efivar/Manifest +++ b/sys-libs/efivar/Manifest @@ -1,10 +1,12 @@ AUX efivar-38-Makefile-dep.patch 1126 BLAKE2B aeeddf608f1bcf9c2a729559ccca6c85271159f4ca0ea82b6685995f34c2ae39c996bb0f98bebfc9abf77ef0b679622267ad31f682f312d58a775a837bfe2bd4 SHA512 156314cbc49f2e298b1a46810ce261716384d19f8d1cc3c7a0aaba816c96cde286b52a578338e2948f770e9404f9c292ce6c0319bdb56963e3ac05789473eb45 AUX efivar-38-binutils-2.36.patch 1231 BLAKE2B ccddc04ab83d4dcf570d5a89e43fc27d36e2010513b36d9eb2fcdea71ceb5dba96a064a1cbca9ffdecf17fb5b9cb22cfe89eae4ee3a188547a4ab6fa6b4e2983 SHA512 568bc88b182875c37479c49b3dbf5b8ee6edf8090f940176e67c9aa28dd2ff6f417c70b2bef6b5df99ada2afa33db3efd295ba9de5d68b3ecc5ce1dc3361d042 +AUX efivar-38-efisecdb-musl.patch 4344 BLAKE2B 5705405e6800dd38a569d2977003d441fb5d184918f94139e59f2f934f157f76f3d3ef6a0d0e3a24509bd541f88f84e1c91d6bcc02dae6cef02f916e6a8c3ace SHA512 c8b78e99317a30b7baaeba9617a76185d6bf030d538fd2fb44267c95fec259ec672b9d9c91a6b38394e614367646bbfa9ea445738b814d289277e870594b2e70 +AUX efivar-38-efisecdb-optarg.patch 1644 BLAKE2B 2dde6aeb20dd318cd213c762ea4103528aeb75d312e3d6f741a8429712c3a19fc8500c32a5207684c87c8cf6d8e7924c59579f54d9c03559e2ce28aad617f3f3 SHA512 236eab00d1600af4f902c58776e884e61fac5f01edce4e17b85d4b756fd17c1b84134c3f60c4cbe6c5e875ce8a8344ea197d613b8ab52dfd569adc6907330a4c AUX efivar-38-glibc-2.36.patch 1308 BLAKE2B 78a40f257e6df5acd2683c04fc541ee7d027a43c16fda20846587a7861d539f0c9f5d48323fdc296bc96c263ada1de5139bbf5e72bfd835a97bb38ab3a8491d9 SHA512 cc5e7543d11ec5448a3ede476315e4f96e664af0943dd2558db901203017b28aa805417ebf6f110b7913ae91ef651e9e8ed41705a8d606a35ccafaf9fdd2a845 AUX efivar-38-ia64-relro.patch 2325 BLAKE2B 952b74c2f3cdaff6ebd8129c7c4a71cbc34aae41bf05c518bce518b0a6f1aea64bfef0a38494e004f4ef83ec6268e2819d15e036c5d5e86d7e55f12f3f0b4e27 SHA512 d56085bdfa5688ca2117a92e0b09f0425fade716f0a16fc99a9d894c936b8dbcdd297ed520498105d6bca7bb2c7042eec8c6fdd3e64b621acbfd948ce00f892b AUX efivar-38-ld-locale.patch 1203 BLAKE2B b5814d3708999288d35d3d972f854087b8c0742f41bb6e3edbb8112d6dd15c8538b5836b78a514df3481f9edb0e0ea08a733237f43943430cb6fe27c06eb655e SHA512 1dcbe473678f400b66de91e8ee5449a94a81ae8b3981a4d8cddb0f20b46aed0755d48f839527586d7f45f2af050fafaa82279de1cc466c0d3fabcc6e2d5ef940 AUX efivar-38-lld-fixes.patch 12397 BLAKE2B 0aed2f3bed5584f97f38e7d61bc6883e9c3020cadbba2cb37cec3e5b876c6a535f721817a46068d47413551f823489fb048201b81c1e3894eae4d65e3493129c SHA512 008931110a7d9ae7bfd70fae60a2feb01482f4d14ac81c107bdb612d8079546c748905a10a4f1cffee0385cdcee3e7a9c9606bfd24c005ba2333cef2fc444b4b AUX efivar-38-march-native.patch 1203 BLAKE2B 950a72a5ae4872894379a6688e80c796dd43db67667dd0b30515e2911a981339af6069405e3058ef49be159e37fa6000dbf26db1378b665f3acf6204feaee906 SHA512 fbe34223677a80c5b4e98db7a0171d48a6b56a8d2fd6793299200a64e81c1415913b1b098b5bca8183cbd0f6dada9802aa1967607217a7398f189f58370bb44a DIST efivar-38.tar.bz2 320221 BLAKE2B 0b96f3d71ddc2246e6a11a5cd32af3d007823c4a283186a428c3f145cd74425a31bd22c4671ad1ab252a3c572991bb1698381cb8bdf51efcbebd62befdc6c070 SHA512 c2f17297c863ece134a9dd758d237fd2df8c8d072f87af1d0bf2bcf9acfc7a53c25597f03fd4fb8cc664b205743d4ffa0ef1b068d0f73c58fa573d40993f3155 -EBUILD efivar-38.ebuild 1441 BLAKE2B cf0c97bb1495ada21c98e35d5b9b006ab79bae20c53e6fc7ead4c4f4bf1bcdba3160737de70e10979b454fc4fab75a194f5984af43a4fabb08f3a12d91e1459b SHA512 957163c6ab9167402fc6fbd01d26adb7496d3b014bf7d51551cfa7a8e3a768dc225ba526ee7f5091ea455a85d4b4b1211948a1276aca6b24f26cdc7f88d48ab5 +EBUILD efivar-38.ebuild 1535 BLAKE2B c670424154c60ac06703b187f89633827a4fc9ab6ea4c76d1163cc181c40144464c7cee474359e6c624b8c50879c27c1dcf3d41d6f1e0093bf61559e64e69ca4 SHA512 f7e7035ca5df0d58c2883d349948885b224efb6a50c0c7ebf051c0c8eda0a5ecb07f94b898a49b4960046c7de00cfd9b33fc68e70314901fe2a0e47729d6e1f1 MISC metadata.xml 330 BLAKE2B 0f894cb3c99d8540d6548f06f146360e20fcff309d867c1da96a15d07e5f1ebb2f03114de8527ddd28c26f4b42a7fa9903dd925015b962b4d4094dda86f76d65 SHA512 c03a2d22f945fd9e4a19143da20b884759e0aa88f73f42a70d47d5b1aeeb43201d9452919779d9c3e020371c3d1519a7068d59c0904043572ae0dd09633989e8 diff --git a/sys-libs/efivar/efivar-38.ebuild b/sys-libs/efivar/efivar-38.ebuild index f9ec399b79fb..d00381caef83 100644 --- a/sys-libs/efivar/efivar-38.ebuild +++ b/sys-libs/efivar/efivar-38.ebuild @@ -35,6 +35,8 @@ src_prepare() { "${FILESDIR}"/efivar-38-ld-locale.patch "${FILESDIR}"/efivar-38-glibc-2.36.patch "${FILESDIR}"/efivar-38-lld-fixes.patch + "${FILESDIR}"/efivar-38-efisecdb-musl.patch + "${FILESDIR}"/efivar-38-efisecdb-optarg.patch # Rejected upstream, keep this for ia64 support "${FILESDIR}"/efivar-38-ia64-relro.patch diff --git a/sys-libs/efivar/files/efivar-38-efisecdb-musl.patch b/sys-libs/efivar/files/efivar-38-efisecdb-musl.patch new file mode 100644 index 000000000000..a1bfa631aae1 --- /dev/null +++ b/sys-libs/efivar/files/efivar-38-efisecdb-musl.patch @@ -0,0 +1,179 @@ +From cece3ffd5be2f8641eb694513f2b73e5eb97ffd3 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Fri, 28 Jan 2022 12:13:30 +0100 +Subject: [PATCH] efisecdb: fix build with musl libc + +Refactor code to use POSIX atexit(3) instead of the GNU specific +on_exit(3). + +Resolves: #197 +Resolves: #202 +Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> +--- + src/compiler.h | 2 -- + src/efisecdb.c | 68 +++++++++++++++++++------------------------------- + 2 files changed, 26 insertions(+), 44 deletions(-) + +diff --git a/src/compiler.h b/src/compiler.h +index e2f18f0b..d95fb014 100644 +--- a/src/compiler.h ++++ b/src/compiler.h +@@ -7,8 +7,6 @@ + #ifndef COMPILER_H_ + #define COMPILER_H_ + +-#include <sys/cdefs.h> +- + /* GCC version checking borrowed from glibc. */ + #if defined(__GNUC__) && defined(__GNUC_MINOR__) + # define GNUC_PREREQ(maj,min) \ +diff --git a/src/efisecdb.c b/src/efisecdb.c +index f8823737..6bd5ad90 100644 +--- a/src/efisecdb.c ++++ b/src/efisecdb.c +@@ -25,6 +25,10 @@ + extern char *optarg; + extern int optind, opterr, optopt; + ++static efi_secdb_t *secdb = NULL; ++static list_t infiles; ++static list_t actions; ++ + struct hash_param { + char *name; + efi_secdb_type_t algorithm; +@@ -187,12 +191,11 @@ add_action(list_t *list, action_type_t action_type, const efi_guid_t *owner, + } + + static void +-free_actions(int status UNUSED, void *actionsp) ++free_actions(void) + { +- list_t *actions = (list_t *)actionsp; + list_t *pos, *tmp; + +- for_each_action_safe(pos, tmp, actions) { ++ for_each_action_safe(pos, tmp, &actions) { + action_t *action = list_entry(pos, action_t, list); + + list_del(&action->list); +@@ -202,12 +205,11 @@ free_actions(int status UNUSED, void *actionsp) + } + + static void +-free_infiles(int status UNUSED, void *infilesp) ++free_infiles(void) + { +- list_t *infiles = (list_t *)infilesp; + list_t *pos, *tmp; + +- for_each_ptr_safe(pos, tmp, infiles) { ++ for_each_ptr_safe(pos, tmp, &infiles) { + ptrlist_t *entry = list_entry(pos, ptrlist_t, list); + + list_del(&entry->list); +@@ -216,27 +218,12 @@ free_infiles(int status UNUSED, void *infilesp) + } + + static void +-maybe_free_secdb(int status UNUSED, void *voidp) ++maybe_free_secdb(void) + { +- efi_secdb_t **secdbp = (efi_secdb_t **)voidp; +- +- if (secdbp == NULL || *secdbp == NULL) ++ if (secdb == NULL) + return; + +- efi_secdb_free(*secdbp); +-} +- +-static void +-maybe_do_unlink(int status, void *filep) +-{ +- char **file = (char **)filep; +- +- if (status == 0) +- return; +- if (file == NULL || *file == NULL) +- return; +- +- unlink(*file); ++ efi_secdb_free(secdb); + } + + static void +@@ -323,15 +310,6 @@ parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb, + return status; + } + +-/* +- * These need to be static globals so that they're not on main's stack when +- * on_exit() fires. +- */ +-static efi_secdb_t *secdb = NULL; +-static list_t infiles; +-static list_t actions; +-static char *outfile = NULL; +- + int + main(int argc, char *argv[]) + { +@@ -351,6 +329,7 @@ main(int argc, char *argv[]) + bool do_sort_data = false; + bool sort_descending = false; + int status = 0; ++ char *outfile = NULL; + + const char sopts[] = ":aAc:dfg:h:i:Lo:rs:t:v?"; + const struct option lopts[] = { +@@ -376,10 +355,9 @@ main(int argc, char *argv[]) + INIT_LIST_HEAD(&infiles); + INIT_LIST_HEAD(&actions); + +- on_exit(free_actions, &actions); +- on_exit(free_infiles, &infiles); +- on_exit(maybe_free_secdb, &secdb); +- on_exit(maybe_do_unlink, &outfile); ++ atexit(free_actions); ++ atexit(free_infiles); ++ atexit(maybe_free_secdb); + + /* + * parse the command line. +@@ -587,24 +565,30 @@ main(int argc, char *argv[]) + outfd = open(outfile, flags, 0600); + if (outfd < 0) { + char *tmpoutfile = outfile; +- if (errno == EEXIST) +- outfile = NULL; ++ if (errno != EEXIST) ++ unlink(outfile); + err(1, "could not open \"%s\"", tmpoutfile); + } + + rc = ftruncate(outfd, 0); +- if (rc < 0) ++ if (rc < 0) { ++ unlink(outfile); + err(1, "could not truncate output file \"%s\"", outfile); ++ } + + void *output; + size_t size = 0; + rc = efi_secdb_realize(secdb, &output, &size); +- if (rc < 0) ++ if (rc < 0) { ++ unlink(outfile); + secdb_err(1, "could not realize signature list"); ++ } + + rc = write(outfd, output, size); +- if (rc < 0) ++ if (rc < 0) { ++ unlink(outfile); + err(1, "could not write signature list"); ++ } + + close(outfd); + xfree(output); diff --git a/sys-libs/efivar/files/efivar-38-efisecdb-optarg.patch b/sys-libs/efivar/files/efivar-38-efisecdb-optarg.patch new file mode 100644 index 000000000000..612395efbe18 --- /dev/null +++ b/sys-libs/efivar/files/efivar-38-efisecdb-optarg.patch @@ -0,0 +1,51 @@ +From df09b472419466987f2f30176dd00937e640aa9a Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Fri, 28 Jan 2022 12:29:00 +0100 +Subject: [PATCH] efisecdb: do not free optarg + +The *outfile passed to parse_input_files can only be either set to +optarg or be NULL. optarg should not be free'd and NULL does not need +to. + +Since we no longer use on_exit to unlink outfile we also don't need to +set *outfile to NULL. + +Fixes commit d91787035bc1 (efisecdb: add efisecdb) + +Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> +--- + src/efisecdb.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/src/efisecdb.c b/src/efisecdb.c +index 6bd5ad90..70fa1847 100644 +--- a/src/efisecdb.c ++++ b/src/efisecdb.c +@@ -255,8 +255,7 @@ list_guids(void) + * failure. + */ + static int +-parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb, +- bool dump) ++parse_input_files(list_t *infiles, efi_secdb_t **secdb, bool dump) + { + int status = 0; + list_t *pos, *tmp; +@@ -297,8 +296,6 @@ parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb, + if (!dump) + exit(1); + status = 1; +- xfree(*outfile); +- *outfile = NULL; + break; + } + } +@@ -528,7 +525,7 @@ main(int argc, char *argv[]) + efi_secdb_set_bool(secdb, EFI_SECDB_SORT_DATA, do_sort_data); + efi_secdb_set_bool(secdb, EFI_SECDB_SORT_DESCENDING, sort_descending); + +- status = parse_input_files(&infiles, &outfile, &secdb, dump); ++ status = parse_input_files(&infiles, &secdb, dump); + if (status == 0) { + for_each_action_safe(pos, tmp, &actions) { + action_t *action = list_entry(pos, action_t, list); |