Bug 143625 - [Content Extensions] Don't unmap shared memory
Summary: [Content Extensions] Don't unmap shared memory
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-10 18:34 PDT by Alex Christensen
Modified: 2015-04-13 10:56 PDT (History)
3 users (show)

See Also:


Attachments
Patch (4.10 KB, patch)
2015-04-10 18:42 PDT, Alex Christensen
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2015-04-10 18:34:58 PDT
Right now, when the Data object is destroyed, the mmap'd memory is munmap'd.  The memory that is then shared is unmapped underneath us!

This is a partial fix.  We should also make sure that the memory is not munmap'd until there are no more shared memory handles pointing to it, but this makes it useable.
Comment 1 Alex Christensen 2015-04-10 18:42:01 PDT
Created attachment 250551 [details]
Patch
Comment 2 Alex Christensen 2015-04-10 18:42:45 PDT
Anders, could you mention this bug in the radar when reviewing?
Comment 3 Darin Adler 2015-04-10 19:48:18 PDT
Comment on attachment 250551 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=250551&action=review

> Source/WebKit2/Shared/WebCompiledContentExtensionData.h:48
> +    WebCompiledContentExtensionData(PassRefPtr<SharedMemory> data, NetworkCache::Data fileData, unsigned actionsOffset, unsigned actionsSize, unsigned bytecodeOffset, unsigned bytecodeSize)

New code should not use PassRefPtr. This should be RefPtr<SharedMemory>&& if you want to move it in. Then use WTF::move below.
Comment 4 Alex Christensen 2015-04-11 14:03:34 PDT
(In reply to comment #3)
> New code should not use PassRefPtr. This should be RefPtr<SharedMemory>&& if
> you want to move it in. Then use WTF::move below.
I only made that change because stylebot got mad at me for leaving it as RefPtr.  If this is true (which it probably is) then stylebot should be changed.
Comment 5 Brady Eidson 2015-04-12 16:25:45 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > New code should not use PassRefPtr. This should be RefPtr<SharedMemory>&& if
> > you want to move it in. Then use WTF::move below.
> I only made that change because stylebot got mad at me for leaving it as
> RefPtr.  If this is true (which it probably is) then stylebot should be
> changed.

Stylebot normally says things like "If even of these errors are wrong please file a bug on check-webkit-style", so you should probably file a bug on check-webkit-style :)
Comment 6 Alex Christensen 2015-04-13 10:56:21 PDT
http://trac.webkit.org/changeset/182742