Closed Bug 256642 Opened 21 years ago Closed 21 years ago

LIFO deallocation causes crash!

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8alpha4

People

(Reporter: osfo, Assigned: brendan)

References

Details

(4 keywords, Whiteboard: [have patch])

Attachments

(1 file)

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) Build Identifier: N.A. We have found that the following two lines in JS_ArenaFreeAllocation expoes the spidermonkey of deallocations of unpredictable nature. if (pool->current == a) pool->current = &pool->first; After repositioning the current pool pointer we may come to a situation in which we have managed to allocate a number of bytes by using free bytes in already allocated arenas in the tempPool, without having to allocate new memory, nor having needed to fetch a new pool from the set of free arenas. If this happens we will possibly deallocate memory that is still in use. This is because cg2mark which is stored in TOK_FUNCTION of emitTree will point to a pool which is not the last arena in the pool but rarher a arena in which a sufficient number of bytes have been found that allows us to store the needed structures. The result after having emitted the function body is that the tempPool is pruned from c2gmark, which will mean that active memory may be deallocated. Reproducible: Always Steps to Reproduce: It is very hard to describe the precise reproduction steps, the crash is dependant on a number of different factors such as: the DEBUG configuration set, what kind of native memory allocation algorithm is implemented, and the configuration of the target environment such as arena sizes. Actual Results: I have seen: ZPEs, Asserts in interpritation, as well as OS memory exceptions. Expected Results: Instead of the two lines in JS_ArenaFreeAllocation, however ambitious they are in concerning using any remaining bytes in the allocated areanas, it seems that we must repostion to the last arena to avoid the described problems. N.A.
This is a bad bug that's been around a while. Might explain some tellme.com folks' reports. /be
Assignee: general → brendan
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.8a4+
Flags: blocking1.7.3+
Flags: blocking-aviary1.0PR+
Keywords: crash
*** Bug 256693 has been marked as a duplicate of this bug. ***
Status: NEW → ASSIGNED
Keywords: js1.5
Priority: -- → P1
Target Milestone: --- → mozilla1.8alpha4
Attached patch proposed fixSplinter Review
One-liner, good for what ails us here. This bug was introduced when I exteneded JS bytecodes to include the JOF_JUMPX extended jump formats, and implemented span-dependent instruction selection in the code generator. It must have been byting people randomly, very sporadically, for it to be fixed at this late date. Better late than never! Many thanks to Oscar et al. who reported and diagnosed the problem. /be
Attachment #157262 - Flags: review?(shaver)
Attachment #157262 - Flags: review?(shaver) → review+
Comment on attachment 157262 [details] [diff] [review] proposed fix We need this fix -- it's the classic one-line subtle crash bugfix you all love to take in the end-game, even on the last day. But I didn't want to hold it back till then... ;-) /be
Attachment #157262 - Flags: approval1.7.3?
Attachment #157262 - Flags: approval-aviary?
Whiteboard: [have patch]
Comment on attachment 157262 [details] [diff] [review] proposed fix a=chofmann for aviary and 1.7 branches
Attachment #157262 - Flags: approval1.7.x?
Attachment #157262 - Flags: approval1.7.x+
Attachment #157262 - Flags: approval-aviary?
Attachment #157262 - Flags: approval-aviary+
Fixed on branches. /be
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Keywords: fixed1.7fixed1.7.x
Flags: testcase-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: