diff -Nru nspr-4.32/debian/changelog nspr-4.35/debian/changelog --- nspr-4.32/debian/changelog 2022-03-24 16:21:32.000000000 +0000 +++ nspr-4.35/debian/changelog 2024-03-21 12:18:35.000000000 +0000 @@ -1,3 +1,11 @@ +nspr (2:4.35-0ubuntu0.22.04.1) jammy-security; urgency=medium + + * Update to 4.35 to support nss security update. + - debian/patches/ac_config_aux_dir: removed, included in new version. + - debian/libnspr3.symbols: added new symbol. + + -- Marc Deslauriers Thu, 21 Mar 2024 08:18:35 -0400 + nspr (2:4.32-3build1) jammy; urgency=high * No change rebuild for ppc64el baseline bump. diff -Nru nspr-4.32/debian/libnspr4.symbols nspr-4.35/debian/libnspr4.symbols --- nspr-4.32/debian/libnspr4.symbols 2021-11-20 22:30:09.000000000 +0000 +++ nspr-4.35/debian/libnspr4.symbols 2024-03-21 12:18:35.000000000 +0000 @@ -181,6 +181,7 @@ PR_GetPeerName@Base 2:4.9-2~ PR_GetPhysicalMemorySize@Base 2:4.9-2~ PR_GetPipeMethods@Base 2:4.9-2~ + PR_GetPrefLoopbackAddrInfo@Base 2:4.34 PR_GetProtoByName@Base 2:4.9-2~ PR_GetProtoByNumber@Base 2:4.9-2~ PR_GetRandomNoise@Base 2:4.9-2~ diff -Nru nspr-4.32/debian/patches/ac_config_aux_dir nspr-4.35/debian/patches/ac_config_aux_dir --- nspr-4.32/debian/patches/ac_config_aux_dir 2021-11-21 00:05:13.000000000 +0000 +++ nspr-4.35/debian/patches/ac_config_aux_dir 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -Index: nspr/nspr/configure.in -=================================================================== ---- nspr.orig/nspr/configure.in -+++ nspr/nspr/configure.in -@@ -8,7 +8,7 @@ AC_PREREQ(2.61) - AC_INIT - AC_CONFIG_SRCDIR([pr/include/nspr.h]) - --AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf) -+AC_CONFIG_AUX_DIR(build/autoconf) - AC_CANONICAL_TARGET - - dnl ======================================================== diff -Nru nspr-4.32/debian/patches/series nspr-4.35/debian/patches/series --- nspr-4.32/debian/patches/series 2021-11-21 00:04:47.000000000 +0000 +++ nspr-4.35/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -ac_config_aux_dir diff -Nru nspr-4.32/nspr/.hg_archival.txt nspr-4.35/nspr/.hg_archival.txt --- nspr-4.32/nspr/.hg_archival.txt 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/.hg_archival.txt 2022-09-12 11:40:15.000000000 +0000 @@ -1,4 +1,4 @@ repo: a4b34919bf34db2ee22acbbc305693c8980b6dc6 -node: 40050f21eeeddfdc919f42f7552fcbf472f7b9e4 +node: b563bfc16c887c48b038b7b441fcc4e40a126d3b branch: default -tag: NSPR_4_32_RTM +tag: NSPR_4_35_RTM diff -Nru nspr-4.32/nspr/configure nspr-4.35/nspr/configure --- nspr-4.32/nspr/configure 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/configure 2022-09-12 11:40:15.000000000 +0000 @@ -2486,7 +2486,7 @@ program_prefix=${target_alias}- MOD_MAJOR_VERSION=4 -MOD_MINOR_VERSION=32 +MOD_MINOR_VERSION=35 MOD_PATCH_VERSION=0 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= diff -Nru nspr-4.32/nspr/configure.in nspr-4.35/nspr/configure.in --- nspr-4.32/nspr/configure.in 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/configure.in 2022-09-12 11:40:15.000000000 +0000 @@ -8,14 +8,14 @@ AC_INIT AC_CONFIG_SRCDIR([pr/include/nspr.h]) -AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf) +AC_CONFIG_AUX_DIR(build/autoconf) AC_CANONICAL_TARGET dnl ======================================================== dnl = Defaults dnl ======================================================== MOD_MAJOR_VERSION=4 -MOD_MINOR_VERSION=32 +MOD_MINOR_VERSION=35 MOD_PATCH_VERSION=0 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= diff -Nru nspr-4.32/nspr/pr/include/md/_linux.cfg nspr-4.35/nspr/pr/include/md/_linux.cfg --- nspr-4.32/nspr/pr/include/md/_linux.cfg 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/include/md/_linux.cfg 2022-09-12 11:40:15.000000000 +0000 @@ -499,7 +499,7 @@ #elif defined(__mips__) /* For _ABI64 */ -#include +#include #ifdef __MIPSEB__ #define IS_BIG_ENDIAN 1 @@ -1250,6 +1250,52 @@ #define PR_ALIGN_OF_FLOAT 4 #define PR_ALIGN_OF_DOUBLE 8 #define PR_ALIGN_OF_POINTER 8 +#define PR_ALIGN_OF_WORD 8 + +#define PR_BYTES_PER_WORD_LOG2 3 +#define PR_BYTES_PER_DWORD_LOG2 3 + +#elif defined(__loongarch64) + +#undef IS_BIG_ENDIAN +#define IS_LITTLE_ENDIAN 1 +#define IS_64 + +#define PR_BYTES_PER_BYTE 1 +#define PR_BYTES_PER_SHORT 2 +#define PR_BYTES_PER_INT 4 +#define PR_BYTES_PER_INT64 8 +#define PR_BYTES_PER_LONG 8 +#define PR_BYTES_PER_FLOAT 4 +#define PR_BYTES_PER_DOUBLE 8 +#define PR_BYTES_PER_WORD 8 +#define PR_BYTES_PER_DWORD 8 + +#define PR_BITS_PER_BYTE 8 +#define PR_BITS_PER_SHORT 16 +#define PR_BITS_PER_INT 32 +#define PR_BITS_PER_INT64 64 +#define PR_BITS_PER_LONG 64 +#define PR_BITS_PER_FLOAT 32 +#define PR_BITS_PER_DOUBLE 64 +#define PR_BITS_PER_WORD 64 + +#define PR_BITS_PER_BYTE_LOG2 3 +#define PR_BITS_PER_SHORT_LOG2 4 +#define PR_BITS_PER_INT_LOG2 5 +#define PR_BITS_PER_INT64_LOG2 6 +#define PR_BITS_PER_LONG_LOG2 6 +#define PR_BITS_PER_FLOAT_LOG2 5 +#define PR_BITS_PER_DOUBLE_LOG2 6 +#define PR_BITS_PER_WORD_LOG2 6 + +#define PR_ALIGN_OF_SHORT 2 +#define PR_ALIGN_OF_INT 4 +#define PR_ALIGN_OF_LONG 8 +#define PR_ALIGN_OF_INT64 8 +#define PR_ALIGN_OF_FLOAT 4 +#define PR_ALIGN_OF_DOUBLE 8 +#define PR_ALIGN_OF_POINTER 8 #define PR_ALIGN_OF_WORD 8 #define PR_BYTES_PER_WORD_LOG2 3 diff -Nru nspr-4.32/nspr/pr/include/md/_linux.h nspr-4.35/nspr/pr/include/md/_linux.h --- nspr-4.32/nspr/pr/include/md/_linux.h 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/include/md/_linux.h 2022-09-12 11:40:15.000000000 +0000 @@ -73,6 +73,8 @@ #define _PR_SI_ARCHITECTURE "nds32" #elif defined(__xtensa__) #define _PR_SI_ARCHITECTURE "xtensa" +#elif defined(__loongarch64) +#define _PR_SI_ARCHITECTURE "loongarch64" #else #error "Unknown CPU architecture" #endif @@ -141,6 +143,18 @@ #define _MD_ATOMIC_SET _PR_x86_64_AtomicSet #endif +#if defined(__loongarch__) +#if defined(__GNUC__) +/* Use GCC built-in functions */ +#define _PR_HAVE_ATOMIC_OPS +#define _MD_INIT_ATOMIC() +#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1) +#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1) +#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i) +#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv) +#endif +#endif + #if defined(__or1k__) #if defined(__GNUC__) /* Use GCC built-in functions */ diff -Nru nspr-4.32/nspr/pr/include/prinit.h nspr-4.35/nspr/pr/include/prinit.h --- nspr-4.32/nspr/pr/include/prinit.h 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/include/prinit.h 2022-09-12 11:40:15.000000000 +0000 @@ -31,9 +31,9 @@ ** The format of the version string is ** ".[.] []" */ -#define PR_VERSION "4.32" +#define PR_VERSION "4.35" #define PR_VMAJOR 4 -#define PR_VMINOR 32 +#define PR_VMINOR 35 #define PR_VPATCH 0 #define PR_BETA PR_FALSE diff -Nru nspr-4.32/nspr/pr/include/private/pprthred.h nspr-4.35/nspr/pr/include/private/pprthred.h --- nspr-4.32/nspr/pr/include/private/pprthred.h 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/include/private/pprthred.h 2022-09-12 11:40:15.000000000 +0000 @@ -301,9 +301,9 @@ ---------------------------------------------------------------------------*/ #ifdef XP_UNIX -extern void PR_XLock(void); -extern void PR_XUnlock(void); -extern PRBool PR_XIsLocked(void); +extern void _PR_XLock(void); +extern void _PR_XUnlock(void); +extern PRBool _PR_XIsLocked(void); #endif /* XP_UNIX */ PR_END_EXTERN_C diff -Nru nspr-4.32/nspr/pr/include/prnetdb.h nspr-4.35/nspr/pr/include/prnetdb.h --- nspr-4.32/nspr/pr/include/prnetdb.h 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/include/prnetdb.h 2022-09-12 11:40:15.000000000 +0000 @@ -428,6 +428,9 @@ NSPR_API(void *) PR_EnumerateAddrInfo( void *enumPtr, const PRAddrInfo *addrInfo, PRUint16 port, PRNetAddr *result); +NSPR_API(PRStatus) PR_GetPrefLoopbackAddrInfo(PRNetAddr *result, + PRUint16 port); + /*********************************************************************** ** FUNCTION: ** DESCRIPTION: PR_GetCanonNameFromAddrInfo() diff -Nru nspr-4.32/nspr/pr/src/io/prsocket.c nspr-4.35/nspr/pr/src/io/prsocket.c --- nspr-4.32/nspr/pr/src/io/prsocket.c 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/src/io/prsocket.c 2022-09-12 11:40:15.000000000 +0000 @@ -322,7 +322,7 @@ #if defined(_WIN64) if (fd->secret->overlappedActive) { PRInt32 rvSent; - if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == FALSE) { + if (GetOverlappedResult((HANDLE)osfd, &fd->secret->ol, &rvSent, FALSE) == FALSE) { err = WSAGetLastError(); PR_LOG(_pr_io_lm, PR_LOG_MIN, ("SocketConnectContinue GetOverlappedResult failed %d\n", err)); @@ -354,7 +354,7 @@ if (fd->secret->overlappedActive) { PR_ASSERT(fd->secret->nonblocking); PRInt32 rvSent; - if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) { + if (GetOverlappedResult((HANDLE)osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) { fd->secret->overlappedActive = PR_FALSE; PR_LOG(_pr_io_lm, PR_LOG_MIN, ("SocketConnectContinue GetOverlappedResult succeeded\n")); diff -Nru nspr-4.32/nspr/pr/src/md/unix/unix.c nspr-4.35/nspr/pr/src/md/unix/unix.c --- nspr-4.32/nspr/pr/src/md/unix/unix.c 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/src/md/unix/unix.c 2022-09-12 11:40:15.000000000 +0000 @@ -2755,8 +2755,8 @@ _md_iovector._mmap64 = mmap64; #if (defined(ANDROID) && __ANDROID_API__ < 21) /* Same as the open64 case for Android. */ - _md_iovector._fstat64 = fstat; - _md_iovector._stat64 = stat; + _md_iovector._fstat64 = (_MD_Fstat64)fstat; + _md_iovector._stat64 = (_MD_Stat64)stat; #else _md_iovector._fstat64 = fstat64; _md_iovector._stat64 = stat64; @@ -3301,36 +3301,21 @@ ** in a pre-emptive threaded environment, we need to use a lock. */ -void PR_XLock(void) +void _PR_XLock(void) { PR_EnterMonitor(_pr_Xfe_mon); } -void PR_XUnlock(void) +void _PR_XUnlock(void) { PR_ExitMonitor(_pr_Xfe_mon); } -PRBool PR_XIsLocked(void) +PRBool _PR_XIsLocked(void) { return (PR_InMonitor(_pr_Xfe_mon)) ? PR_TRUE : PR_FALSE; } -void PR_XWait(int ms) -{ - PR_Wait(_pr_Xfe_mon, PR_MillisecondsToInterval(ms)); -} - -void PR_XNotify(void) -{ - PR_Notify(_pr_Xfe_mon); -} - -void PR_XNotifyAll(void) -{ - PR_NotifyAll(_pr_Xfe_mon); -} - #if defined(HAVE_FCNTL_FILE_LOCKING) PRStatus @@ -3656,7 +3641,8 @@ int events = filedes[i].events; PRBool fdHasEvent = PR_FALSE; - if (osfd < 0) { + PR_ASSERT(osfd < FD_SETSIZE); + if (osfd < 0 || osfd >= FD_SETSIZE) { continue; /* Skip this osfd. */ } @@ -3701,6 +3687,10 @@ if (filedes[i].fd < 0) { continue; } + if (filedes[i].fd >= FD_SETSIZE) { + filedes[i].revents |= POLLNVAL; + continue; + } if (FD_ISSET(filedes[i].fd, &rd)) { if (filedes[i].events & POLLIN) { filedes[i].revents |= POLLIN; diff -Nru nspr-4.32/nspr/pr/src/md/unix/uxwrap.c nspr-4.35/nspr/pr/src/md/unix/uxwrap.c --- nspr-4.32/nspr/pr/src/md/unix/uxwrap.c 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/src/md/unix/uxwrap.c 2022-09-12 11:40:15.000000000 +0000 @@ -187,10 +187,10 @@ needToLockXAgain = 0; if (rd && (_pr_xt_hack_fd != -1) - && FD_ISSET(_pr_xt_hack_fd, rd) && PR_XIsLocked() + && FD_ISSET(_pr_xt_hack_fd, rd) && _PR_XIsLocked() && (!_pr_xt_hack_okayToReleaseXLock || _pr_xt_hack_okayToReleaseXLock())) { - PR_XUnlock(); + _PR_XUnlock(); needToLockXAgain = 1; } @@ -198,7 +198,7 @@ retVal = _PR_WaitForMultipleFDs(unixpds, pdcnt, timeout); if (needToLockXAgain) { - PR_XLock(); + _PR_XLock(); } } diff -Nru nspr-4.32/nspr/pr/src/md/windows/w95sock.c nspr-4.35/nspr/pr/src/md/windows/w95sock.c --- nspr-4.32/nspr/pr/src/md/windows/w95sock.c 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/src/md/windows/w95sock.c 2022-09-12 11:40:15.000000000 +0000 @@ -491,7 +491,7 @@ if ( rv < 0 ) { return -1; } - rv = GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE); + rv = GetOverlappedResult((HANDLE)osfd, &fd->secret->ol, &rvSent, FALSE); if ( rv == TRUE ) { return rvSent; } else { diff -Nru nspr-4.32/nspr/pr/src/misc/prnetdb.c nspr-4.35/nspr/pr/src/misc/prnetdb.c --- nspr-4.32/nspr/pr/src/misc/prnetdb.c 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/src/misc/prnetdb.c 2022-09-12 11:40:15.000000000 +0000 @@ -2178,6 +2178,73 @@ #endif } +PR_IMPLEMENT(PRStatus) +PR_GetPrefLoopbackAddrInfo(PRNetAddr *result, + PRUint16 port) +{ + char tmpBuf[ 40 ]; + const int tmpBufSize = sizeof( tmpBuf ); + + if (!result) { + PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); + return PR_FAILURE; + } + + if (!_pr_initialized) _PR_ImplicitInitialization(); + + PR_snprintf(tmpBuf, tmpBufSize, "%u", port ); + +#if !defined(_PR_HAVE_GETADDRINFO) || !defined(AI_PASSIVE) + PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); + return PR_FAILURE; +#else + + PRADDRINFO *res, hints; + PRStatus rv; + + memset(&hints, 0, sizeof(hints)); + + rv = GETADDRINFO(NULL, tmpBuf, &hints, &res); + if (rv == 0) { + PRBool result_still_empty = PR_TRUE; + PRADDRINFO *ai = res; + do { + PRNetAddr aNetAddr; + + while (ai && ai->ai_addrlen > sizeof(PRNetAddr)) + ai = ai->ai_next; + + if (ai) { + /* copy sockaddr to PRNetAddr */ + memcpy(&aNetAddr, ai->ai_addr, ai->ai_addrlen); + aNetAddr.raw.family = ai->ai_addr->sa_family; +#ifdef _PR_INET6 + if (AF_INET6 == aNetAddr.raw.family) + aNetAddr.raw.family = PR_AF_INET6; +#endif + if (ai->ai_addrlen < sizeof(PRNetAddr)) + memset(((char*)result)+ai->ai_addrlen, 0, + sizeof(PRNetAddr) - ai->ai_addrlen); + } + + /* If we obtain more than one result, prefer IPv6. */ + if (result_still_empty || aNetAddr.raw.family == PR_AF_INET6) { + memcpy(result, &aNetAddr, sizeof(PRNetAddr)); + } + result_still_empty = PR_FALSE; + ai = ai->ai_next; + } + while (ai); + + FREEADDRINFO(res); + return PR_SUCCESS; + } + + PR_SetError(PR_DIRECTORY_LOOKUP_ERROR, rv); + return PR_FAILURE; +#endif +} + PR_IMPLEMENT(void) PR_FreeAddrInfo(PRAddrInfo *ai) { #if defined(_PR_HAVE_GETADDRINFO) diff -Nru nspr-4.32/nspr/pr/src/misc/prsystem.c nspr-4.35/nspr/pr/src/misc/prsystem.c --- nspr-4.32/nspr/pr/src/misc/prsystem.c 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/src/misc/prsystem.c 2022-09-12 11:40:15.000000000 +0000 @@ -206,7 +206,11 @@ size_t len = sizeof(numCpus); mib[0] = CTL_HW; +#ifdef HW_NCPUONLINE + mib[1] = HW_NCPUONLINE; +#else mib[1] = HW_NCPU; +#endif rc = sysctl( mib, 2, &numCpus, &len, NULL, 0 ); if ( -1 == rc ) { numCpus = -1; /* set to -1 for return value on error */ diff -Nru nspr-4.32/nspr/pr/src/nspr.def nspr-4.35/nspr/pr/src/nspr.def --- nspr-4.32/nspr/pr/src/nspr.def 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/src/nspr.def 2022-09-12 11:40:15.000000000 +0000 @@ -462,3 +462,7 @@ PR_DuplicateEnvironment; PR_GetEnvSecure; ;+} NSPR_4.10.3; +;+NSPR_4.34 { +;+ global: + PR_GetPrefLoopbackAddrInfo; +;+} NSPR_4.12; diff -Nru nspr-4.32/nspr/pr/tests/vercheck.c nspr-4.35/nspr/pr/tests/vercheck.c --- nspr-4.32/nspr/pr/tests/vercheck.c 2021-06-30 21:43:23.000000000 +0000 +++ nspr-4.35/nspr/pr/tests/vercheck.c 2022-09-12 11:40:15.000000000 +0000 @@ -42,7 +42,7 @@ "4.10.10", "4.11", "4.12", "4.13", "4.14", "4.15", "4.16", "4.17", "4.18", "4.19", "4.20", "4.21", "4.22", "4.23", "4.24", "4.25", "4,26", "4.27", "4.28", "4.29", - "4.30", "4.31", + "4.30", "4.31", "4.32", "4.33", "4.34", PR_VERSION }; @@ -58,8 +58,8 @@ "3.0", "3.0.1", "3.1", "3.1.1", "3.1.2", "3.1.3", "3.5", "3.5.1", - "4.32.1", - "4.33", "4.33.1", + "4.35.1", + "4.36", "4.36.1", "10.0", "11.1", "12.14.20" };