Commit Graph

1067 Commits

Author SHA1 Message Date
Jed Davis
e56c8b2a50 Bug 1573270 - Enhance shared memory freezing tests and add comments. r=bobowen on a CLOSED TREE
Differential Revision: https://phabricator.services.mozilla.com/D42048

--HG--
extra : source : 9d28ee24c3772c25c4995d202bc23e4484854dc0
extra : histedit_source : 0d05612ebe4fcc8af252b272693ac3c7e6841fa0
2019-11-25 18:36:46 +00:00
Coroiu Cristina
535a7ca388 Backed out changeset 9d28ee24c377 (bug 1573270) for xpcshell failures at toolkit/modules/tests/xpcshell/test_firstStartup.js on a CLOSED TREE 2019-11-26 02:29:15 +02:00
Jed Davis
7067fb846c Bug 1573270 - Enhance shared memory freezing tests and add comments. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D42048

--HG--
extra : moz-landing-system : lando
2019-11-25 18:36:46 +00:00
Jed Davis
b1dbdc9687 Bug 1582297 - Suppress IPC "pipe error" messages if the cause was probably the other process exiting. r=froydnj
There are two issues here:

1. These error messages occur even during normal channel shutdown,
because that's tracked in the mozilla::ipc::MessageChannel layer,
which the ipc/chromium code can't access.

2. If we get this kind of error when the channel wasn't intentionally
closed, it almost certainly means that the other process crashed.  In
that case, having error messages from a different process and a likely
unrelated subsystem just leads to confusion and misfiled bugs.

(Also complicating things: on Unix a closed channel often, but not
always, results in an end-of-file indication, which already isn't
logged; on Windows it's always a broken pipe error, which causes a much
larger amount of log spam.)

Bonus fix: the error that contains a fd number is clarified to avoid
having it mistaken for an error code.

Differential Revision: https://phabricator.services.mozilla.com/D52727

--HG--
extra : moz-landing-system : lando
2019-11-12 21:04:40 +00:00
Jed Davis
bbfc6ecf78 Bug 1574571. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D43707

--HG--
extra : moz-landing-system : lando
2019-08-28 18:30:43 +00:00
Mike Hommey
66d7fe943e Bug 1575420 - Replace MOZ_WIDGET_TOOLKIT value of "gtk3" with "gtk". r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D42765

--HG--
extra : moz-landing-system : lando
2019-08-21 12:25:42 +00:00
Jed Davis
bc66e27e8c Bug 1536697 - Fix error handling in base::SharedMemory::Map. r=froydnj
If mmap failed, we'd leave the memory_ member variable set to MAP_FAILED,
but everything else in this file checks for nullptr (and only nullptr) to
test if the pointer is valid.

Also, this removes the debug assertion that the mmap succeeded, to allow
writing unit tests where we expect it to fail (e.g., for insufficient
permissions).

Depends on D26747

Differential Revision: https://phabricator.services.mozilla.com/D26748

--HG--
extra : moz-landing-system : lando
2019-08-14 22:48:51 +00:00
Jed Davis
150e57c3cc Bug 1426526 - Delete file_util from ex-Chromium IPC source. r=froydnj
Depends on D26746

Differential Revision: https://phabricator.services.mozilla.com/D26747

--HG--
extra : moz-landing-system : lando
2019-08-14 22:48:42 +00:00
Jed Davis
0c5b23b47d Bug 1479960 - Add freezing of IPC shared memory. r=froydnj,kmag
This allows writing to shared memory and then making it read-only before
sharing it to other processes, such that a malicious sandboxed process
cannot regain write access.  This is currently available only in the
low-level base::SharedMemory interface.

The freeze operation exposes the common subset of read-only shared
memory that we can implement on all supported OSes: with some APIs
(POSIX shm_open) we can't revoke writeability from existing capabilies,
while for others (Android ashmem) we *must* revoke it.  Thus, we require
that the writeable capability not have been duplicated or shared to
another process, and consume it as part of freezing.  Also, because in
some backends need special handling at creation time, freezeability must
be explicitly requested.

In particular, this doesn't allow giving an untrusted process read-only
access to memory that the original process can write.

Note that on MacOS before 10.12 this will use temporary files in order to
avoid an OS security bug that allows regaining write access; those OS
versions are no longer supported by Apple (but are supported by Firefox).

Depends on D26742

Differential Revision: https://phabricator.services.mozilla.com/D26743

--HG--
extra : moz-landing-system : lando
2019-08-14 22:48:34 +00:00
Jed Davis
e3f21b94e9 Bug 1479960 - Clean up shared_memory_posix error handling. r=froydnj
This uses RAII to handle error-case cleanup in the POSIX backend for
SharedMemory::Create, to simplify the complexity that will be added to
support freezing.

Depends on D26741

Differential Revision: https://phabricator.services.mozilla.com/D26742

--HG--
extra : moz-landing-system : lando
2019-08-14 22:48:31 +00:00
Jed Davis
8b00fa3bea Bug 1479960 - Fix max_size in shared_memory_posix. r=froydnj
The Unix backend for shared memory needs to keep the mapped size to pass
to munmap, while the Windows backend doesn't.  Currently it's reusing the
max_size field, and then zeroing it when it's unmapped, which breaks the
freezing use case.  This patch uses a dedicated field for that.

Depends on D26740

Differential Revision: https://phabricator.services.mozilla.com/D26741

--HG--
extra : moz-landing-system : lando
2019-08-14 22:48:29 +00:00
Jed Davis
9a41450b28 Bug 1479960 - Get rid of base::SharedMemory::handle. r=froydnj
Despite the comment saying not to use the "handle" except as an opaque
identifier, it is being used to pass the handle to other OS APIs.  Direct
access to the handle needs to be controlled to make sure freezing is
safe, so this patch replaces that with interfaces that are more explicit
about ownership and lifetime.

Depends on D26739

Differential Revision: https://phabricator.services.mozilla.com/D26740

--HG--
extra : moz-landing-system : lando
2019-08-14 22:48:22 +00:00
Jed Davis
4eb2c49d03 Bug 1479960 - Remove SHM_ANON support. r=froydnj
FreeBSD's SHM_ANON is useful for the usual case of shared memory, but it
doesn't support freezing.  It could be re-added later, but for now it's
simplest to remove it (and use named shm instead) while refactoring.

Depends on D26738

Differential Revision: https://phabricator.services.mozilla.com/D26739

--HG--
extra : moz-landing-system : lando
2019-08-14 22:48:20 +00:00
Barret Rennie
736ae2cbed Bug 1510569 - Prevent missing symbol errors during builds when adding new IPDL headers r=Ehsan
ipc_message_utils.h defines IPDLParamTraits on windows for some things like
HWND and HANDLE. However, it doesn't directly include windows.h on Windows to
include them. All other usages seem to rely on including base/process.h, which
does include windows.h and adds the appropriate typedefs.

Differential Revision: https://phabricator.services.mozilla.com/D35089

--HG--
extra : moz-landing-system : lando
2019-08-02 02:12:47 +00:00
Jed Davis
ce9d3c2b5d Bug 1568291 - Be more defensive in base::KillProcess. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D39783

--HG--
extra : moz-landing-system : lando
2019-07-30 14:04:26 +00:00
Kershaw Chang
0d30d95291 Bug 1566808 - Add STARTF_FORCEOFFFEEDBACK when launching process on windows r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D39682

--HG--
extra : moz-landing-system : lando
2019-07-29 14:59:27 +00:00
Christian Holler
cd7a74b452 Bug 1499041 - Remove libFuzzer flags from ipc/chromium/. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D39165

--HG--
extra : moz-landing-system : lando
2019-07-24 14:13:30 +00:00
Olli Pettay
5474e37783 Bug 1566459, add a way to check underlying IPC message type from runnable, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D38215

--HG--
extra : moz-landing-system : lando
2019-07-16 19:21:40 +00:00
Narcis Beleuzu
a89b67e772 Backed out 15 changesets (bug 1479960, bug 1426526, bug 1534780, bug 1536697) for toolchain bustages on UniquePtrExtensions.h . CLOSED TREE
Backed out changeset a8518ea4b594 (bug 1479960)
Backed out changeset 7172762c4b87 (bug 1536697)
Backed out changeset 2ea5ccb8f3a1 (bug 1426526)
Backed out changeset d892a888fe9c (bug 1426526)
Backed out changeset 2c4d12bdfec3 (bug 1479960)
Backed out changeset 8a322064cf6d (bug 1479960)
Backed out changeset 47d387b6cd4a (bug 1479960)
Backed out changeset 8332565a6943 (bug 1479960)
Backed out changeset 9d7f1835f96f (bug 1479960)
Backed out changeset 0aa8af4965c5 (bug 1479960)
Backed out changeset 036809330a51 (bug 1479960)
Backed out changeset 39e18373e3d3 (bug 1479960)
Backed out changeset 6c2b995a9d30 (bug 1479960)
Backed out changeset 3c2b31744645 (bug 1534780)
Backed out changeset 26bb00a94d5d (bug 1534780)
2019-06-28 22:42:00 +03:00
Jed Davis
1388eadfff Bug 1536697 - Fix error handling in base::SharedMemory::Map. r=froydnj
If mmap failed, we'd leave the memory_ member variable set to MAP_FAILED,
but everything else in this file checks for nullptr (and only nullptr) to
test if the pointer is valid.

Also, this removes the debug assertion that the mmap succeeded, to allow
writing unit tests where we expect it to fail (e.g., for insufficient
permissions).

Depends on D26747

Differential Revision: https://phabricator.services.mozilla.com/D26748

--HG--
extra : moz-landing-system : lando
2019-06-20 22:40:44 +00:00
Jed Davis
5c3a0a30d3 Bug 1426526 - Delete file_util from ex-Chromium IPC source. r=froydnj
Depends on D26746

Differential Revision: https://phabricator.services.mozilla.com/D26747

--HG--
extra : moz-landing-system : lando
2019-06-20 22:40:40 +00:00
Jed Davis
b1c82b278b Bug 1479960 - Add freezing of IPC shared memory. r=froydnj,kmag
This allows writing to shared memory and then making it read-only before
sharing it to other processes, such that a malicious sandboxed process
cannot regain write access.  This is currently available only in the
low-level base::SharedMemory interface.

The freeze operation exposes the common subset of read-only shared
memory that we can implement on all supported OSes: with some APIs
(POSIX shm_open) we can't revoke writeability from existing capabilies,
while for others (Android ashmem) we *must* revoke it.  Thus, we require
that the writeable capability not have been duplicated or shared to
another process, and consume it as part of freezing.  Also, because in
some backends need special handling at creation time, freezeability must
be explicitly requested.

In particular, this doesn't allow giving an untrusted process read-only
access to memory that the original process can write.

Note that on MacOS before 10.12 this will use temporary files in order to
avoid an OS security bug that allows regaining write access; those OS
versions are no longer supported by Apple (but are supported by Firefox).

Depends on D26742

Differential Revision: https://phabricator.services.mozilla.com/D26743

--HG--
extra : moz-landing-system : lando
2019-06-20 22:40:32 +00:00
Jed Davis
0a231ee919 Bug 1479960 - Clean up shared_memory_posix error handling. r=froydnj
This uses RAII to handle error-case cleanup in the POSIX backend for
SharedMemory::Create, to simplify the complexity that will be added to
support freezing.

Depends on D26741

Differential Revision: https://phabricator.services.mozilla.com/D26742

--HG--
extra : moz-landing-system : lando
2019-06-20 22:40:28 +00:00
Jed Davis
6559e7ab1f Bug 1479960 - Fix max_size in shared_memory_posix. r=froydnj
The Unix backend for shared memory needs to keep the mapped size to pass
to munmap, while the Windows backend doesn't.  Currently it's reusing the
max_size field, and then zeroing it when it's unmapped, which breaks the
freezing use case.  This patch uses a dedicated field for that.

Depends on D26740

Differential Revision: https://phabricator.services.mozilla.com/D26741

--HG--
extra : moz-landing-system : lando
2019-06-20 22:40:21 +00:00
Jed Davis
3c945a3e99 Bug 1479960 - Get rid of base::SharedMemory::handle. r=froydnj
Despite the comment saying not to use the "handle" except as an opaque
identifier, it is being used to pass the handle to other OS APIs.  Direct
access to the handle needs to be controlled to make sure freezing is
safe, so this patch replaces that with interfaces that are more explicit
about ownership and lifetime.

Depends on D26739

Differential Revision: https://phabricator.services.mozilla.com/D26740

--HG--
extra : moz-landing-system : lando
2019-06-20 22:40:19 +00:00
Jed Davis
b916fc745c Bug 1479960 - Remove SHM_ANON support. r=froydnj
FreeBSD's SHM_ANON is useful for the usual case of shared memory, but it
doesn't support freezing.  It could be re-added later, but for now it's
simplest to remove it (and use named shm instead) while refactoring.

Depends on D26738

Differential Revision: https://phabricator.services.mozilla.com/D26739

--HG--
extra : moz-landing-system : lando
2019-06-20 22:40:17 +00:00
Ciure Andrei
72f3f971fb Backed out 15 changesets (bug 1479960, bug 1426526, bug 1534780, bug 1536697) for causing build bustages CLOSED TREE
Backed out changeset 5645e0cc3915 (bug 1479960)
Backed out changeset a7c09894c6a0 (bug 1536697)
Backed out changeset 510f03381af9 (bug 1426526)
Backed out changeset 7cf4735a088f (bug 1426526)
Backed out changeset 41080844e645 (bug 1479960)
Backed out changeset fdba3c5f8fd0 (bug 1479960)
Backed out changeset 26a8ebcb2db4 (bug 1479960)
Backed out changeset d0d383e5bae1 (bug 1479960)
Backed out changeset c418095bb7b7 (bug 1479960)
Backed out changeset 7b78b1945532 (bug 1479960)
Backed out changeset c47d47d4073d (bug 1479960)
Backed out changeset 71253b62a633 (bug 1479960)
Backed out changeset ae525f20bdbb (bug 1479960)
Backed out changeset 7fba719355d7 (bug 1534780)
Backed out changeset 771db331860a (bug 1534780)
2019-06-20 19:54:57 +03:00
Jed Davis
87ae2d99b5 Bug 1536697 - Fix error handling in base::SharedMemory::Map. r=froydnj
If mmap failed, we'd leave the memory_ member variable set to MAP_FAILED,
but everything else in this file checks for nullptr (and only nullptr) to
test if the pointer is valid.

Also, this removes the debug assertion that the mmap succeeded, to allow
writing unit tests where we expect it to fail (e.g., for insufficient
permissions).

Depends on D26747

Differential Revision: https://phabricator.services.mozilla.com/D26748

--HG--
extra : moz-landing-system : lando
2019-06-17 14:32:15 +00:00
Jed Davis
d0e26716c7 Bug 1426526 - Delete file_util from ex-Chromium IPC source. r=froydnj
Depends on D26746

Differential Revision: https://phabricator.services.mozilla.com/D26747

--HG--
extra : moz-landing-system : lando
2019-06-17 02:20:06 +00:00
Jed Davis
44feccfac6 Bug 1479960 - Add freezing of IPC shared memory. r=froydnj,kmag
This allows writing to shared memory and then making it read-only before
sharing it to other processes, such that a malicious sandboxed process
cannot regain write access.  This is currently available only in the
low-level base::SharedMemory interface.

The freeze operation exposes the common subset of read-only shared
memory that we can implement on all supported OSes: with some APIs
(POSIX shm_open) we can't revoke writeability from existing capabilies,
while for others (Android ashmem) we *must* revoke it.  Thus, we require
that the writeable capability not have been duplicated or shared to
another process, and consume it as part of freezing.  Also, because in
some backends need special handling at creation time, freezeability must
be explicitly requested.

In particular, this doesn't allow giving an untrusted process read-only
access to memory that the original process can write.

Note that on MacOS before 10.12 this will use temporary files in order to
avoid an OS security bug that allows regaining write access; those OS
versions are no longer supported by Apple (but are supported by Firefox).

Depends on D26742

Differential Revision: https://phabricator.services.mozilla.com/D26743

--HG--
extra : moz-landing-system : lando
2019-06-20 16:05:13 +00:00
Jed Davis
98db2d6a2a Bug 1479960 - Clean up shared_memory_posix error handling. r=froydnj
This uses RAII to handle error-case cleanup in the POSIX backend for
SharedMemory::Create, to simplify the complexity that will be added to
support freezing.

Depends on D26741

Differential Revision: https://phabricator.services.mozilla.com/D26742

--HG--
extra : moz-landing-system : lando
2019-06-17 02:19:50 +00:00
Jed Davis
27bfc36f5d Bug 1479960 - Fix max_size in shared_memory_posix. r=froydnj
The Unix backend for shared memory needs to keep the mapped size to pass
to munmap, while the Windows backend doesn't.  Currently it's reusing the
max_size field, and then zeroing it when it's unmapped, which breaks the
freezing use case.  This patch uses a dedicated field for that.

Depends on D26740

Differential Revision: https://phabricator.services.mozilla.com/D26741

--HG--
extra : moz-landing-system : lando
2019-06-17 02:19:48 +00:00
Jed Davis
d1d5748834 Bug 1479960 - Get rid of base::SharedMemory::handle. r=froydnj
Despite the comment saying not to use the "handle" except as an opaque
identifier, it is being used to pass the handle to other OS APIs.  Direct
access to the handle needs to be controlled to make sure freezing is
safe, so this patch replaces that with interfaces that are more explicit
about ownership and lifetime.

Depends on D26739

Differential Revision: https://phabricator.services.mozilla.com/D26740

--HG--
extra : moz-landing-system : lando
2019-06-17 02:19:46 +00:00
Jed Davis
ef4778bda8 Bug 1479960 - Remove SHM_ANON support. r=froydnj
FreeBSD's SHM_ANON is useful for the usual case of shared memory, but it
doesn't support freezing.  It could be re-added later, but for now it's
simplest to remove it (and use named shm instead) while refactoring.

Depends on D26738

Differential Revision: https://phabricator.services.mozilla.com/D26739

--HG--
extra : moz-landing-system : lando
2019-06-17 02:19:44 +00:00
PHO
08186e772d Bug 1553389 - Fix "pipe error: Message too long" on NetBSD 2019-05-22 15:13:33 +09:00
Nika Layzell
e71da28e87 Bug 1547218 - Part 2: Stop special casing pointer types in ParamTraits specialization, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D29779

--HG--
extra : moz-landing-system : lando
2019-05-21 17:04:39 +00:00
Sylvestre Ledru
e226046cb8 Bug 1547143 - Format the tree: Be prescriptive with the pointer style (left) r=Ehsan
# ignore-this-changeset

Depends on D28954

Differential Revision: https://phabricator.services.mozilla.com/D28956

--HG--
extra : moz-landing-system : lando
2019-05-01 08:47:10 +00:00
Sylvestre Ledru
03fc65347c Bug 1542146 - Apply the change with the option StatementMacros from clang-format-8 r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D26280

--HG--
extra : moz-landing-system : lando
2019-04-05 21:42:17 +00:00
Csoregi Natalia
ba58e936bd Backed out changeset 4ad80127f89f (bug 1519636) for bustage on MarkupMap.h and nsAccessibilityService.cpp. CLOSED TREE 2019-04-05 09:48:19 +03:00
Sylvestre Ledru
d1c1878603 Bug 1519636 - clang-format-8: Reformat recent changes to the Google coding style r=Ehsan
clang-format-8 upstream had some improvements wrt macros
See: https://reviews.llvm.org/D33440
This is why the diff is bigger than usual

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D26098

--HG--
extra : moz-landing-system : lando
2019-04-04 21:36:16 +00:00
Narcis Beleuzu
24dbe577a5 Backed out changeset 389b6bbd76db (bug 1519636) for bustages on MarkupMap.h . CLOSED TREE 2019-04-05 00:27:56 +03:00
Sylvestre Ledru
399dbd28fe Bug 1519636 - clang-format-8: Reformat recent changes to the Google coding style r=Ehsan
clang-format-8 upstream had some improvements wrt macros
See: https://reviews.llvm.org/D33440
This is why the diff is bigger than usual

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D26098

--HG--
extra : moz-landing-system : lando
2019-04-04 20:12:23 +00:00
Sylvestre Ledru
ef0bfc3822 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D24168

--HG--
extra : moz-landing-system : lando
2019-03-31 15:12:55 +00:00
Cosmin Sabou
3d469329a4 Merge mozilla-inbound to mozilla-central. a=merge 2019-03-27 06:45:13 +02:00
dOn'tReallycAre
2823fecb3a Bug 1353767 - BufferList methods that can OOM should all be MOZ_MUST_USE. r=billm
The Pickle methods can use MOZ_ALWAYS_TRUE because the BufferList is
infallible, so the WriteBytes calls will never fail.
2019-03-26 13:24:00 +02:00
Cameron McCormack
349f8a0865 Bug 1538045 - use MAP_FAILED instead of (void*)-1 in shared_memory_posix.cc. r=jld
Differential Revision: https://phabricator.services.mozilla.com/D24458

--HG--
extra : moz-landing-system : lando
2019-03-26 22:06:18 +00:00
Cameron McCormack
bc72d9813e Bug 1515551 - Add functionality to SharedMemoryBasic to help map the shared memory at an arbitrary address. r=kmag
This patch adds two things:

1. An optional fixed_address argument to SharedMemoryBasic::Map, which
   is the address to map the shared memory at.

2. A FindFreeAddressSpace function that callers can use to find a
   contiguous block of free address space, which can then be used to
   determine an address to pass in to Map that is likely to be free.

Patches in bug 1474793 will use these to place the User Agent style
sheets in a shared memory buffer in the parent process at an address
that is also likely to be free in content processes.

Differential Revision: https://phabricator.services.mozilla.com/D15057

--HG--
extra : moz-landing-system : lando
2019-03-22 00:11:51 +00:00
Nika Layzell
dec9708f74 Bug 1522579 - Part 6: Completely remove nsIContent{Parent,Child}, r=mccr8
Depends on D20553

Differential Revision: https://phabricator.services.mozilla.com/D20870

--HG--
extra : moz-landing-system : lando
2019-02-25 20:04:55 +00:00
Andreea Pavel
cd1b27ad4d Backed out 6 changesets (bug 1522579) for build bustages on a CLOSED TREE
Backed out changeset 3c8320baa230 (bug 1522579)
Backed out changeset 0a288a3d85cd (bug 1522579)
Backed out changeset ecfd27e7d150 (bug 1522579)
Backed out changeset eda40fca0758 (bug 1522579)
Backed out changeset 5c7aafa32a0a (bug 1522579)
Backed out changeset a3c5a2c16411 (bug 1522579)
2019-02-25 18:19:38 +02:00
Nika Layzell
072dbde694 Bug 1522579 - Part 6: Completely remove nsIContent{Parent,Child}, r=mccr8
Depends on D20553

Differential Revision: https://phabricator.services.mozilla.com/D20870

--HG--
extra : moz-landing-system : lando
2019-02-25 15:51:25 +00:00