Closed Bug 544370 Opened 15 years ago Closed 15 years ago

Duplicate-function checking can generate bogus CorruptABC errors

Categories

(Tamarin Graveyard :: Virtual Machine, defect, P2)

x86
macOS
defect

Tracking

(Not tracked)

VERIFIED FIXED
flash10.1

People

(Reporter: stejohns, Assigned: stejohns)

Details

Attachments

(2 files, 3 obsolete files)

The fix for jitted invokers (https://bugzilla.mozilla.org/show_bug.cgi?id=529833) caused a subtle difference in the way we check for duplicate functions. In MethodEnv::startCoerce we check for mismatched ScopeTypeChain, and if they don't agree, we throw a verifyerror. The problem is that if a given MethodInfo calls OP_newfunction on itself during verification, it ends up creating a new (but equivalent) ScopeTypeChain. This formerly was not a problem, as the mismatched-Scope-check was done prior to the verify, but now, it's done afterwards.
Attached patch Patch (obsolete) — Splinter Review
Initial patch attempt: this adds some intelligence to makeIntoPrototypeFunction to determine if the new ScopeTypeChain being created is equivalent to the one already in use, and if so, just use the existing one. (Aside from fixing the scope-mismatch check issue, this saves a trivial amount of memory.) Question: should we simply throw kVerifyError if the scopes aren't mismatched?
Assignee: nobody → stejohns
Attachment #425317 - Flags: review?(edwsmith)
Attached patch Optimization (obsolete) — Splinter Review
Here's an optimization (addititive to the previous patch, which was purely a fix) that occurred to me during the fix... this allows us to move the scope-mismatch check out of startCoerce entirely by making a custom invoker function used only for duplicated functions. Not sure if this optimization is worth the gyrations it involves, so not asking for a review, mostly just capturing the change here to avoid losing it.
Attached patch Patch #2 (obsolete) — Splinter Review
Upon reflection and discussion, it appears that this chunk of code is really meant to do two things: (1) reject functions that get called with different scopes, but (2) work around an old ASC bug that would cause some functions to inject an "OP_newfunction" call for themself inside their function body. This patch should allow us the best of both worlds: it accepts the existing SWFs with the redundant OP_newfunction, but rejects fuzzed SWFs that try to use different scopes. And, it remove the call-time check entirely.
Attachment #425317 - Attachment is obsolete: true
Attachment #425324 - Attachment is obsolete: true
Attachment #425514 - Flags: review?(edwsmith)
Attachment #425317 - Flags: review?(edwsmith)
Flags: flashplayer-qrb+
Priority: -- → P2
Target Milestone: --- → flash10.1
Attached patch Patch #3Splinter Review
Slightly tweaked patch that improves compatibility.
Attachment #425514 - Attachment is obsolete: true
Attachment #426143 - Flags: review?(edwsmith)
Attachment #425514 - Flags: review?(edwsmith)
Attachment #426143 - Flags: review?(edwsmith) → review+
Comment on attachment 426143 [details] [diff] [review] Patch #3 Verifier.cpp:757 the expression (f->method_id() == int32_t(imm30) && curScope->equals(scope)) is redundant. when (f->method_id() == imm30), f == info, and therefore curScope == scope. You could add an assert to that effect and simplify the if. R+ with that tweak.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
verified in argo d9751032bce9 and e498e2cd5da8
Status: RESOLVED → VERIFIED
Regression test derived from reading comment 0; validated by confirming that it fails to verify on rev 3796 and that it successfully verifies on rev 3797.
(In reply to Felix S Klock II from comment #8) > Created attachment 581929 [details] [diff] [review] > patch T: regression test > > Regression test derived from reading comment 0; validated by confirming that > it fails to verify on rev 3796 and that it successfully verifies on rev 3797. Above described how I validated that this test was "sufficient" for guarding against a regression. I have now also validated that this test is necessary, by injecting the bug into the current code base and rerunning the acceptance tests; without patch T, all the acceptance tests pass, and thus fail to catch the problem.
changeset: 6791:7f9cea0cb693 user: Felix S Klock II <fklockii@adobe.com> summary: Bug 544370: regression test (r=fklockii). http://hg.mozilla.org/tamarin-redux/rev/7f9cea0cb693
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: