firefox crashed with SIGSEGV in NSSRWLock_LockRead_Util()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| Mozilla Firefox |
Fix Released
|
Critical
|
||
| firefox-3.0 (Ubuntu) |
High
|
Unassigned | ||
| firefox-3.5 (Ubuntu) |
High
|
Unassigned |
Bug Description
Binary package hint: firefox-3.0
Don't really know what I did but it obviously crashed...
ProblemType: Crash
Architecture: i386
Date: Mon Jun 2 19:16:26 2008
DistroRelease: Ubuntu 8.04
ExecutablePath: /usr/lib/
Package: firefox-3.0 3.0~rc1+
PackageArchitec
ProcCmdline: /usr/lib/
ProcEnviron:
PATH=/
LANG=en_DK.UTF-8
SHELL=/bin/bash
Signal: 11
SourcePackage: firefox-3.0
StacktraceTop:
NSSRWLock_
SECMOD_GetReadLock () from /usr/lib/
PK11_GetAllTokens () from /usr/lib/
PK11_GetBestSl
PK11_GetBestSlot () from /usr/lib/
Title: firefox crashed with SIGSEGV in NSSRWLock_
Uname: Linux 2.6.24-17-generic i686
UserGroups: adm admin audio cdrom dialout dip floppy fuse lpadmin plugdev sambashare vboxusers video
Related branches
Explain how it is that this process is not initializing NSS until after it
has run so long that it is already in an out-of-memory condition.
|
#3 |
Nelson, Mozilla software will not access PSM unless it has a need to. And only when PSM gets accessed the first time it will init NSS.
|
#4 |
According to my understanding, it seems reasonable to start by getting a lock, and only afterwards try to get the module list.
But I don't know! I don't know this code well.
Looking at http://
it appears that usually the module list is obtained first, and only afterwards the lock is obtained and locked.
I suspect that the lock is only required for modifying the contents of the lock?
The crash report comment quoted here and the reports i read show this probably *is* early in startup.
I think we use the hashing bits as part of the update service and it seems likely it'd be nearly the first crypto bit to be hit.
please note that i use systems where memory is often but not always scarce. It isn't legal to assume early allocs will succeed any more than it is to assume late ones will.
is there a public contract for "HASH_Create" somewhere?
|
#6 |
Ouch...
The NSS contract is NO nss calls are made until NSS is initialized (period). We guarrentee you a crash if you do.
To date, PSM has been the only user of NSS inside a mozilla app.
If someone outside PSM is calling NSS directly, they, at the very least, need to do the minimal xpcom calls to access the crypto object (exported by PSM). Simply setting up that object will guarrentee NSS is initialized properly.
That does not necessarily mean you are home free (PSM keeps track of the NSS objects it creates to make sure it closes them all down if mozilla wants to switch users, for instance, as well as keeps track that mozilla isn't in the middle of shutting down (to make sure no calls are made after NSS is shutdown).
bob
> I suspect that the lock is only required for modifying the contents of the
> lock?
No, the lock is required for both reading and writing. Looking at the code, it's clear it should be acquired before getting the list (as adding, and removal could in theory change the pointer).
In practice the first module is the softoken, which is never removed (though it may change character), so such a bug is unlikely to show up. (Actually changes to the module list is extremely rarer anyway. Adding and deleting pkcs #11 modules in mozilla are the only way it happens in any real application that I know of.
right, I claim that the patch I'm providing here is correct based on your comments. And I'd like it to be taken.
I think that PSM itself may be violating the NSS initialization constraint, but this bug is about flaws in the NSS code. I'll deal w/ any PSM errors in another bug.
Kaie: i think comment 6 should be sufficient for you to r+ attachment 314290
Binary package hint: firefox-3.0
Don't really know what I did but it obviously crashed...
ProblemType: Crash
Architecture: i386
Date: Mon Jun 2 19:16:26 2008
DistroRelease: Ubuntu 8.04
ExecutablePath: /usr/lib/
Package: firefox-3.0 3.0~rc1+
PackageArchitec
ProcCmdline: /usr/lib/
ProcEnviron:
PATH=/
LANG=en_DK.UTF-8
SHELL=/bin/bash
Signal: 11
SourcePackage: firefox-3.0
StacktraceTop:
NSSRWLock_
SECMOD_GetReadLock () from /usr/lib/
PK11_GetAllTokens () from /usr/lib/
PK11_GetBestSl
PK11_GetBestSlot () from /usr/lib/
Title: firefox crashed with SIGSEGV in NSSRWLock_
Uname: Linux 2.6.24-17-generic i686
UserGroups: adm admin audio cdrom dialout dip floppy fuse lpadmin plugdev sambashare vboxusers video
|
#11 |
Just got this crash: http://
Bob's comment 6 should be interpreted as saying this:
Crashing is the DEFINED BEHAVIOR of NSS when NSS functions are called
before NSS is initialized. It is the caller's responsibility to ensure
that NSS is initialized before calling other NSS functions (besides
NSS initialization functions).
So, by definition, this is NOT an NSS bug.
TWO NSS module owners have now spoken on this subject.
Nelson, where should we move this bug to to get the needed attention (and an acceptable patch)?
Samuel: I think I just moved it to the right place when I added comment 10.
Oh, sorry. I missed that in the Bug Activity. Thanks!
|
#16 |
I think we've got the same topcrash on branch, would be nice to fix this there as well if the patch gets reviews and such.
|
#17 |
nsNSSModule.cpp has its own copied+modified XPCOM constructors.
Those are designed to do the following:
- if the interface requested means we create an instance of
class nsNSSComponent, then proceed (because that class
implements the code that is needed to init NSS)
- if the above is not true, then we first jump through function
EnsureNSSInit
The crashing code is in nsCryptoHash, which uses the correct macro that tries to achieve the latter.
If this bug is because NSS was not initialized, it means either
- the EnsureNSSInitia
or
- you have shut NSS. You might have sent out a profile changed notification, but not yet switched to a new profile
The existing PSM code assumes that you'll never use any of PSM services while you are in the middle of a profile switch.
|
#18 |
We should trace the calls to
NSS_InitReadWrite
NSS_Shutdown
HASH_Create
If we see calls in the above order, then we've found the cause of the bug.
We must find a way to ensure it never happens.
|
#19 |
Oops. We missed something when nsICryptoHash got implemented in bug 415799.
=> nsNSSShutDownObject
nsCryptoHash and nsCryptoHMAC contain a handle to an NSS object that gets invalid at time of NSS shutdown.
We should have made these classes derive from nsNSSShutDownOb
|
#20 |
timeless: it is really pity you didn't get the JS stack when it crashed. Do you know about a way to reproduce it?
The theory with the update service seems to me right. I experienced some crashes while closing firefox and its autoupdate was in progress (there were active download).
|
#21 |
Just for report: I created fake update file on my local server and I emulate the auto update being in progress in background. When I shutdown Minefield it does NOT crash - tried 10 times...
The theory with update service will probably be wrong because: nsUpdateService
this was a crash report based bug. i didn't experience it. i saw it in reports and picked a series of paths which aren't correct to patch. they're still not correct. fwiw, it's easy to tell if a crash isn't mine. I only run XP, so if the crash report i pick is vista (6.*) then it can't be mine :).
that psm is broken is quite likely (mentioned in comment 0).
do note that the crash report i picked has a very nice comment in the comments field. :)
|
#23 |
Kai: is a patch based on comment 17 likely soon, and if so would it be small? I guess we won't 'block' the current release (since we're trying to wrap it up) but we'd really like to make this crash go away if we can.
|
#24 |
(In reply to comment #21)
> Kai: is a patch based on comment 17 likely soon, and if so would it be small? I
> guess we won't 'block' the current release (since we're trying to wrap it up)
> but we'd really like to make this crash go away if we can.
We don't know if implementing what I mention in comment 17 will cure the crash.
It might only help us to understand more.
|
#25 |
Created attachment 323866
derivation from nss shutdown object
Tested using firefox restart from add-ons dialog. This won't fix the crash.
|
#26 |
I see this popping up to #6 on the topcrash list using a one day sample for RC2.
|
#27 |
If anyone can reproduce this, please, list the JS callstack using xpc3250!
|
#28 |
Comment on attachment 323866
derivation from nss shutdown object
Honza, thanks for working on this patch.
Could you please follow the style that other code implementing nsNSSShutdownObject is using?
For example, please look at nsNSSCertCache.
In the destructor, you should use the locker, check for isAlreadyShutDown.
In virtualDestroyN
I would recommend you rearrance the code so that you have the same functions called virtualDestroyN
|
#29 |
Created attachment 325550
derivation from nss shutdown object, 2
StacktraceTop:
SECMOD_GetReadLock () from /usr/lib/
PK11_GetAllTokens () from /usr/lib/
PK11_GetBestSlo
PK11_GetBestSlot () from /usr/lib/
Changed in firefox-3.0: | |
importance: | Undecided → Medium |
|
#32 |
Not blocking at this point, but topcrash+ (#1 topcrash on OSX) so let's see if we can get a safe patch in.
|
#33 |
Got this crash on Windows once today:
bp-e34de6cf-
Kai, does this patch look good? This is currently the #4 topcrash and we'd love to see it fixed in 3.0.2 (and, really 2.0.0.x).
|
#35 |
Would be really nice to get this into 1.9.0.2/1.8.1.17
Not going to block on this for 1.9.0.2 (and likely 1.8.1.17). The patches aren't reviewed or landed and this will likely need bake time.
Note that Bug 450468 has a rather similar stack, but not identical.
That appears to be in PRNG code, while this bug is in hash code.
|
#38 |
update: we still don't know what causes the crash, the patches in this bug are not a cure for the crash.
Changed in firefox-3.0: | |
status: | New → Triaged |
Changed in firefox: | |
status: | Unknown → Confirmed |
|
#39 |
I know this bug was originally filed as a Windows Vista bug, but I'm getting [@ NSSRWLock_
If it's alright, I can provide my crash reports (though I don't have any stack traces available =/ ). If I'm in the wrong place or you'd like a separate bug to be filed, do let me know.
Comment on attachment 314289
don't assume allocs won't fail and lock before reading
Clearing review request per comment 34.
Changed in firefox: | |
status: | Confirmed → Fix Released |
Changed in firefox: | |
status: | Fix Released → In Progress |
Changed in firefox: | |
status: | In Progress → Fix Released |
Changed in firefox: | |
status: | Fix Released → In Progress |
I wonder if going off-line several seconds before shutting down the browser
would help.
|
#86 |
Created attachment 387852
v2 for trunk, 1.9.1
Marking haveLoaded = false when we shutdown nss from nsNSSComponent. This really should prevent to get any psm component while nss is not at the moment initialized.
We should also apply the attachment 325550.
|
#87 |
Created attachment 387853
v2 for 1.8.1
Bug 505223 is almost certainly a duplicate of this bug. It contains a stack showing that nsCryptoHash::Init is being called while in NS_ShutdownXPCOM_P .
|
#89 |
*** Bug 505223 has been marked as a duplicate of this bug. ***
|
#90 |
Kai: any ETA on a fix here? This is blocking our next release which we're trying to square away earlier rather than later.
Comment on attachment 384744
v1 for trunk [Checkin comment 73]
I'm assuming these two are obsolete...
|
#92 |
Comment on attachment 325550
derivation from nss shutdown object, 2
(In reply to comment #86)
> (From update of attachment 384744 [details])
> I'm assuming these two are obsolete...
No, it is not, I point out in comment 81 we should also take it.
Uh... then we should really do a combined patch instead of separate ones...
|
#94 |
Nominating this topcrash for 1.9.0.13 since it looks like these fixes will land on 1.9.1 before then.
|
#95 |
Comment on attachment 325550
derivation from nss shutdown object, 2
This patch is good. It adds protection for the "NSS shutdown race" to the nsCryptoHash and nsCryptoHMAC objects, the same protection we already use for other PSM objects that store references to NSS objects.
r=kaie
|
#96 |
Comment on attachment 387852
v2 for trunk, 1.9.1
r=kaie
|
#97 |
Comment on attachment 387852
v2 for trunk, 1.9.1
|
#98 |
Created attachment 391336
v2, as laned on m-c [Checkin comment 92]
|
#99 |
Created attachment 391359
v1+v2 merged for 1.9.1
attachment 384744 and attachment 391336 folded and merged to 1.9.1.
|
#100 |
Created attachment 391368
v1+v2 merged for 1.9.1 [Checkin comment 101]
This is the correct one...
Comment on attachment 391368
v1+v2 merged for 1.9.1 [Checkin comment 101]
This *just* landed on mozilla-central. I don't think we can take it in 1.9.1.2.
|
#102 |
Created attachment 391397
v1+v2 merged for 1.9.0 [Checkin comment 102]
Changed in firefox: | |
status: | In Progress → Fix Released |
|
#103 |
Created attachment 391554
v1+v2 merged for 1.8.1
|
#104 |
Comment on attachment 391368
v1+v2 merged for 1.9.1 [Checkin comment 101]
Approved for 1.9.1.3, a=dveditz for release-drivers
|
#105 |
Comment on attachment 391397
v1+v2 merged for 1.9.0 [Checkin comment 102]
Approved for 1.9.0.14, a=dveditz for release-drivers
|
#106 |
Comment on attachment 391368
v1+v2 merged for 1.9.1 [Checkin comment 101]
http://
|
#107 |
Comment on attachment 391397
v1+v2 merged for 1.9.0 [Checkin comment 102]
Checking in security/
/cvsroot/
new revision: 1.170; previous revision: 1.169
done
Checking in security/
/cvsroot/
new revision: 1.55; previous revision: 1.54
Micah Gersten (micahg) wrote : | #108 |
This is set to be released in Firefox 3.5.3 and Firefox 3.0.14
Changed in firefox-3.5 (Ubuntu): | |
importance: | Undecided → High |
status: | New → Triaged |
Changed in firefox-3.0 (Ubuntu): | |
importance: | Medium → High |
|
#109 |
This fixed the topcrash; there have been no reports of crashes at NSSRWLock_
tags: | added: fixed-3.0.14 fixed-3.5.3 |
It still occurs in 3.5.2
Currently #8 in 3.5.2 topcrashes
http://
|
#111 |
It was fixed for Gecko 1.9.1.3 per the flags above, meaning that Firefox 3.5.3 should no longer show the issue.
Launchpad Janitor (janitor) wrote : | #112 |
This bug was fixed in the package firefox-3.0 - 3.0.14+
---------------
firefox-3.0 (3.0.14+
* security/stability v3.0.14 build2 (FIREFOX_
- see USN-821-1
- fix LP: #236853 - firefox crashed with SIGSEGV in NSSRWLock_
-- Alexander Sack <email address hidden> Mon, 07 Sep 2009 14:27:50 +0200
Changed in firefox-3.0 (Ubuntu): | |
status: | Triaged → Fix Released |
Launchpad Janitor (janitor) wrote : | #113 |
This bug was fixed in the package firefox-3.5 - 3.5.3+build1+
---------------
firefox-3.5 (3.5.3+
* security/stability update v3.5.3 build1 (FIREFOX_
- see USN-821-1
- fix LP: #333127 - Firefox 3.5 and above crash on full screen flash video
- fix LP: #236853 - firefox crashed with SIGSEGV in NSSRWLock_
[ Alexander Sack <email address hidden> ]
* fix LP: #422365 - apport hook fails because profiles_d is not initialized
in add_info if no profiles.ini exist; we ensure that profiles_d gets instantiated
as an empty map even if no profiles.ini exist.
- update debian/
* hook firefox-
directory to support localized distro search engines.
- update debian/rules
* in case localized search engines are available the main searchplugins
directory is not scanned anymore; to fix this we provide a compatibility
link /usr/lib/
- update debian/
* fix localized search engine upstream code to properly deal with general.
being a complex pref; also change plugin dir order to allow locale specific searchplugins
to overlay the ones shipped in "searchplugins/
- add debian/
- update debian/
[ Jamie Strandboge <email address hidden> ]
* add AppArmor profile (disabled by default) (LP: #382917)
- debian/
- add debian/
and upgrades to this version
- debian/
- add debian/
directories
- add debian/
- debian/rules: install profile
- add debian/
- debian/
not disabled
- debian/
-- Alexander Sack <email address hidden> Thu, 03 Sep 2009 10:03:08 +0200
Changed in firefox-3.5 (Ubuntu): | |
status: | Triaged → Fix Released |
leeshih49@msn.com (leeshih49) wrote : | #114 |
JUST DO IT
Changed in firefox-3.0 (Ubuntu): | |
assignee: | nobody → leeshih49@msn.com (leeshih49) |
status: | Fix Released → New |
Changed in firefox-3.5 (Ubuntu): | |
status: | Fix Released → New |
Changed in firefox-3.0 (Ubuntu): | |
status: | New → Won't Fix |
Changed in firefox-3.5 (Ubuntu): | |
status: | New → Fix Released |
Changed in firefox-3.0 (Ubuntu): | |
assignee: | leeshih49@msn.com (leeshih49) → nobody |
status: | Won't Fix → Fix Released |
John Vivirito (gnomefreak) wrote : | #115 |
Please see https:/
it was fixed for 3.5
This should have been fixed in 3.0 see:
firefox-3.0 (3.0.14+
* security/stability v3.0.14 build2 (FIREFOX_
- see USN-821-1
- fix LP: #236853 - firefox crashed with SIGSEGV in NSSRWLock_
-- Alexander Sack <email address hidden> Mon, 07 Sep 2009 14:27:50 +0200
hardy and up has been fixed. please make sure you are at latest version and try using a new profile following the instructions on the following link:
https:/
John Vivirito (gnomefreak) wrote : | #116 |
Also please do not assign bugs to yourself unless you plan on fixing them.
when you reopen a bug please set it to incomplete or confirmed if it was confirmed.
Make sure you have hardy-security repos enabled
Changed in firefox-3.0 (Ubuntu): | |
assignee: | nobody → Peter J Castle (p-j-castle) |
John Vivirito (gnomefreak) wrote : | #117 |
Please do not assign yourself to bugs unless you plan on fixing it. thanks
Please see my comment above your last comment
Changed in firefox-3.0 (Ubuntu): | |
assignee: | Peter J Castle (p-j-castle) → nobody |
coachlaw10 (coachlaw10) wrote : | #118 |
how do I fix this problem?
Changed in firefox-3.0 (Ubuntu): | |
status: | Fix Released → Fix Committed |
Micah Gersten (micahg) wrote : | #119 |
@Carl Cameron
Please do not change the status of Fix Released bugs.
Changed in firefox-3.0 (Ubuntu): | |
status: | Fix Committed → Fix Released |
Changed in firefox-3.0 (Ubuntu): | |
assignee: | nobody → Mark (markd1) |
Micah Gersten (micahg) wrote : | #120 |
Please don't assign yourself bugs unless you are actually working on them. This fix has already been released.
Changed in firefox-3.0 (Ubuntu): | |
assignee: | Mark (markd1) → nobody |
Changed in firefox-3.0 (Ubuntu): | |
status: | Fix Released → Confirmed |
status: | Confirmed → Fix Released |
adsa_a (adsa-a) wrote : | #121 |
good!
Changed in firefox-3.0 (Ubuntu): | |
assignee: | nobody → adsa_a (adsa-a) |
Changed in firefox-3.0 (Ubuntu): | |
status: | Fix Released → Fix Committed |
Changed in firefox-3.5 (Ubuntu): | |
status: | Fix Released → Fix Committed |
Micah Gersten (micahg) wrote : | #122 |
Please don't assign yourself bugs unless you are actually working on them. This fix has already been released.
Changed in firefox-3.0 (Ubuntu): | |
assignee: | adsa_a (adsa-a) → nobody |
status: | Fix Committed → Fix Released |
Changed in firefox-3.5 (Ubuntu): | |
status: | Fix Committed → Fix Released |
Changed in firefox-3.0 (Ubuntu): | |
status: | Fix Released → Fix Committed |
status: | Fix Committed → Fix Released |
status: | Fix Released → Confirmed |
status: | Confirmed → Fix Committed |
status: | Fix Committed → Fix Released |
Changed in firefox: | |
importance: | Unknown → Critical |
|
#124 |
Comment on attachment 391554
v1+v2 merged for 1.8.1
Flag clean up.
oh right, from my naive perspective, this is a topcrash. crash-stats. mozilla. com/report/ list?range_ unit=weeks& version= Firefox% 3A3.0pre& range_value= 2&signature= NSSRWLock_ LockRead_ Util
http://