bugzilla.mozilla.org will be intermittently unavailable on Saturday, March 24th, from 16:00 until 20:00 UTC.

User files cert8.db and key3.db are silently not created on some distros, later causes segfault.




Security: PSM
10 years ago
7 years ago


(Reporter: Dan Razzell, Unassigned)



Firefox Tracking Flags

(Not tracked)



(3 attachments)



10 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20080311 Firefox/
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20080311 Firefox/

We're seeing an issue in which Firefox silently fails to create cert8.db and key3.db on some Linux systems when run by a new user.  Later in the startup this causes Firefox to report "Could not initialize the browser security component", after which attempts by the user to select Preferences -> Advanced -> View Certificates result in a segfault.  A stack trace is noted below.

Possibly the system is missing some necessary capability for generating the database files, but from the sparse information which Firefox reports, we can't determine what that is.  More error logging is needed to detect where and why the file generation fails.

Reproducible: Always

Steps to Reproduce:
1. Login to a system which exhibits this behavior
2. Perform a fresh Firefox install (not strictly required but demonstrates that the issues is not due to local corruption of the install)
3. Create a new user or remove .mozilla directory from an existing user
4. Run Firefox.
5. Check for existence of database files using
  ls -l ~/.mozilla/firefox/*.default/*.db
6. Note that Firefox reports SSL disabled when connecting over https
7. Trigger segfault in Firefox by selecting Preferences -> Advanced -> View Certificates
Actual Results:  
1) Silently fails to create cert8.db and key3.db

2) Segfault

Expected Results:  
1) Reports meaningful error when unable to create cert8.db and key3.db

2) Performs suitable checks of return values in functions such as PK11_ListCerts and NSS_PutEnv so as to avoid addressing errors.

Stack trace of segfault:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1222870704 (LWP 4378)]
0xb770d318 in NSS_PutEnv () from /data1/packages/firefox/libnss3.so
(gdb) where
#0 0xb770d318 in NSS_PutEnv () from /data1/packages/firefox/libnss3.so
#1 0xb770bb67 in NSS_PutEnv () from /data1/packages/firefox/libnss3.so
#2 0xb76dce5e in PK11_ListCerts () from /data1/packages/firefox/libnss3.so
#3 0x086e85e9 in nsXPTCVariant::Init ()
#4 0xb7f0b573 in XPTC_InvokeByIndex () from
#5 0x080a7980 in nsTHashtable<nsBaseHashtableET<nsDepCharHashKey,
nsAutoPtr<nsINIParser::INIValue> > >::~nsTHashtable$base ()
#6 0x080ad55a in nsTHashtable<nsBaseHashtableET<nsDepCharHashKey,
nsAutoPtr<nsINIParser::INIValue> > >::~nsTHashtable$base ()
#7 0xb7f67d28 in js_Invoke () from /data1/packages/firefox/libmozjs.so
#8 0xb7f6c596 in js_Interpret () from /data1/packages/firefox/libmozjs.so
#9 0xb7f67de3 in js_Invoke () from /data1/packages/firefox/libmozjs.so
#10 0xb7f681c0 in js_InternalInvoke () from
#11 0xb7f44996 in JS_CallFunctionValue () from
#12 0x0844858b in nsReadingIterator<unsigned short>::advance ()
#13 0x084765ed in nsReadingIterator<unsigned short>::advance ()
#14 0x083d2dca in nsReadingIterator<unsigned short>::advance ()
#15 0x083d31c9 in nsReadingIterator<unsigned short>::advance ()
#16 0x0844ccda in nsReadingIterator<unsigned short>::advance ()
#17 0x08272067 in XmlInitUnknownEncodingNS ()
#18 0x0859e2a4 in nsXPTCVariant::Init ()
#19 0x0857ae7d in nsXPTCVariant::Init ()
#20 0x0859dfe5 in nsXPTCVariant::Init ()
#21 0x08582025 in nsXPTCVariant::Init ()
#22 0x08581797 in nsXPTCVariant::Init ()
#23 0x085816ee in nsXPTCVariant::Init ()
#24 0x085814a7 in nsXPTCVariant::Init ()
#25 0x0812ee4c in nsTHashtable<nsBaseHashtableET<nsDepCharHashKey,
nsAutoPtr<nsINIParser::INIValue> > >::~nsTHashtable$base ()
#26 0x0821b1e7 in XmlInitUnknownEncodingNS ()
#27 0x0821b859 in XmlInitUnknownEncodingNS ()
#28 0x0821a817 in XmlInitUnknownEncodingNS ()
#29 0x08219069 in XmlInitUnknownEncodingNS ()
#30 0xb67ba0b8 in NSGetModule () from
#31 0x0812b9fd in nsTHashtable<nsBaseHashtableET<nsDepCharHashKey,
nsAutoPtr<nsINIParser::INIValue> > >::~nsTHashtable$base ()
#32 0x0812b771 in nsTHashtable<nsBaseHashtableET<nsDepCharHashKey,
nsAutoPtr<nsINIParser::INIValue> > >::~nsTHashtable$base ()
#33 0xb7edea60 in nsInputStreamReadyEvent::EventHandler () from
#34 0xb7ef61c7 in PL_HandleEvent () from
#35 0xb7ef611a in PL_ProcessPendingEvents () from
#36 0xb7ef77bc in nsEventQueueImpl::CheckForDeactivation () from
#37 0x0824d490 in XmlInitUnknownEncodingNS ()
#38 0xb78ee86d in g_io_channel_unix_get_fd () from /lib/libglib-2.0.so.0
#39 0xb78c5272 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#40 0xb78c824f in g_main_context_check () from /lib/libglib-2.0.so.0
#41 0xb78c85f9 in g_main_loop_run () from /lib/libglib-2.0.so.0
#42 0xb7bb7b84 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#43 0x0824d734 in XmlInitUnknownEncodingNS ()
#44 0x086ae39c in nsXPTCVariant::Init ()
#45 0x0807d345 in nsXPTCStubBase::Stub229 ()
#46 0x08ea44b0 in ?? ()
#47 0x00000000 in ?? ()
(gdb) quit
Bouncing to PSM since these files are managed there, not in front-end.  I can't confirm this, don't have access to a linux box right now.
Assignee: nobody → kaie
Component: Security → Security: PSM
Product: Firefox → Core
QA Contact: firefox → psm

Comment 2

10 years ago
could you please rebuild w/ --enable-debugger-info-modules --disable-strip --without(-sucky)-distro-patches

it may be that you can't include that last one, but please start with it, and if you can't reproduce with it, well, then you'll want to bisect the patch set until you can attach the single --with-magical-distro-patch=this_causes_gecko_to_get_sick.

once you have rebuilt with debugging information you can debug like everyone else:

in the future, please don't post stack traces from builds without symbols (comment 0 has one, it's virtually useless). (preemptively) note that in general output from strace is virtually never requested in the rare cases (and this would be one), you should use something like:

./run-mozilla.sh `which strace` -f ./firefox-bin
redirect the output to file(s) and use "add an attachment" to attach them (don't paste the output!).

actually, most likely we'd be much more interested in a stack trace to a failed open() than in strace output hinting that an open can fail.  and given that we're open source, you should be able to use gdb to set a breakpoint on open and catch the right one....

kaie: we already have bugs about nss initialization failing and certain components skipping the nss-init paths, my guess is this is along those lines...

Comment 3

10 years ago
Sorry, I don't have the means to compile and test.  I'm just reporting a bug here.

Comment 4

10 years ago
hrm, is this a mozilla.org build? and is talkback installed?

can you try using a firefox 3 rc? (those include crashreporter instead of talkback)

for now, i think i'll settle for the output from strace (as an attachment) if i can't get you to do anything else.

Comment 5

10 years ago
Created attachment 323929 [details]
strace up to point where error popup appears

Trace produced on first run where Firefox is creating the user profile.  For brevity, this trace stops at point of first error popup, at which we know something is amiss.

In comparison to normal trace, note how there has been no attempt to stat or create cert8.db and key3.db.

Comment 6

10 years ago
Created attachment 323931 [details]
trace of successful run for comparison


10 years ago
Attachment #323929 - Attachment mime type: text/plain → application/x-gzip

Comment 7

10 years ago

Are you running as root or did you use sudo or something? typically running x applications as root is a bad idea, and running web browsers as root is asking for someone to take over your computer....

note that gecko is not likely to work properly if you give it someone else's home directory (to which you can't write) and ask it to do things (yes, we'll try to fix bugs as someone gives us useful details).

stat64("/secmod.db", 0xbfe2df60)        = -1 ENOENT (No such file or directory)


fwiw the successful run isn't running as root.

Comment 8

10 years ago
Root is not the issue, as we can perform the same test on another system as root and it works fine.  This particular test system, at this time, does not support user logins.  Firefox is running with -display set to a remote X server.

Please understand that ultimately there is probably something missing on the test system, something which we suppose Firefox needs in order to generate the database files.  But it silently fails to report this.  That's the first issue.  The second, and probably consequent, issue of course is the segfault.

Comment 9

10 years ago
Firefox 3.0rc2 behaves similarly in silently failing to create cert8.db and key3.db on the test system.

It does not raise a "Could not initialize the browser security component" window, and it does not segfault when attempting to list certificates.

Comment 10

10 years ago
can you provide an strace from the crashing system not using root?

Comment 11

10 years ago
Created attachment 324510 [details]
strace up to point where error popup appears (second example)

Repeat of previous example showing trace up to point where error popup appears.  This time run as user test rather than as root.  Slight variation at end of trace is probably a result of suspending the process this time when taking a copy of the trace log.  In the previous example I had just let the process block.

Comment 12

8 years ago
Mass change owner of unconfirmed "Core:Security UI/PSM/SMime" bugs to nobody.
Search for kaie-20100607-unconfirmed-nobody
Assignee: kaie → nobody

Comment 13

8 years ago
timeless,  mail to Dan fails "invalid mailbox". So if strace in comment 11 is not what you need then feel free to close the bug.
Severity: normal → critical
Keywords: crash

Comment 14

7 years ago
yeah, from memory it didn't. sorry :(.
Last Resolved: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.