Closed Bug 1640592 Opened 5 years ago Closed 5 years ago

Crash [@ js::CreateRegExpMatchResult] with GC and possible memory corruption

Categories

(Core :: JavaScript Engine, defect, P1)

x86_64
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox-esr68 --- unaffected
firefox76 --- unaffected
firefox77 --- unaffected
firefox78 --- fixed

People

(Reporter: decoder, Assigned: iain)

References

(Regression)

Details

(Keywords: crash, regression, testcase, Whiteboard: [bugmon:update,bisect,confirmed])

Crash Data

Attachments

(4 files)

The following testcase crashes on mozilla-central revision 20200524-3334d8dff757 (debug build, run with --fuzzing-safe --ion-offthread-compile=off):

Object.defineProperty(this, "x", {});
gczeal(14, 10);
"bab".match(/.(?<a>a)(.)/);

Backtrace:

received signal SIGSEGV, Segmentation fault.
#0  0x00005555558b69c0 in js::CreateRegExpMatchResult(JSContext*, JS::Handle<js::RegExpShared*>, JS::Handle<JSString*>, js::MatchPairs const&, JS::MutableHandle<JS::Value>) ()
#1  0x00005555558be629 in RegExpMatcherImpl(JSContext*, JS::Handle<JSObject*>, JS::Handle<JSString*>, int, JS::MutableHandle<JS::Value>) ()
#2  0x00005555558be094 in js::RegExpMatcher(JSContext*, unsigned int, JS::Value*) ()
#3  0x00005555559366a2 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) ()
[...]
#14 0x00005555557addae in main ()
rax	0x7ffff6027018	140737320742936
rbx	0x7ffff4a33730	140737297725232
rcx	0x3082fde7e000	53339163713536
rdx	0x3082fde00000	53339163197440
rsi	0x2	2
rdi	0x7ffff6027000	140737320742912
rbp	0x7fffffffb910	140737488337168
rsp	0x7fffffffb850	140737488336976
r8	0x7fffffffb6e8	140737488336616
r9	0x246550200088	40017554571400
r10	0x4	4
r11	0x3082fde78190	53339163689360
r12	0x7ffff6027000	140737320742912
r13	0x7fffffffb940	140737488337216
r14	0x7ffff6088338	140737321141048
r15	0x3	3
rip	0x5555558b69c0 <js::CreateRegExpMatchResult(JSContext*, JS::Handle<js::RegExpShared*>, JS::Handle<JSString*>, js::MatchPairs const&, JS::MutableHandle<JS::Value>)+512>
=> 0x5555558b69c0 <_ZN2js23CreateRegExpMatchResultEP9JSContextN2JS6HandleIPNS_12RegExpSharedEEENS3_IP8JSStringEERKNS_10MatchPairsENS2_13MutableHandleINS2_5ValueEEE+512>:	cmpq   $0x0,0x8(%rcx)
   0x5555558b69c5 <_ZN2js23CreateRegExpMatchResultEP9JSContextN2JS6HandleIPNS_12RegExpSharedEEENS3_IP8JSStringEERKNS_10MatchPairsENS2_13MutableHandleINS2_5ValueEEE+517>:	jne    0x5555558b69dd <_ZN2js23CreateRegExpMatchResultEP9JSContextN2JS6HandleIPNS_12RegExpSharedEEENS3_IP8JSStringEERKNS_10MatchPairsENS2_13MutableHandleINS2_5ValueEEE+541>

Marking s-s because this involves GC and the crash address looks broken/corrupted.

Attached file Testcase
Assignee: nobody → iireland
Status: NEW → ASSIGNED

The lifetime of the template is tied to the lifetime of the RegExpShared, and every RegExpShared is tenured, so there's no point allocating this in the nursery.

Depends on D76754

Keywords: bugmon
Whiteboard: [bugmon:update,bisect] → [bugmon:update,bisect,confirmed]
Bugmon Analysis: Unable to reproduce bug using the following builds: > mozilla-central 20200526023857-da2c7b0ac9a4 > mozilla-central 20200524212021-3334d8dff757 Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

This bug was introduced when we added named captures in bug 1362154 and is only present in Nightly.

Priority: -- → P1
Regressed by: 1362154
Has Regression Range: --- → yes
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: