Commit 4015020a authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Create only non-resizeable VMOs.

By default zx_vmo_create() creates VMOs that can be resized. This is
potentially hazardous (process that tries to access mapped and
resized VMO may crash) while we never need to resize VMOs in chromium.
This change updates SharedMemoryFuchsia and
PlatformSharedMemoryRegionFuchsia to pass ZX_VMO_NON_RESIZABLE to
zx_vmo_create().

Change-Id: Idf48f3c21ad9b253da1c3a99ff79bcdebacccde4
Reviewed-on: https://chromium-review.googlesource.com/c/1275131Reviewed-by: default avatarScott Graham <scottmg@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#598854}
parent 43c064bc
......@@ -141,7 +141,8 @@ PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode,
"lead to this region being non-modifiable";
zx::vmo vmo;
zx_status_t status = zx::vmo::create(rounded_size, 0, &vmo);
zx_status_t status =
zx::vmo::create(rounded_size, ZX_VMO_NON_RESIZABLE, &vmo);
if (status != ZX_OK) {
ZX_DLOG(ERROR, status) << "zx_vmo_create";
return {};
......
......@@ -53,7 +53,8 @@ bool SharedMemory::Create(const SharedMemoryCreateOptions& options) {
requested_size_ = options.size;
mapped_size_ = bits::Align(requested_size_, GetPageSize());
zx::vmo vmo;
zx_status_t status = zx::vmo::create(mapped_size_, 0, &vmo);
zx_status_t status =
zx::vmo::create(mapped_size_, ZX_VMO_NON_RESIZABLE, &vmo);
if (status != ZX_OK) {
ZX_DLOG(ERROR, status) << "zx_vmo_create";
return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment