Closed
Bug 635475
Opened 14 years ago
Closed 14 years ago
nsIdleServiceDaily can cause pointer corruption
Categories
(Core :: Widget, defect)
Core
Widget
Tracking
()
RESOLVED
FIXED
mozilla2.0b12
| Tracking | Status | |
|---|---|---|
| blocking2.0 | --- | final+ |
People
(Reporter: mak, Assigned: mak)
Details
(Keywords: crash, Whiteboard: [softblocker][needs landing])
Attachments
(1 file, 1 obsolete file)
|
5.73 KB,
patch
|
sdwilsh
:
review+
benjamin
:
approval2.0+
|
Details | Diff | Splinter Review |
nsIdleServiceDaily constructor is passing "this" to various other methods that could addref and release it (timer for example), the result I saw locally by making a run on idle is that nsIdleServiceDaily's pointer gets corrupt and we crash badly on idleService initialization.
I have a patch locally to fix this, will attach it here once I split it.
| Assignee | ||
Comment 1•14 years ago
|
||
Attachment #514033 -
Flags: review?(sdwilsh)
Comment 2•14 years ago
|
||
This is something bad that would could see in real life.
blocking2.0: --- → final+
Whiteboard: [softblocker]
Comment 3•14 years ago
|
||
How does adding Init help us in real life? We still end up calling that code in the constructor, so don't we have the same problem still?
| Assignee | ||
Comment 4•14 years ago
|
||
the problem is not the idleService constructor, indeed it passes "this" to nsIdleServiceDaily, but nsIdleServiceDaily uses it as a common weak pointer.
The problem is that nsIdleServiceDaily constructor was passing "this" (nsIdleServiceDaily object) to something that instead wants to own it.
| Assignee | ||
Comment 5•14 years ago
|
||
so the scenario is that nsIdleServiceDaily is created, in the constructor it creates a timer that owns it, but we are already idle, we serve it, the timer gets canceled and destroyed and the reference is freed, freeing nsIdleServiceDaily object itself since we are still in the constructor.
As I said, I reproduced this forcing a idle on start to simulate the environment of our talos boxes.
Adding init the reference count becomes 2, when the timer owns the object.
Comment 6•14 years ago
|
||
Comment on attachment 514033 [details] [diff] [review]
patch v1.0
r=sdwilsh
Attachment #514033 -
Flags: review?(sdwilsh) → review+
| Assignee | ||
Comment 7•14 years ago
|
||
Comment on attachment 514033 [details] [diff] [review]
patch v1.0
Well, this still needs approval since softblockers are not pre-approved.
The change is small enough to limit the risk, this removes a possible source of jumps at random memory addresses.
Attachment #514033 -
Flags: approval2.0?
| Assignee | ||
Comment 8•14 years ago
|
||
Comment on attachment 514033 [details] [diff] [review]
patch v1.0
hm, I'm seeing a second crash in the category cache destructor, I prefer looking at it before proceeding.
Attachment #514033 -
Flags: approval2.0?
| Assignee | ||
Comment 9•14 years ago
|
||
Ah, now this makes sense. The destructor was invoked by the idle service observers TArray destructor, and it was trying to remove itself from the TArray, causing re-entrance in itself. The result was a double invokation of the category cache destructor.
Actually, there is no need at all to remove the daily observer from the array, it is kept alive by mDailyIdle and if it's in the array it's destroyed when both mDailyIdle and the array are destroyed. So also tracking whether it's observing through mObservesIdle is pointless.
Attachment #514033 -
Attachment is obsolete: true
Attachment #514506 -
Flags: review?(sdwilsh)
Comment 10•14 years ago
|
||
Comment on attachment 514506 [details] [diff] [review]
patch v1.1
r=sdwilsh
Attachment #514506 -
Flags: review?(sdwilsh) → review+
| Assignee | ||
Comment 11•14 years ago
|
||
Comment on attachment 514506 [details] [diff] [review]
patch v1.1
Ok, this is good for approval, removes possible risk of pointer corruption on startup and some not useful code.
Attachment #514506 -
Flags: approval2.0?
Comment 12•14 years ago
|
||
Comment on attachment 514506 [details] [diff] [review]
patch v1.1
Isn't this changing an interface and thus not acceptable past add-on compatibility freeze?
| Assignee | ||
Comment 13•14 years ago
|
||
no, this is a pure internal class. it's a helper used internally by the idle service.
Updated•14 years ago
|
Attachment #514506 -
Flags: approval2.0? → approval2.0+
Whiteboard: [softblocker] → [softblocker][needs landing]
| Assignee | ||
Comment 14•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b12
You need to log in
before you can comment on or make changes to this bug.
Description
•