Replace dangling pointer workaround with a patch from upstream

This commit is contained in:
Adam Williamson 2023-04-06 11:06:30 -07:00
parent ed6e518933
commit 12fcec8a23
2 changed files with 83 additions and 4 deletions

78
nss-3.89-dangling.patch Normal file
View File

@ -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

View File

@ -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