From 12fcec8a233399c735299fcf84b6eed8181558b9 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 6 Apr 2023 11:06:30 -0700 Subject: [PATCH] Replace dangling pointer workaround with a patch from upstream --- nss-3.89-dangling.patch | 78 +++++++++++++++++++++++++++++++++++++++++ nss.spec | 9 ++--- 2 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 nss-3.89-dangling.patch diff --git a/nss-3.89-dangling.patch b/nss-3.89-dangling.patch new file mode 100644 index 0000000..ea4690c --- /dev/null +++ b/nss-3.89-dangling.patch @@ -0,0 +1,78 @@ +diff --git a/cmd/ecperf/ecperf.c b/cmd/ecperf/ecperf.c +--- a/cmd/ecperf/ecperf.c ++++ b/cmd/ecperf/ecperf.c +@@ -51,10 +51,11 @@ + int iters = threadData->iters; + unsigned char sigData[256]; + SECItem sig; + CK_SESSION_HANDLE session; + CK_RV crv; ++ void *tmp = NULL; + + threadData->status = SECSuccess; + threadData->count = 0; + + /* get our thread's session */ +@@ -66,10 +67,11 @@ + } + + if (threadData->isSign) { + sig.data = sigData; + sig.len = sizeof(sigData); ++ tmp = threadData->p2; + threadData->p2 = (void *)&sig; + } + + while (iters--) { + threadData->status = (*op)(session, threadData->p1, +@@ -77,27 +79,33 @@ + if (threadData->status != SECSuccess) { + break; + } + threadData->count++; + } ++ ++ if (threadData->isSign) { ++ threadData->p2 = tmp; ++ } + return; + } + + void + genericThread(void *data) + { + ThreadData *threadData = (ThreadData *)data; + int iters = threadData->iters; + unsigned char sigData[256]; + SECItem sig; ++ void *tmp = NULL; + + threadData->status = SECSuccess; + threadData->count = 0; + + if (threadData->isSign) { + sig.data = sigData; + sig.len = sizeof(sigData); ++ tmp = threadData->p2; + threadData->p2 = (void *)&sig; + } + + while (iters--) { + threadData->status = (*threadData->op)(threadData->p1, +@@ -105,10 +113,14 @@ + if (threadData->status != SECSuccess) { + break; + } + threadData->count++; + } ++ ++ if (threadData->isSign) { ++ threadData->p2 = tmp; ++ } + return; + } + + /* Time iter repetitions of operation op. */ + SECStatus + + diff --git a/nss.spec b/nss.spec index a3347fa..43653a5 100644 --- a/nss.spec +++ b/nss.spec @@ -134,6 +134,11 @@ Patch40: nss-no-dbm-man-page.patch # https://bugzilla.mozilla.org/show_bug.cgi?id=1774659 Patch51: nss-3.79-dbtool.patch +# Fix build with recent GCC 13 +# https://bugzilla.mozilla.org/show_bug.cgi?id=1826650 +# https://bugzilla.mozilla.org/attachment.cgi?id=9327255 +Patch52: nss-3.89-dangling.patch + Patch100: nspr-config-pc.patch Patch101: nspr-gcc-atomics.patch @@ -387,10 +392,6 @@ export XCFLAGS="$XCFLAGS -Wno-error=maybe-uninitialized" # Similarly, but for gcc-11 export XCFLAGS="$XCFLAGS -Wno-array-parameter" -# aaaand gcc-133: -# https://bugzilla.mozilla.org/show_bug.cgi?id=1826650 -export XCFLAGS="$XCFLAGS -Wno-dangling-pointer" - export LDFLAGS=$RPM_LD_FLAGS export DSO_LDOPTS=$RPM_LD_FLAGS