Closed Bug 317692 Opened 20 years ago Closed 20 years ago

loading libfreebl3.so fails with NSS 3_11_RC1

Categories

(NSS :: Libraries, defect, P1)

3.11
x86
Linux
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: KaiE, Assigned: wtc)

Details

I compiled MOZILLA_1_8_0_BRANCH with NSPR_4_6_1_RC1 and NSS_3_11_RC1. It fails during NSS_InitReadWrite, I traced it down the the point where NSS tries to load libfreebl3.so. See the following gdb debug sessions, I marked the interesting places with ############## Breakpoint 2 at 0x2aaab393326f: file nssinit.c, line 510. Breakpoint 8 at 0x2aaab3b0ae8f: file pkcs11.c, line 2972. [Switching to Thread 46912506072160 (LWP 25465)] Breakpoint 2, NSS_InitReadWrite (configdir=0x6da3a8 "/home/kaie/.mozilla/default/xxxxxxxx.slt") at nssinit.c:510 510 return nss_Init(configdir, "", "", SECMOD_DB, PR_FALSE, (gdb) c Continuing. Breakpoint 8, nsc_CommonInitialize (pReserved=0x7fffffb07470, isFIPS=0) at pkcs11.c:2972 2972 rv = RNG_RNGInit(); /* initialize random number generator */ (gdb) s RNG_RNGInit () at loader.c:927 927 if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) (gdb) s freebl_RunLoaderOnce () at loader.c:337 337 status = PR_CallOnce(&once, &freebl_LoadDSO); (gdb) print once $13 = {initialized = 0, inProgress = 0, status = PR_SUCCESS} (gdb) break freebl_LoadDSO Breakpoint 13 at 0x2aaab3b23631: file loader.c, line 301. (gdb) c Continuing. Breakpoint 13, freebl_LoadDSO () at loader.c:301 301 const char * name = getLibName(); (gdb) n 303 if (!name) { (gdb) n 308 handle = bl_LoadLibrary(name); (gdb) n 309 if (handle) { ############## (gdb) n 328 return PR_FAILURE; (gdb) print handle $14 = (BLLibrary *) 0x0 (gdb) print name $15 = 0x2aaab3b4288c "libfreebl3.so" ############## ... next debug session follows ... #0 freebl_LoadDSO () at loader.c:301 301 const char * name = getLibName(); (gdb) n 303 if (!name) { (gdb) print name $16 = 0x2aaab394288c "libfreebl3.so" (gdb) n 308 handle = bl_LoadLibrary(name); (gdb) s bl_LoadLibrary (name=0x2aaab394288c "libfreebl3.so") at loader.c:202 202 BLLibrary *lib = NULL; (gdb) n 204 char* softokenPath = NULL; (gdb) 205 char* fullName = NULL; (gdb) 208 libSpec.type = PR_LibSpec_Pathname; (gdb) 209 lib = PR_NEWZAP(BLLibrary); (gdb) [Thread 1094719840 (LWP 25510) exited] 210 if (NULL == lib) { (gdb) 222 fn_addr = (PRFuncPtr) &bl_LoadLibrary; (gdb) 223 softokenPath = PR_GetLibraryFilePathname(softoken, fn_addr); (gdb) 226 if (softokenPath) { (gdb) print softokenPath $17 = 0x11c4650 "./libsoftokn3.so" (gdb) n 228 char* originalSoftokenPath = bl_GetOriginalPathname(softokenPath); (gdb) 229 if (originalSoftokenPath) { (gdb) print originalSoftokenPath $18 = 0x12f00d0 "/home/kaie/moz/180-with-nss311/obj-test/nss/softokn/libsoftokn3.so" ############## note, /home/kaie/moz/180-with-nss311/obj-test/nss/softokn/libsoftokn3.so does exist, so far so good, but it probably was not the intention to follow this file from the dist directory back to the build directory... (gdb) n 230 PR_Free(softokenPath); (gdb) 231 softokenPath = originalSoftokenPath; (gdb) 233 c = strrchr(softokenPath, PR_GetDirectorySeparator()); (gdb) 234 if (c) { (gdb) 235 size_t softoknPathSize = 1 + c - softokenPath; (gdb) 236 fullName = (char*) PORT_Alloc(strlen(name) + softoknPathSize + 1); (gdb) 237 if (fullName) { (gdb) 238 memcpy(fullName, softokenPath, softoknPathSize); (gdb) print fullName $19 = 0x80e2b0 "\b)\003/;" (gdb) n 239 strcpy(fullName + softoknPathSize, name); (gdb) print fullName $20 = 0x80e2b0 "/home/kaie/moz/180-with-nss311/obj-test/nss/softokn/", '' <repeats 20 times>, "? (gdb) n 242 PR_Free(softokenPath); (gdb) print fullName $21 = 0x80e2b0 "/home/kaie/moz/180-with-nss311/obj-test/nss/softokn/libfreebl3.so" ############## note, /home/kaie/moz/180-with-nss311/obj-test/nss/softokn/libfreebl3.so does NOT exist (gdb) n 244 if (fullName) { (gdb) 249 libSpec.value.pathname = fullName; (gdb) 250 lib->dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL); (gdb) n 251 PORT_Free(fullName); (gdb) print lib->dlh $22 = (PRLibrary *) 0x0 (gdb) n 253 if (!lib->dlh) { (gdb) 257 libSpec.value.pathname = name; (gdb) 258 lib->dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL); (gdb) print name $23 = 0x2aaab394288c "libfreebl3.so" (gdb) n 260 if (NULL == lib->dlh) { (gdb) print lib->dlh $24 = (PRLibrary *) 0x0 (gdb) n 264 PR_Free(lib); (gdb) n 265 lib = NULL; (gdb) n 267 return lib; (gdb) 268 } (gdb) freebl_LoadDSO () at loader.c:309 309 if (handle) { (gdb) 328 return PR_FAILURE; (gdb) bt 15 #0 freebl_LoadDSO () at loader.c:328 #1 0x00002aaaab2dd42c in PR_CallOnce (once=0x2aaab3a58600, func=0x2aaab3923629 <freebl_LoadDSO>) at /home/kaie/moz/180-with-nss311/mozilla/nsprpub/pr/src/misc/prinit.c:809 #2 0x00002aaab3923744 in freebl_RunLoaderOnce () at loader.c:337 #3 0x00002aaab3924ccd in RNG_RNGInit () at loader.c:927 #4 0x00002aaab390ae94 in nsc_CommonInitialize (pReserved=0x7ffffffd3a80, isFIPS=0) at pkcs11.c:2972 #5 0x00002aaab390b0c7 in NSC_Initialize (pReserved=0x7ffffffd3a80) at pkcs11.c:3052 #6 0x00002aaab3758090 in secmod_ModuleInit (mod=0x111c450, alreadyLoaded=0x7ffffffd3af4) at pk11load.c:150 #7 0x00002aaab37585ef in SECMOD_LoadPKCS11Module (mod=0x111c450) at pk11load.c:322 #8 0x00002aaab37639dc in SECMOD_LoadModule ( modulespec=0x111dc70 " name=\"NSS Internal PKCS #11 Module\" parameters=\"configdir='/home/kaie/.mozilla/default/98ap5uix.slt' certPrefix='' keyPrefix='' secmod='secmod.db' flags=optimizeSpace manufacturerID='Mozilla.org' li"..., parent=0x11cd770, recurse=1) at pk11pars.c:323 #9 0x00002aaab3763a46 in SECMOD_LoadModule ( modulespec=0x11c3470 "name=\"PSM Internal Crypto Services\" parameters=\"configdir='/home/kaie/.mozilla/default/98ap5uix.slt' certPrefix='' keyPrefix='' secmod='secmod.db' flags=optimizeSpace manufacturerID='Mozilla.org' lib"..., parent=0x0, recurse=1) at pk11pars.c:338 #10 0x00002aaab3733142 in nss_Init (configdir=0x6da3a8 "/home/kaie/.mozilla/default/98ap5uix.slt", certPrefix=0x2aaab37ad9c9 "", keyPrefix=0x2aaab37ad9c9 "", secmodName=0x2aaab37adb79 "secmod.db", readOnly=0, noCertDB=0, noModDB=0, forceOpen=0, noRootInit=0, optimizeSpace=1, noSingleThreadedModules=0, allowAlreadyInitializedModules=0, dontFinalizeModules=0) at nssinit.c:467 #11 0x00002aaab37332d0 in NSS_InitReadWrite (configdir=0x6da3a8 "/home/kaie/.mozilla/default/98ap5uix.slt") at nssinit.c:510 #12 0x00002aaab331d83a in nsNSSComponent::InitializeNSS (this=0x110bd50, showWarningBox=1) at /home/kaie/moz/180-with-nss311/mozilla/security/manager/ssl/src/nsNSSComponent.cpp:1393 #13 0x00002aaab331e6fa in nsNSSComponent::Init (this=0x110bd50) at /home/kaie/moz/180-with-nss311/mozilla/security/manager/ssl/src/nsNSSComponent.cpp:1556 #14 0x00002aaab332c79d in nsNSSComponentConstructor (aOuter=0x0, aIID=@0x2aaab33724a0, aResult=0x7ffffffd40e0) at /home/kaie/moz/180-with-nss311/mozilla/security/manager/ssl/src/nsNSSModule.cpp:157 (More stack frames follow...)
Severity: normal → blocker
Priority: -- → P1
Kai, Your debugging should focus on why the PR_LoadLibraryWithFlags call at loader.c:258 fails. In order for that call to succeed, libfreebl3.so needs to be in a directory on your LD_LIBRARY_PATH. You need to modify mozilla/security/manager/Makefile.in to install libfreebl3.so in $(DIST)/bin, which is added to LD_LIBRARY_PATH (as ${MOZ_DIST_BIN}) in run-mozilla.sh. See http://lxr.mozilla.org/seamonkey/source/build/unix/run-mozilla.sh#335
One quick experiment is to manually copy libfreebl3.so to $(DIST)/bin, right next to libsoftokn3.so. Does that fix the problem?
Indeed it fixes the problem, thanks.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.