Skip to content

Use Heap instead of UnsafeCell in DOM reflectors#15118

Merged
bors-servo merged 1 commit intoservo:masterfrom
jdm:reflector-barrier-crash
Jan 25, 2017
Merged

Use Heap instead of UnsafeCell in DOM reflectors#15118
bors-servo merged 1 commit intoservo:masterfrom
jdm:reflector-barrier-crash

Conversation

@jdm
Copy link
Copy Markdown
Member

@jdm jdm commented Jan 19, 2017

The previous Reflector implementation did not use post barriers, so we could crash when storing nursery objects in a Reflector structure that were later moved out of the nursery.


This change is Reviewable

@highfive highfive assigned ghost Jan 19, 2017
@highfive
Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/promise.rs, components/script/dom/bindings/reflector.rs
  • @KiChjang: components/script/dom/promise.rs, components/script/dom/bindings/reflector.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 19, 2017
@jdm
Copy link
Copy Markdown
Member Author

jdm commented Jan 19, 2017

r? @Ms2ger

@highfive highfive assigned Ms2ger and unassigned ghost Jan 19, 2017
@Ms2ger
Copy link
Copy Markdown
Contributor

Ms2ger commented Jan 20, 2017

I noticed that trace_reflector calls CallUnbarrieredObjectTracer; would that need to be changed as well?

@jdm jdm force-pushed the reflector-barrier-crash branch from 842eff5 to 3fe9521 Compare January 20, 2017 16:29
@jdm
Copy link
Copy Markdown
Member Author

jdm commented Jan 20, 2017

You are correct. I have updated the code to account for that.

@jdm jdm force-pushed the reflector-barrier-crash branch from 3fe9521 to e5eaab3 Compare January 20, 2017 16:32
@jdm
Copy link
Copy Markdown
Member Author

jdm commented Jan 20, 2017

@bors-servo: try

@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Trying commit e5eaab3 with merge 469a3f4...

bors-servo pushed a commit that referenced this pull request Jan 20, 2017
Use Heap instead of UnsafeCell in DOM reflectors

The previous `Reflector` implementation did not use post barriers, so we could crash when storing nursery objects in a `Reflector` structure that were later moved out of the nursery.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #15085
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15118)
<!-- Reviewable:end -->
@bors-servo
Copy link
Copy Markdown
Contributor

@Ms2ger
Copy link
Copy Markdown
Contributor

Ms2ger commented Jan 23, 2017

I don't see anything wrong with this, but would feel more comfortable if you had someone from the SM GC side have a look too. (Feel free to take this as r+ either way.)

@jdm
Copy link
Copy Markdown
Member Author

jdm commented Jan 23, 2017

10:31 <jonco> jdm: this means you're using the equivalent of JS::Heap<> to store the reflector object right?
10:31 <jdm> jonco: yes
10:31 <jonco> jdm: that sounds good

@bors-servo: r=Ms2ger

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit e5eaab3 has been approved by Ms2ger

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 23, 2017
@jonco3
Copy link
Copy Markdown

jonco3 commented Jan 23, 2017

Using Heap is the right thing to do here. I have minimal knowledge of rust, but this looks good to me.

/// required by the JSAPI rooting APIs.
pub fn rootable(&self) -> *mut *mut JSObject {
self.object.get()
pub fn rootable(&self) -> &Heap<*mut JSObject> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be &mut instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I argue that we can discuss that separately, since the changes here achieve the same effect as previously existed.

@jdm
Copy link
Copy Markdown
Member Author

jdm commented Jan 23, 2017

@bors-servo: r=Ms2ger

@bors-servo
Copy link
Copy Markdown
Contributor

💡 This pull request was already approved, no need to approve it again.

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit e5eaab3 has been approved by Ms2ger

@Ms2ger
Copy link
Copy Markdown
Contributor

Ms2ger commented Jan 24, 2017

@bors-servo try-

@Ms2ger
Copy link
Copy Markdown
Contributor

Ms2ger commented Jan 24, 2017

@bors-servo retry

@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit e5eaab3 with merge 2b91bb3...

bors-servo pushed a commit that referenced this pull request Jan 24, 2017
Use Heap instead of UnsafeCell in DOM reflectors

The previous `Reflector` implementation did not use post barriers, so we could crash when storing nursery objects in a `Reflector` structure that were later moved out of the nursery.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #15085
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15118)
<!-- Reviewable:end -->
@bors-servo
Copy link
Copy Markdown
Contributor

💔 Test failed - windows-gnu-dev

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jan 24, 2017
@Ms2ger
Copy link
Copy Markdown
Contributor

Ms2ger commented Jan 24, 2017

@bors-servo retry servo/saltfs#585

@jdm
Copy link
Copy Markdown
Member Author

jdm commented Jan 24, 2017

@bors-servo: r-

@mbrubeck
Copy link
Copy Markdown
Contributor

@bors-servo r=Ms2ger

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit e5eaab3 has been approved by Ms2ger

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Jan 24, 2017
@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit e5eaab3 with merge 023a9c5...

bors-servo pushed a commit that referenced this pull request Jan 24, 2017
Use Heap instead of UnsafeCell in DOM reflectors

The previous `Reflector` implementation did not use post barriers, so we could crash when storing nursery objects in a `Reflector` structure that were later moved out of the nursery.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #15085
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15118)
<!-- Reviewable:end -->
@bors-servo
Copy link
Copy Markdown
Contributor

@bors-servo bors-servo merged commit e5eaab3 into servo:master Jan 25, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jan 25, 2017
@Ms2ger Ms2ger deleted the reflector-barrier-crash branch February 3, 2017 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Promise rooting is not sound

7 participants