Skip to content

fix: use a WeakPtr so we do not UAF the store in FunctionLifetimeMonitor#22056

Merged
MarshallOfSound merged 1 commit intomasterfrom
weak-ptr-function-monitor
Feb 9, 2020
Merged

fix: use a WeakPtr so we do not UAF the store in FunctionLifetimeMonitor#22056
MarshallOfSound merged 1 commit intomasterfrom
weak-ptr-function-monitor

Conversation

@MarshallOfSound
Copy link
Member

We already did this for the ObjectLifeMonitor, should also do it for the FunctionLifetimeMonitor

Notes: Fixed issue where renderers could crash during GC when using the contextBridge module

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Feb 5, 2020
Copy link
Contributor

@loc loc left a comment

Choose a reason for hiding this comment

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

lgtm

@MarshallOfSound MarshallOfSound force-pushed the weak-ptr-function-monitor branch from 4502022 to a80b985 Compare February 5, 2020 23:38

private:
context_bridge::RenderFramePersistenceStore* store_;
base::WeakPtr<context_bridge::RenderFramePersistenceStore> store_;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be reasonable to eagerly delete the FLMs when the store is deleted? rather than leaving them hanging around until they happen to wake up and notice they're useless now since their store is gone

Copy link
Member Author

Choose a reason for hiding this comment

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

@nornagon They will all be deleted at the same time (give or take some milliseconds). The store is only ripped out when the context is destroyed. The function monitors will be ripped apart during the final GC run

@jkleinsc jkleinsc requested a review from nornagon February 6, 2020 20:59
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened recently label Feb 6, 2020
@MarshallOfSound MarshallOfSound merged commit dafbf04 into master Feb 9, 2020
@release-clerk
Copy link

release-clerk bot commented Feb 9, 2020

Release Notes Persisted

Fixed issue where renderers could crash during GC when using the contextBridge module

@trop
Copy link
Contributor

trop bot commented Feb 9, 2020

I have automatically backported this PR to "7-1-x", please check out #22112

@trop trop bot removed the target/7-1-x label Feb 9, 2020
@trop
Copy link
Contributor

trop bot commented Feb 9, 2020

I have automatically backported this PR to "9-x-y", please check out #22113

@trop
Copy link
Contributor

trop bot commented Feb 9, 2020

I have automatically backported this PR to "8-x-y", please check out #22114

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.

4 participants