New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 795291 link

Starred by 7 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , iOS , Chrome , Mac , Fuchsia
Pri: 3
Type: Task


Sign in to add a comment

Refactor shared memory region-management code in Chromium

Project Member Reported by digit@chromium.org, Dec 15 2017

Issue description

After working on  issue 789959 , I've come to the conclusion that it is time to refactor the way Chromium shared memory regions. Essentially:

- The current scheme is based around Posix shared memory region
  access control semantics, which are looser than the ones provided
  by Android ashmem, and Linux memfd.

- The current abstractions used by Chromium were grown organically,
  but are ambiguous, which can easily lead to resource leaks and/or
  security issues (as seen in the past).

- This would allow us to clean-up some historical baggage and
  inconsistencies:

    https://crbug.com/210609
     https://crbug.com/320865 
    https://crbug.com/345734
    https://crbug.com/399384
    https://crbug.com/412104
    https://crbug.com/640840
     https://crbug.com/716072 

This is an umbrella issue for this refactor.

 

Comment 1 by roc...@chromium.org, Jan 17 2018

What's the ETA on this effort? Is it low priority for you? Can I help?

Having a better base::SharedMemory API is of great interest to me.
Cc: rsesek@chromium.org roc...@chromium.org mattcary@chromium.org digit@chromium.org
Components: Internals>Core
Labels: OS-Android OS-Chrome OS-Fuchsia OS-iOS OS-Linux OS-Mac OS-Windows
Owner: alexilin@chromium.org
Status: Started (was: Untriaged)
Blockedon: 825177
Project Member

Comment 4 by bugdroid1@chromium.org, Mar 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/cdd8661f3f35d7075020ead0492cd83e18f795e9

commit cdd8661f3f35d7075020ead0492cd83e18f795e9
Author: Alexandr Ilin <alexilin@chromium.org>
Date: Fri Mar 23 18:14:58 2018

base: Introduce the new Shared Memory API

Design doc (public): https://goo.gl/HmBYy6

This patch proposes the new API for the Shared Memory based on two
concepts, a shared memory region and a shared memory mapping. The
region controls the platform-specific handle and mediates sharing and
access control. The mapping is just a reference to the memory bytes
which knows how to unmap itself. Ownership is per-instance: neither a
region nor a mapping may be copied, and resources are freed when then
instance dies. This is accomplished through move-only semantics.

The goal of the new API is to provide a correct cross-platform
implementation that makes the sharing mode explicit via the C++ type
system.

Thus, this CL introduces two classes for shared memory mappings:
- WritableSharedMemoryMapping owns and provides an access to writable
shared memory
- ReadOnlySharedMemoryMapping for read-only shared memory

and three classes representing shared memory regions:
- UnsafeSharedMemoryRegion allows to create
WritableSharedMemoryMapping instances and cannot be used for making
read-only mappings
- ReadOnlySharedMemoryRegion, on the contrary, can produce only
ReadOnlySharedMemoryMapping instances and it also creates one writable
mapping in the caller process address space
- WritableSharedMemoryRegion allows to create writable
mappings and can be eventually converted to ReadOnlySharedMemoryRegion.
The important limitation in comparison with UnsafeSharedMemoryRegion
is that the WritableSharedMemoryRegion cannot be duplicated so in
order to pass the writable region to another process, the ownership of
the region must be moved/transferred to this process.

Bug: 795291
Change-Id: I7d1d0a24932145cc0f449b01ceb8cafef9b7e407
Reviewed-on: https://chromium-review.googlesource.com/893458
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Reviewed-by: Matthew Cary <mattcary@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545521}
[modify] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/BUILD.gn
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/platform_shared_memory_region.cc
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/platform_shared_memory_region.h
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/platform_shared_memory_region_android.cc
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/platform_shared_memory_region_fuchsia.cc
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/platform_shared_memory_region_mac.cc
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/platform_shared_memory_region_posix.cc
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/platform_shared_memory_region_unittest.cc
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/platform_shared_memory_region_win.cc
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/read_only_shared_memory_region.cc
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/read_only_shared_memory_region.h
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/shared_memory_mapping.cc
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/shared_memory_mapping.h
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/shared_memory_region_unittest.cc
[modify] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/shared_memory_tracker.cc
[modify] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/shared_memory_tracker.h
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/unsafe_shared_memory_region.cc
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/unsafe_shared_memory_region.h
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/writable_shared_memory_region.cc
[add] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/memory/writable_shared_memory_region.h
[modify] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/test/test_shared_memory_util.cc
[modify] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/test/test_shared_memory_util.h
[modify] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/trace_event/process_memory_dump.cc
[modify] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/trace_event/process_memory_dump.h
[modify] https://crrev.com/cdd8661f3f35d7075020ead0492cd83e18f795e9/base/trace_event/process_memory_dump_unittest.cc

Project Member

Comment 5 by bugdroid1@chromium.org, Mar 23 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/117d1163c2e356597c066c91187545b25e11c376

commit 117d1163c2e356597c066c91187545b25e11c376
Author: Findit <findit-for-me@appspot.gserviceaccount.com>
Date: Fri Mar 23 20:40:08 2018

Revert "base: Introduce the new Shared Memory API"

This reverts commit cdd8661f3f35d7075020ead0492cd83e18f795e9.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 545521 as the
culprit for failures in the build cycles as shown on:
https://findit-for-me.appspot.com/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtL2NkZDg2NjFmM2YzNWQ3MDc1MDIwZWFkMDQ5MmNkODNlMThmNzk1ZTkM

Sample Failed Build: https://ci.chromium.org/buildbot/chromium.linux/Linux%20Tests%20%28dbg%29%281%29%2832%29/48976

Sample Failed Step: base_unittests

Original change's description:
> base: Introduce the new Shared Memory API
> 
> Design doc (public): https://goo.gl/HmBYy6
> 
> This patch proposes the new API for the Shared Memory based on two
> concepts, a shared memory region and a shared memory mapping. The
> region controls the platform-specific handle and mediates sharing and
> access control. The mapping is just a reference to the memory bytes
> which knows how to unmap itself. Ownership is per-instance: neither a
> region nor a mapping may be copied, and resources are freed when then
> instance dies. This is accomplished through move-only semantics.
> 
> The goal of the new API is to provide a correct cross-platform
> implementation that makes the sharing mode explicit via the C++ type
> system.
> 
> Thus, this CL introduces two classes for shared memory mappings:
> - WritableSharedMemoryMapping owns and provides an access to writable
> shared memory
> - ReadOnlySharedMemoryMapping for read-only shared memory
> 
> and three classes representing shared memory regions:
> - UnsafeSharedMemoryRegion allows to create
> WritableSharedMemoryMapping instances and cannot be used for making
> read-only mappings
> - ReadOnlySharedMemoryRegion, on the contrary, can produce only
> ReadOnlySharedMemoryMapping instances and it also creates one writable
> mapping in the caller process address space
> - WritableSharedMemoryRegion allows to create writable
> mappings and can be eventually converted to ReadOnlySharedMemoryRegion.
> The important limitation in comparison with UnsafeSharedMemoryRegion
> is that the WritableSharedMemoryRegion cannot be duplicated so in
> order to pass the writable region to another process, the ownership of
> the region must be moved/transferred to this process.
> 
> Bug: 795291
> Change-Id: I7d1d0a24932145cc0f449b01ceb8cafef9b7e407
> Reviewed-on: https://chromium-review.googlesource.com/893458
> Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
> Reviewed-by: Matthew Cary <mattcary@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Erik Chen <erikchen@chromium.org>
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Reviewed-by: Ken Rockot <rockot@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#545521}

Change-Id: I9c5657e80b8a262a42311d4d2a0239dc242ab8f5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 795291
Reviewed-on: https://chromium-review.googlesource.com/978563
Cr-Commit-Position: refs/heads/master@{#545568}
[modify] https://crrev.com/117d1163c2e356597c066c91187545b25e11c376/base/BUILD.gn
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/platform_shared_memory_region.cc
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/platform_shared_memory_region.h
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/platform_shared_memory_region_android.cc
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/platform_shared_memory_region_fuchsia.cc
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/platform_shared_memory_region_mac.cc
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/platform_shared_memory_region_posix.cc
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/platform_shared_memory_region_unittest.cc
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/platform_shared_memory_region_win.cc
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/read_only_shared_memory_region.cc
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/read_only_shared_memory_region.h
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/shared_memory_mapping.cc
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/shared_memory_mapping.h
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/shared_memory_region_unittest.cc
[modify] https://crrev.com/117d1163c2e356597c066c91187545b25e11c376/base/memory/shared_memory_tracker.cc
[modify] https://crrev.com/117d1163c2e356597c066c91187545b25e11c376/base/memory/shared_memory_tracker.h
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/unsafe_shared_memory_region.cc
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/unsafe_shared_memory_region.h
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/writable_shared_memory_region.cc
[delete] https://crrev.com/6f23607b329bf57e05f782eee76d220916b627fa/base/memory/writable_shared_memory_region.h
[modify] https://crrev.com/117d1163c2e356597c066c91187545b25e11c376/base/test/test_shared_memory_util.cc
[modify] https://crrev.com/117d1163c2e356597c066c91187545b25e11c376/base/test/test_shared_memory_util.h
[modify] https://crrev.com/117d1163c2e356597c066c91187545b25e11c376/base/trace_event/process_memory_dump.cc
[modify] https://crrev.com/117d1163c2e356597c066c91187545b25e11c376/base/trace_event/process_memory_dump.h
[modify] https://crrev.com/117d1163c2e356597c066c91187545b25e11c376/base/trace_event/process_memory_dump_unittest.cc

Project Member

Comment 6 by bugdroid1@chromium.org, Mar 27 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7b882500303dd0c9a416dc6330530de02e76f2b7

commit 7b882500303dd0c9a416dc6330530de02e76f2b7
Author: Alexandr Ilin <alexilin@chromium.org>
Date: Tue Mar 27 07:44:53 2018

Reland "base: Introduce the new Shared Memory API"

This is a reland of cdd8661f3f35d7075020ead0492cd83e18f795e9

Reason for reland:
The failing test PlatformSharedMemoryRegionTest.MapAtWithOverflowTest
was fixed.

Original change's description:
> base: Introduce the new Shared Memory API
>
> Design doc (public): https://goo.gl/HmBYy6
>
> This patch proposes the new API for the Shared Memory based on two
> concepts, a shared memory region and a shared memory mapping. The
> region controls the platform-specific handle and mediates sharing and
> access control. The mapping is just a reference to the memory bytes
> which knows how to unmap itself. Ownership is per-instance: neither a
> region nor a mapping may be copied, and resources are freed when then
> instance dies. This is accomplished through move-only semantics.
>
> The goal of the new API is to provide a correct cross-platform
> implementation that makes the sharing mode explicit via the C++ type
> system.
>
> Thus, this CL introduces two classes for shared memory mappings:
> - WritableSharedMemoryMapping owns and provides an access to writable
> shared memory
> - ReadOnlySharedMemoryMapping for read-only shared memory
>
> and three classes representing shared memory regions:
> - UnsafeSharedMemoryRegion allows to create
> WritableSharedMemoryMapping instances and cannot be used for making
> read-only mappings
> - ReadOnlySharedMemoryRegion, on the contrary, can produce only
> ReadOnlySharedMemoryMapping instances and it also creates one writable
> mapping in the caller process address space
> - WritableSharedMemoryRegion allows to create writable
> mappings and can be eventually converted to ReadOnlySharedMemoryRegion.
> The important limitation in comparison with UnsafeSharedMemoryRegion
> is that the WritableSharedMemoryRegion cannot be duplicated so in
> order to pass the writable region to another process, the ownership of
> the region must be moved/transferred to this process.
>
> Bug: 795291
> Change-Id: I7d1d0a24932145cc0f449b01ceb8cafef9b7e407
> Reviewed-on: https://chromium-review.googlesource.com/893458
> Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
> Reviewed-by: Matthew Cary <mattcary@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Erik Chen <erikchen@chromium.org>
> Reviewed-by: Robert Sesek <rsesek@chromium.org>
> Reviewed-by: Ken Rockot <rockot@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#545521}

TBR=dcheng@chromium.org,erikchen@chromium.org,rsesek@chromium.org,rockot@chromium.org

Bug: 795291
Change-Id: Ibba9aac8e7ca5bb6c55a2e0ddf62178fdc8fae20
Reviewed-on: https://chromium-review.googlesource.com/979653
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Reviewed-by: Alexandr Ilin <alexilin@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Matthew Cary <mattcary@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546053}
[modify] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/BUILD.gn
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/platform_shared_memory_region.cc
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/platform_shared_memory_region.h
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/platform_shared_memory_region_android.cc
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/platform_shared_memory_region_fuchsia.cc
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/platform_shared_memory_region_mac.cc
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/platform_shared_memory_region_posix.cc
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/platform_shared_memory_region_unittest.cc
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/platform_shared_memory_region_win.cc
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/read_only_shared_memory_region.cc
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/read_only_shared_memory_region.h
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/shared_memory_mapping.cc
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/shared_memory_mapping.h
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/shared_memory_region_unittest.cc
[modify] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/shared_memory_tracker.cc
[modify] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/shared_memory_tracker.h
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/unsafe_shared_memory_region.cc
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/unsafe_shared_memory_region.h
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/writable_shared_memory_region.cc
[add] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/memory/writable_shared_memory_region.h
[modify] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/test/test_shared_memory_util.cc
[modify] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/test/test_shared_memory_util.h
[modify] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/trace_event/process_memory_dump.cc
[modify] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/trace_event/process_memory_dump.h
[modify] https://crrev.com/7b882500303dd0c9a416dc6330530de02e76f2b7/base/trace_event/process_memory_dump_unittest.cc

Blockedon: 826213
Project Member

Comment 8 by bugdroid1@chromium.org, Apr 19 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d497eeecd22a0da60068aab0e526145b768d4215

commit d497eeecd22a0da60068aab0e526145b768d4215
Author: Alexandr Ilin <alexilin@chromium.org>
Date: Thu Apr 19 22:50:54 2018

Implement IPC::ParamTraits for PlatformSharedMemoryRegion

This CL adds the support for passing PlatfromSharedMemoryRegions
between processes via IPC messages.

Bug: 795291
Change-Id: I13b22226866b0a4e5d97e66f4ce93e5ad28fdaac
Reviewed-on: https://chromium-review.googlesource.com/937514
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Matthew Cary <mattcary@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552192}
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/base/memory/platform_shared_memory_region.h
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/base/memory/platform_shared_memory_region_unittest.cc
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/base/memory/read_only_shared_memory_region.cc
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/base/memory/shared_memory_mapping.h
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/base/memory/shared_memory_region_unittest.cc
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/base/memory/unsafe_shared_memory_region.cc
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/base/memory/writable_shared_memory_region.cc
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/base/test/test_shared_memory_util.cc
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/base/test/test_shared_memory_util.h
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/ipc/ipc_channel_mojo_unittest.cc
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/ipc/ipc_message_utils.cc
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/ipc/ipc_message_utils.h
[modify] https://crrev.com/d497eeecd22a0da60068aab0e526145b768d4215/ipc/ipc_message_utils_unittest.cc

Blockedon: 797470
Blockedon: 804955
Blockedon: 843117
Blockedon: 844441
Blockedon: 844456
Blockedon: 844508
Blockedon: 803136
Blockedon: 793446
Blockedon: 845864
Blockedon: 845985
Blockedon: 849207
Blockedon: 854594
Blockedon: 861844
Project Member

Comment 22 by bugdroid1@chromium.org, Jul 12

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/ecfbde9b593ca7f497375f56da8d076eb29772fa

commit ecfbde9b593ca7f497375f56da8d076eb29772fa
Author: Alexandr Ilin <alexilin@chromium.org>
Date: Thu Jul 12 17:08:22 2018

Allow WritableSharedMemoryRegion to Unsafe conversion

This CL adds a new ConvertToUnsafe() method to the WritableSharedMemoryRegion
class. This new method is similar to ConvertToReadOnly() in structure. The
conversion does not modify an underlying platform handle (except it closes a
read-only handle on POSIX) but changes region's type.

Bug: 795291
Change-Id: Ie0a6b4c9850c0e223ee9299655f9bfd6c79c383b
Reviewed-on: https://chromium-review.googlesource.com/985981
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574610}
[modify] https://crrev.com/ecfbde9b593ca7f497375f56da8d076eb29772fa/base/memory/platform_shared_memory_region.h
[modify] https://crrev.com/ecfbde9b593ca7f497375f56da8d076eb29772fa/base/memory/platform_shared_memory_region_android.cc
[modify] https://crrev.com/ecfbde9b593ca7f497375f56da8d076eb29772fa/base/memory/platform_shared_memory_region_fuchsia.cc
[modify] https://crrev.com/ecfbde9b593ca7f497375f56da8d076eb29772fa/base/memory/platform_shared_memory_region_mac.cc
[modify] https://crrev.com/ecfbde9b593ca7f497375f56da8d076eb29772fa/base/memory/platform_shared_memory_region_posix.cc
[modify] https://crrev.com/ecfbde9b593ca7f497375f56da8d076eb29772fa/base/memory/platform_shared_memory_region_unittest.cc
[modify] https://crrev.com/ecfbde9b593ca7f497375f56da8d076eb29772fa/base/memory/platform_shared_memory_region_win.cc
[modify] https://crrev.com/ecfbde9b593ca7f497375f56da8d076eb29772fa/base/memory/writable_shared_memory_region.cc
[modify] https://crrev.com/ecfbde9b593ca7f497375f56da8d076eb29772fa/base/memory/writable_shared_memory_region.h

Blockedon: 865102
Project Member

Comment 24 by bugdroid1@chromium.org, Jul 24

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fcdae7e0d22984bca7101baaf528ff7ca7e1a175

commit fcdae7e0d22984bca7101baaf528ff7ca7e1a175
Author: Daniel Cheng <dcheng@chromium.org>
Date: Tue Jul 24 19:11:22 2018

Add type-safer helpers for accessing SharedMemoryMappings.

- GetMemoryAs<T> should be used when the mapping contains one T.
- GetMemoryAsSpan<T> should be used when the mapping contains more than
  one T. The element count can be explicitly specified or autodeduced
  from the size of the shared memory mapping.

Bug: 795291, 866975
Change-Id: Icea4e276a26a1c47688c0a5206b97cd42ff92043
Reviewed-on: https://chromium-review.googlesource.com/1144312
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Alexandr Ilin <alexilin@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577630}
[modify] https://crrev.com/fcdae7e0d22984bca7101baaf528ff7ca7e1a175/base/BUILD.gn
[modify] https://crrev.com/fcdae7e0d22984bca7101baaf528ff7ca7e1a175/base/memory/shared_memory_mapping.h
[add] https://crrev.com/fcdae7e0d22984bca7101baaf528ff7ca7e1a175/base/memory/shared_memory_mapping_unittest.cc

Blocking: 640840
Project Member

Comment 26 by bugdroid1@chromium.org, Aug 24

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1f8eb50a729b9770ea88150846eb5d03ed2c254f

commit 1f8eb50a729b9770ea88150846eb5d03ed2c254f
Author: Matthew Cary <mattcary@chromium.org>
Date: Fri Aug 24 17:18:31 2018

base/memory: Add UnsafeSharedMemoryRegion::CreateFromHandle.

Create an UnsafeSharedMemoryRegion from a SharedMemoryHandle. This
creation method is only needed while transitioning to the new shared
memory API.

This enables in particular the media code to not add a dependency on
mojo, via WritableUnalignedMapping. This dependency has caused
problems, eg  crbug.com/874074  and  crbug.com/871429 .

Bug: 795291
Change-Id: Ie0603e55afac9d853d371548a99475d763034fa5
Reviewed-on: https://chromium-review.googlesource.com/1183910
Commit-Queue: Matthew Cary <mattcary@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585886}
[modify] https://crrev.com/1f8eb50a729b9770ea88150846eb5d03ed2c254f/base/memory/platform_shared_memory_region.h
[modify] https://crrev.com/1f8eb50a729b9770ea88150846eb5d03ed2c254f/base/memory/platform_shared_memory_region_android.cc
[modify] https://crrev.com/1f8eb50a729b9770ea88150846eb5d03ed2c254f/base/memory/platform_shared_memory_region_fuchsia.cc
[modify] https://crrev.com/1f8eb50a729b9770ea88150846eb5d03ed2c254f/base/memory/platform_shared_memory_region_mac.cc
[modify] https://crrev.com/1f8eb50a729b9770ea88150846eb5d03ed2c254f/base/memory/platform_shared_memory_region_posix.cc
[modify] https://crrev.com/1f8eb50a729b9770ea88150846eb5d03ed2c254f/base/memory/platform_shared_memory_region_unittest.cc
[modify] https://crrev.com/1f8eb50a729b9770ea88150846eb5d03ed2c254f/base/memory/platform_shared_memory_region_win.cc
[modify] https://crrev.com/1f8eb50a729b9770ea88150846eb5d03ed2c254f/base/memory/shared_memory_handle.h
[modify] https://crrev.com/1f8eb50a729b9770ea88150846eb5d03ed2c254f/base/memory/shared_memory_region_unittest.cc
[modify] https://crrev.com/1f8eb50a729b9770ea88150846eb5d03ed2c254f/base/memory/unsafe_shared_memory_region.cc
[modify] https://crrev.com/1f8eb50a729b9770ea88150846eb5d03ed2c254f/base/memory/unsafe_shared_memory_region.h

Project Member

Comment 27 by bugdroid1@chromium.org, Sep 4

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e9cf496582a73009713ab463c41689383f8693dc

commit e9cf496582a73009713ab463c41689383f8693dc
Author: Alexandr Ilin <alexilin@chromium.org>
Date: Tue Sep 04 14:07:41 2018

base/memory: Test mapping protection bits on all platforms

This CL adds a new MappingProtectionSetCorrectly test to the
PlatformSharedMemoryRegion. This test examines that page protection bits are
set correctly on a mapped region and that the process doesn't have rights to
change the protection level.

Bug: 795291
Change-Id: I029de3b31c74f7c14d92d5da7fb4a2a35ec7659a
Reviewed-on: https://chromium-review.googlesource.com/1199811
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588506}
[modify] https://crrev.com/e9cf496582a73009713ab463c41689383f8693dc/base/memory/platform_shared_memory_region_unittest.cc

Project Member

Comment 28 by bugdroid1@chromium.org, Sep 4

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e9cf496582a73009713ab463c41689383f8693dc

commit e9cf496582a73009713ab463c41689383f8693dc
Author: Alexandr Ilin <alexilin@chromium.org>
Date: Tue Sep 04 14:07:41 2018

base/memory: Test mapping protection bits on all platforms

This CL adds a new MappingProtectionSetCorrectly test to the
PlatformSharedMemoryRegion. This test examines that page protection bits are
set correctly on a mapped region and that the process doesn't have rights to
change the protection level.

Bug: 795291
Change-Id: I029de3b31c74f7c14d92d5da7fb4a2a35ec7659a
Reviewed-on: https://chromium-review.googlesource.com/1199811
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588506}
[modify] https://crrev.com/e9cf496582a73009713ab463c41689383f8693dc/base/memory/platform_shared_memory_region_unittest.cc

Project Member

Comment 29 by bugdroid1@chromium.org, Sep 4

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e9cf496582a73009713ab463c41689383f8693dc

commit e9cf496582a73009713ab463c41689383f8693dc
Author: Alexandr Ilin <alexilin@chromium.org>
Date: Tue Sep 04 14:07:41 2018

base/memory: Test mapping protection bits on all platforms

This CL adds a new MappingProtectionSetCorrectly test to the
PlatformSharedMemoryRegion. This test examines that page protection bits are
set correctly on a mapped region and that the process doesn't have rights to
change the protection level.

Bug: 795291
Change-Id: I029de3b31c74f7c14d92d5da7fb4a2a35ec7659a
Reviewed-on: https://chromium-review.googlesource.com/1199811
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588506}
[modify] https://crrev.com/e9cf496582a73009713ab463c41689383f8693dc/base/memory/platform_shared_memory_region_unittest.cc

Project Member

Comment 30 by bugdroid1@chromium.org, Sep 5

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/511f1070e1224b40d8b7a2f6971744d74b60583b

commit 511f1070e1224b40d8b7a2f6971744d74b60583b
Author: Matthew Cary <mattcary@chromium.org>
Date: Wed Sep 05 09:50:34 2018

media/base: Update WritableUnalignedMapping constructor.

Use the base::UnsafeSharedMemoryRegion constructor which avoids a mojo
dependency. Several media tests are built without mojo support.

Bug: 795291
Change-Id: If754e6111189e8944997550f00e3ed7ef9fde1c3
Reviewed-on: https://chromium-review.googlesource.com/1190243
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Commit-Queue: Matthew Cary <mattcary@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588808}
[modify] https://crrev.com/511f1070e1224b40d8b7a2f6971744d74b60583b/media/base/unaligned_shared_memory.cc

Cc: -roc...@chromium.org rockot@google.com
Blockedon: 776564
Blockedon: 920183

Sign in to add a comment