Граф коммитов

1199 Коммитов

Автор SHA1 Сообщение Дата
Florian Quèze f447ef94de Bug 1688300 - Add 'Runnable' profiler markers showing when runnables are executed and a 'Task' label frame showing which tasks are started by TaskController, r=bas,gerald.
Differential Revision: https://phabricator.services.mozilla.com/D102803
2021-01-26 08:57:19 +00:00
Sylvestre Ledru b58ddc19df Bug 1519636 - Reformat recent changes to the Google coding style r=andi
Updated with Debian clang-format version 11.0.1-1

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D100934
2021-01-06 17:17:23 +00:00
Markus Stange 5cd8830a74 Bug 1683723 - Replace deprecated Cocoa enum constants with their modern replacements. r=spohl
I ran the following command:

```
rg -l 'NSAlphaShiftKeyMask' . | xargs sed -i '' -e 's/NSAlphaShiftKeyMask/NSEventModifierFlagCapsLock/g'
rg -l 'NSAlternateKeyMask' . | xargs sed -i '' -e 's/NSAlternateKeyMask/NSEventModifierFlagOption/g'
rg -l 'NSAnyEventMask' . | xargs sed -i '' -e 's/NSAnyEventMask/NSEventMaskAny/g'
rg -l 'NSApplicationDefined' . | xargs sed -i '' -e 's/NSApplicationDefined/NSEventTypeApplicationDefined/g'
rg -l 'NSBorderlessWindowMask' . | xargs sed -i '' -e 's/NSBorderlessWindowMask/NSWindowStyleMaskBorderless/g'
rg -l 'NSCenterTextAlignment' . | xargs sed -i '' -e 's/NSCenterTextAlignment/NSTextAlignmentCenter/g'
rg -l 'NSClosableWindowMask' . | xargs sed -i '' -e 's/NSClosableWindowMask/NSWindowStyleMaskClosable/g'
rg -l 'NSCommandKeyMask' . | xargs sed -i '' -e 's/NSCommandKeyMask/NSEventModifierFlagCommand/g'
rg -l 'NSCompositeCopy' . | xargs sed -i '' -e 's/NSCompositeCopy/NSCompositingOperationCopy/g'
rg -l 'NSControlKeyMask' . | xargs sed -i '' -e 's/NSControlKeyMask/NSEventModifierFlagControl/g'
rg -l 'NSDeviceIndependentModifierFlagsMask' . | xargs sed -i '' -e 's/NSDeviceIndependentModifierFlagsMask/NSEventModifierFlagDeviceIndependentFlagsMask/g'
rg -l 'NSFlagsChanged' . | xargs sed -i '' -e 's/NSFlagsChanged/NSEventTypeFlagsChanged/g'
rg -l 'NSFullScreenWindowMask' . | xargs sed -i '' -e 's/NSFullScreenWindowMask/NSWindowStyleMaskFullScreen/g'
rg -l 'NSFullSizeContentViewWindowMask' . | xargs sed -i '' -e 's/NSFullSizeContentViewWindowMask/NSWindowStyleMaskFullSizeContentView/g'
rg -l 'NSFunctionKeyMask' . | xargs sed -i '' -e 's/NSFunctionKeyMask/NSEventModifierFlagFunction/g'
rg -l 'NSHelpKeyMask' . | xargs sed -i '' -e 's/NSHelpKeyMask/NSEventModifierFlagHelp/g'
rg -l 'NSKeyDown' . | xargs sed -i '' -e 's/NSKeyDown/NSEventTypeKeyDown/g'
rg -l 'NSKeyUp' . | xargs sed -i '' -e 's/NSKeyUp/NSEventTypeKeyUp/g'
rg -l 'NSLeftMouseDownMask' . | xargs sed -i '' -e 's/NSLeftMouseDownMask/NSEventMaskLeftMouseDown/g'
rg -l 'NSLeftMouseDown' . | xargs sed -i '' -e 's/NSLeftMouseDown/NSEventTypeLeftMouseDown/g'
rg -l 'NSLeftMouseDragged' . | xargs sed -i '' -e 's/NSLeftMouseDragged/NSEventTypeLeftMouseDragged/g'
rg -l 'NSLeftMouseUp' . | xargs sed -i '' -e 's/NSLeftMouseUp/NSEventTypeLeftMouseUp/g'
rg -l 'NSMiniaturizableWindowMask' . | xargs sed -i '' -e 's/NSMiniaturizableWindowMask/NSWindowStyleMaskMiniaturizable/g'
rg -l 'NSMiniControlSize' . | xargs sed -i '' -e 's/NSMiniControlSize/NSControlSizeMini/g'
rg -l 'NSMouseEntered' . | xargs sed -i '' -e 's/NSMouseEntered/NSEventTypeMouseEntered/g'
rg -l 'NSMouseExited' . | xargs sed -i '' -e 's/NSMouseExited/NSEventTypeMouseExited/g'
rg -l 'NSMouseMoved' . | xargs sed -i '' -e 's/NSMouseMoved/NSEventTypeMouseMoved/g'
rg -l 'NSNumericPadKeyMask' . | xargs sed -i '' -e 's/NSNumericPadKeyMask/NSEventModifierFlagNumericPad/g'
rg -l 'NSOtherMouseDownMask' . | xargs sed -i '' -e 's/NSOtherMouseDownMask/NSEventMaskOtherMouseDown/g'
rg -l 'NSOtherMouseDown' . | xargs sed -i '' -e 's/NSOtherMouseDown/NSEventTypeOtherMouseDown/g'
rg -l 'NSOtherMouseDragged' . | xargs sed -i '' -e 's/NSOtherMouseDragged/NSEventTypeOtherMouseDragged/g'
rg -l 'NSOtherMouseUp' . | xargs sed -i '' -e 's/NSOtherMouseUp/NSEventTypeOtherMouseUp/g'
rg -l 'NSRegularControlSize' . | xargs sed -i '' -e 's/NSRegularControlSize/NSControlSizeRegular/g'
rg -l 'NSResizableWindowMask' . | xargs sed -i '' -e 's/NSResizableWindowMask/NSWindowStyleMaskResizable/g'
rg -l 'NSRightMouseDown' . | xargs sed -i '' -e 's/NSRightMouseDown/NSEventTypeRightMouseDown/g'
rg -l 'NSRightMouseDragged' . | xargs sed -i '' -e 's/NSRightMouseDragged/NSEventTypeRightMouseDragged/g'
rg -l 'NSRightMouseUp' . | xargs sed -i '' -e 's/NSRightMouseUp/NSEventTypeRightMouseUp/g'
rg -l 'NSRightTextAlignment' . | xargs sed -i '' -e 's/NSRightTextAlignment/NSTextAlignmentRight/g'
rg -l 'NSScrollWheelMask' . | xargs sed -i '' -e 's/NSScrollWheelMask/NSEventMaskScrollWheel/g'
rg -l 'NSScrollWheel' . | xargs sed -i '' -e 's/NSScrollWheel/NSEventTypeScrollWheel/g'
rg -l 'NSShiftKeyMask' . | xargs sed -i '' -e 's/NSShiftKeyMask/NSEventModifierFlagShift/g'
rg -l 'NSSmallControlSize' . | xargs sed -i '' -e 's/NSSmallControlSize/NSControlSizeSmall/g'
rg -l 'NSTabletPointEventSubtype' . | xargs sed -i '' -e 's/NSTabletPointEventSubtype/NSEventSubtypeTabletPoint/g'
rg -l 'NSTitledWindowMask' . | xargs sed -i '' -e 's/NSTitledWindowMask/NSWindowStyleMaskTitled/g'
```

Then I removed changes to third-party webrtc code, removed a comment in accessible/mac/mozAccessible.mm,
and performed some manual replacements in native_mouse_mac_window.xhtml.

Differential Revision: https://phabricator.services.mozilla.com/D100260
2021-01-05 21:17:11 +00:00
Markus Stange f60ad7ffdd Bug 1679838 - Rename "Gecko_IOThread" to "IPC I/O Parent" and "Chrome_ChildThread" to "IPC I/O Child". r=jld
Depends on D97082

Differential Revision: https://phabricator.services.mozilla.com/D98210
2020-12-03 00:06:02 +00:00
Markus Stange ecf3a22d4d Bug 1677321 - Annotate the idle stack in MessagePumpLibevent::Run with the profiler IDLE category. r=jld
Also annotate non-idle work that's called inside MessagePumpLibevent::Run with
the OTHER category.

Differential Revision: https://phabricator.services.mozilla.com/D97082
2020-12-03 00:06:15 +00:00
Simon Giesecke dd80614fa0 Bug 1678062 - Remove unnecessary includes. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D97467

Depends on D96561
2020-11-23 16:12:02 +00:00
Simon Giesecke ae75be244a Bug 1677466 - Split Endpoint.h and ProtocolMessageUtils.h from ProtocolUtils.h. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D93568

Depends on D93567
2020-11-23 16:06:42 +00:00
Simon Giesecke 971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Gerald Squelart 520450ccf0 Bug 1675406 - Don't record IPC markers if one of the profiler mutexes is locked on the current thread - r=canaltinova
Check `profiler_is_locked_on_current_thread()` before recording an IPC marker.

This removes the deadlock found in bug 1675406:
- SamplerThread: During sampling, some data is recorded into the profile buffer, which locks ProfileChunkedBuffer::mMutex, this triggers some chunk updates that are sent to ProfileBufferGlobalController, which attempts to lock its mutex.
- Main thread: An IPC with an update arrives, ProfileBufferGlobalController locks its mutex, then it sends an IPC out, this records a marker into ProfileChunkedBuffer, which attempts to lock its mMutex.
With this patch and bug 1671403, that last IPC will not record a marker anymore.

Differential Revision: https://phabricator.services.mozilla.com/D96971
2020-11-19 11:48:49 +00:00
Gerald Squelart bfc0fb9f6d Bug 1675409 - Migrated IPCMarkerPayload to Markers 2.0 API - r=gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D96050
2020-11-18 21:52:41 +00:00
Razvan Maries b7eeb731df Backed out 23 changesets (bug 1675409) for build bustages on Preferences.cpp. CLOSED TREE
Backed out changeset c1a131a55767 (bug 1675409)
Backed out changeset 47d210802a5d (bug 1675409)
Backed out changeset e8ebb1c58d30 (bug 1675409)
Backed out changeset 69a1e9aeff2a (bug 1675409)
Backed out changeset 68f330b387a8 (bug 1675409)
Backed out changeset e4750d9ef5a1 (bug 1675409)
Backed out changeset bb6bb71e5ab3 (bug 1675409)
Backed out changeset 988d7f4716df (bug 1675409)
Backed out changeset ca41382e891c (bug 1675409)
Backed out changeset 90f3fbbbbeda (bug 1675409)
Backed out changeset 9b109d61a6f6 (bug 1675409)
Backed out changeset 3dd66abfdaa2 (bug 1675409)
Backed out changeset 44181df5f0db (bug 1675409)
Backed out changeset bb2603d947fc (bug 1675409)
Backed out changeset 97055cf20a56 (bug 1675409)
Backed out changeset f88fcf09de0d (bug 1675409)
Backed out changeset 7963e1c49786 (bug 1675409)
Backed out changeset 4c379c1061c3 (bug 1675409)
Backed out changeset b8be8ae7da63 (bug 1675409)
Backed out changeset 0b90aa89421e (bug 1675409)
Backed out changeset c10fb46467c9 (bug 1675409)
Backed out changeset 894ac233b290 (bug 1675409)
Backed out changeset 075d1d8e34c2 (bug 1675409)
2020-11-18 20:06:28 +02:00
Sylvestre Ledru bebb9f9181 Bug 1519636 - Reformat with clang-format-11 to the Google coding style r=andi,sg,geckoview-reviewers,snorp
It is bringing some minor changes

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D90795
2020-11-18 09:05:59 +00:00
Gerald Squelart f17a3dc5aa Bug 1675409 - Migrated IPCMarkerPayload to Markers 2.0 API - r=gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D96050
2020-11-17 22:22:01 +00:00
Mihai Alexandru Michis c0d25b01b2 Backed out 24 changesets (bug 1666566, bug 1675409) for causing hazard failures in profiler/core/platform.cpp
CLOSED TREE

Backed out changeset 4d8af8533fd4 (bug 1666566)
Backed out changeset f031a3a8a20f (bug 1675409)
Backed out changeset 2b7e1a031921 (bug 1675409)
Backed out changeset bda5a24b2d0a (bug 1675409)
Backed out changeset 4282e2284314 (bug 1675409)
Backed out changeset 0637f1b26e9f (bug 1675409)
Backed out changeset 67ae04c8f607 (bug 1675409)
Backed out changeset 6c7b3f3618ef (bug 1675409)
Backed out changeset 2f325c22d169 (bug 1675409)
Backed out changeset 1e48ff70ad8f (bug 1675409)
Backed out changeset 1dfc32d6871d (bug 1675409)
Backed out changeset 4f1f218a777b (bug 1675409)
Backed out changeset e6ac8722b38e (bug 1675409)
Backed out changeset cf132e15fb57 (bug 1675409)
Backed out changeset a126e6b00ba9 (bug 1675409)
Backed out changeset fbc7fbb04f33 (bug 1675409)
Backed out changeset 554c69681474 (bug 1675409)
Backed out changeset 44d0521c701f (bug 1675409)
Backed out changeset 04653dfe4720 (bug 1675409)
Backed out changeset 41ca2c043a00 (bug 1675409)
Backed out changeset 264ae4c805d4 (bug 1675409)
Backed out changeset 5f3bbdac0d52 (bug 1675409)
Backed out changeset 11311c11a6e8 (bug 1675409)
Backed out changeset 0355fbc44baf (bug 1675409)
2020-11-17 19:31:28 +02:00
Gerald Squelart 878bf41da1 Bug 1675409 - Migrated IPCMarkerPayload to Markers 2.0 API - r=gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D96050
2020-11-17 11:36:32 +00:00
Haik Aftandilian 0c4a7d9835 Bug 1675441 - Use an x64 Widevine GMP Process for Apple Silicon Native Builds r=bryce,spohl
When running as a "universal" build, use an x64 GMP child process if the CDM library is an x64 binary.

Use ifdefs extensively to reduce risk to Intel builds if the fix needs to be uplifted.

Requires a server-side balrog change to serve an Intel Widevine binary to ARM browser versions.

Differential Revision: https://phabricator.services.mozilla.com/D96288
2020-11-11 02:37:57 +00:00
Ricky Stewart 02a7b4ebdf Bug 1654103: Standardize on Black for Python code in `mozilla-central`.
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.

5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-26 18:34:53 +00:00
Bogdan Tara da1098d4aa Backed out 10 changesets (bug 1654103, bug 1672023, bug 1518999) for PanZoomControllerTest.touchEventForResult gv-junit failures CLOSED TREE
Backed out changeset ff3fb0b4a512 (bug 1672023)
Backed out changeset e7834b600201 (bug 1654103)
Backed out changeset 807893ca8069 (bug 1518999)
Backed out changeset 13e6b92440e9 (bug 1518999)
Backed out changeset 8b2ac5a6c98a (bug 1518999)
Backed out changeset 575748295752 (bug 1518999)
Backed out changeset 65f07ce7b39b (bug 1518999)
Backed out changeset 4bb80556158d (bug 1518999)
Backed out changeset 8ac8461d7bd7 (bug 1518999)
Backed out changeset e8ba13ee17f5 (bug 1518999)
2020-10-24 03:36:18 +03:00
Ricky Stewart c0cea3b0fa Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.

5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-23 20:40:42 +00:00
Jed Davis cc6e7ab133 Bug 1440203 - Support memfd_create in IPC shared memory. r=glandium
This commit also allows `memfd_create` in the seccomp-bpf policy for all
process types.

`memfd_create` is an API added in Linux 3.17 (and adopted by FreeBSD
for the upcoming version 13) for creating anonymous shared memory
not connected to any filesystem.  Supporting it means that sandboxed
child processes on Linux can create shared memory directly instead of
messaging a broker, which is unavoidably slower, and it should avoid
the problems we'd been seeing with overly small `/dev/shm` in container
environments (which were causing serious problems for using Firefox for
automated testing of frontend projects).

`memfd_create` also introduces the related operation of file seals:
irrevocably preventing types of modifications to a file.  Unfortunately,
the most useful one, `F_SEAL_WRITE`, can't be relied on; see the large
comment in `SharedMemory:ReadOnlyCopy` for details.  So we still use
the applicable seals as defense in depth, but read-only copies are
implemented on Linux by using procfs (and see the comments on the
`ReadOnlyCopy` function in `shared_memory_posix.cc` for the subtleties
there).

There's also a FreeBSD implementation, using `cap_rights_limit` for
read-only copies, if the build host is new enough to have the
`memfd_create` function.

The support code for Android, which doesn't support shm_open and can't
use the memfd backend because of issues with its SELinux policy (see bug
1670277), has been reorganized to reflect that we'll always use its own
API, ashmem, in that case.

Differential Revision: https://phabricator.services.mozilla.com/D90605
2020-10-22 21:23:32 +00:00
Dorel Luca 1ff59cb7a3 Backed out changeset 7558c8821a07 (bug 1654103) for multiple failures. CLOSED TREE 2020-10-22 03:51:06 +03:00
Dorel Luca 5d3bd01bca Backed out 2 changesets (bug 1440203) for Backout conflicts with Bug 1654103. CLOSED TREE
Backed out changeset 6e44c037b2dc (bug 1440203)
Backed out changeset ab11665d8607 (bug 1440203)
2020-10-22 03:47:17 +03:00
Jed Davis 61a83c3467 Bug 1440203 - Support memfd_create in IPC shared memory. r=glandium
This commit also allows `memfd_create` in the seccomp-bpf policy for all
process types.

`memfd_create` is an API added in Linux 3.17 (and adopted by FreeBSD
for the upcoming version 13) for creating anonymous shared memory
not connected to any filesystem.  Supporting it means that sandboxed
child processes on Linux can create shared memory directly instead of
messaging a broker, which is unavoidably slower, and it should avoid
the problems we'd been seeing with overly small `/dev/shm` in container
environments (which were causing serious problems for using Firefox for
automated testing of frontend projects).

`memfd_create` also introduces the related operation of file seals:
irrevocably preventing types of modifications to a file.  Unfortunately,
the most useful one, `F_SEAL_WRITE`, can't be relied on; see the large
comment in `SharedMemory:ReadOnlyCopy` for details.  So we still use
the applicable seals as defense in depth, but read-only copies are
implemented on Linux by using procfs (and see the comments on the
`ReadOnlyCopy` function in `shared_memory_posix.cc` for the subtleties
there).

There's also a FreeBSD implementation, using `cap_rights_limit` for
read-only copies, if the build host is new enough to have the
`memfd_create` function.

The support code for Android, which doesn't support shm_open and can't
use the memfd backend because of issues with its SELinux policy (see bug
1670277), has been reorganized to reflect that we'll always use its own
API, ashmem, in that case.

Differential Revision: https://phabricator.services.mozilla.com/D90605
2020-10-21 23:34:46 +00:00
Ricky Stewart 50762dacab Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-21 21:27:27 +00:00
Bas Schouten 25a1b0f61f Bug 1669256 - Part 1: Remove AbstractEventQueue and de-templatize ThreadEventQueue. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D92709
2020-10-09 17:56:34 +00:00
Razvan Maries 5fa72e54df Backed out 2 changesets (bug 1440203) for causing bug 1670277. CLOSED TREE
Backed out changeset 0b10bf76fe35 (bug 1440203)
Backed out changeset 468878422866 (bug 1440203)
2020-10-10 03:39:33 +03:00
Jed Davis 3680ce4b19 Bug 1440203 - Support memfd_create in IPC shared memory. r=glandium
This commit also allows `memfd_create` in the seccomp-bpf policy for all
process types.

`memfd_create` is an API added in Linux 3.17 (and adopted by FreeBSD
for the upcoming version 13) for creating anonymous shared memory
not connected to any filesystem.  Supporting it means that sandboxed
child processes on Linux can create shared memory directly instead of
messaging a broker, which is unavoidably slower, and it should avoid
the problems we'd been seeing with overly small `/dev/shm` in container
environments (which were causing serious problems for using Firefox for
automated testing of frontend projects).

`memfd_create` also introduces the related operation of file seals:
irrevocably preventing types of modifications to a file.  Unfortunately,
the most useful one, `F_SEAL_WRITE`, can't be relied on; see the large
comment in `SharedMemory:ReadOnlyCopy` for details.  So we still use
the applicable seals as defense in depth, but read-only copies are
implemented on Linux by using procfs (and see the comments on the
`ReadOnlyCopy` function in `shared_memory_posix.cc` for the subtleties
there).

There's also a FreeBSD implementation, using `cap_rights_limit` for
read-only copies, if the build host is new enough to have the
`memfd_create` function.

Differential Revision: https://phabricator.services.mozilla.com/D90605
2020-10-08 02:25:20 +00:00
Jed Davis 8805b6cb8f Bug 1662564 - Use RAII for the memory mapping in IPC base::SharedMemory, and default its constructors. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D90602
2020-10-07 17:31:34 +00:00
Jed Davis 679d26c651 Bug 1662564 - Change IPC base::SharedMemory to use RAII for file descriptors/handles. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D90601
2020-10-07 17:31:32 +00:00
Razvan Maries 75a5750a87 Backed out 5 changesets (bug 1662564, bug 1664922, bug 1440203) for Valgrind bustages. CLOSED TREE
Backed out changeset 9366b15ee97c (bug 1440203)
Backed out changeset bb512f5fdeda (bug 1440203)
Backed out changeset be90d6aec690 (bug 1664922)
Backed out changeset f6527a1d0f14 (bug 1662564)
Backed out changeset 3a2941fa7d4b (bug 1662564)
2020-10-07 08:38:13 +03:00
Jed Davis c4968e6653 Bug 1440203 - Support memfd_create in IPC shared memory. r=glandium
This commit also allows `memfd_create` in the seccomp-bpf policy for all
process types.

`memfd_create` is an API added in Linux 3.17 (and adopted by FreeBSD
for the upcoming version 13) for creating anonymous shared memory
not connected to any filesystem.  Supporting it means that sandboxed
child processes on Linux can create shared memory directly instead of
messaging a broker, which is unavoidably slower, and it should avoid
the problems we'd been seeing with overly small `/dev/shm` in container
environments (which were causing serious problems for using Firefox for
automated testing of frontend projects).

`memfd_create` also introduces the related operation of file seals:
irrevocably preventing types of modifications to a file.  Unfortunately,
the most useful one, `F_SEAL_WRITE`, can't be relied on; see the large
comment in `SharedMemory:ReadOnlyCopy` for details.  So we still use
the applicable seals as defense in depth, but read-only copies are
implemented on Linux by using procfs (and see the comments on the
`ReadOnlyCopy` function in `shared_memory_posix.cc` for the subtleties
there).

There's also a FreeBSD implementation, using `cap_rights_limit` for
read-only copies, if the build host is new enough to have the
`memfd_create` function.

Differential Revision: https://phabricator.services.mozilla.com/D90605
2020-10-06 19:20:29 +00:00
Jed Davis 1487466d5a Bug 1662564 - Use RAII for the memory mapping in IPC base::SharedMemory, and default its constructors. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D90602
2020-10-06 19:36:21 +00:00
Jed Davis 262e21fc30 Bug 1662564 - Change IPC base::SharedMemory to use RAII for file descriptors/handles. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D90601
2020-10-06 19:36:49 +00:00
shawnjohnjr ac567b3186 Bug 1665534 - Rename fork server process name to forkserver. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D90532
2020-09-21 07:02:42 +00:00
Jed Davis c0cd7e11b5 Bug 1660826 - Work around apparent bug with sendmsg() in some 64-bit Android devices. r=nika
Some Android ARM64 devices appear to have a bug where sendmsg sometimes
returns 0xFFFFFFFF, which we're assuming is a -1 that was incorrectly
truncated to 32-bit and then zero-extended.  This patch detects that
value (which should never legitimately be returned, because it's 16x
the maximum message size) and replaces it with -1, with some additional
assertions.

The workaround is also enabled on x86_64 Android on debug builds only,
so that the code has CI coverage.

Differential Revision: https://phabricator.services.mozilla.com/D89845
2020-09-11 04:31:50 +00:00
Andrew Osmond 67cd43209f Bug 1658847 - Put profiler thread to sleep when allocating memory for shmems. r=mstange
posix_fallocate iterates over each page/block in a shmem to ensure the
OS allocates memory to back it. Large shmems will cause many read/write
calls to be made, and when profiling, it is very likely a SIGPROF signal
will interrupt us at sufficiently high sampling rates. Most attempts at
retrying will fail for the same reason, and this can cause the threads
to block for an indeterminate period of time.

To work around this we use the profiler's "thread sleep" mechanism to
indicate that the sampler thread should not interrupt this thread with
the sampling signal more than once.

Differential Revision: https://phabricator.services.mozilla.com/D87373
2020-08-18 21:40:11 +00:00
Andrew McCreight 681e8793ff Bug 1641614 - Use mozilla::Queue for ChannelImpl::output_queue_h_. r=froydnj
The goal of this patch is to reduce memory usage. On at least OSX, std::Queue
can use 4kb of memory even with nothing in it. This can be around 52kb of
memory per content process.

The segment size of 64 is fairly arbitrary, but these queues didn't have
more than a few hundred items in them, so it seemed like a reasonable
trade off between space for mostly-empty queues and segment overhead.

Differential Revision: https://phabricator.services.mozilla.com/D87325
2020-08-18 17:03:55 +00:00
Butkovits Atila ca6c19bf18 Backed out changeset c574dd7d46ef (bug 1616462) as requested by jld 2020-08-08 01:18:19 +03:00
Jed Davis 7b4c21f949 Bug 1616462 - Make event_base_fd atomic to avoid a TSan error. r=froydnj
See comment #13 on the bug for an explanation of what this fixes, what it
doesn't fix, and why this hasn't been fixed upstream yet.

See also https://github.com/libevent/libevent/issues/779 (upstream bug report)
and https://github.com/libevent/libevent/pull/741 (stalled pull request
with comments explaining the larger problem in more detail).

Differential Revision: https://phabricator.services.mozilla.com/D85781
2020-08-04 15:06:32 +00:00
Jed Davis 8c61fa8fde Bug 1656101 - Delete some IPC dead code (BrowserProcessSubThread types and an unused header). r=mccr8
An actual use of the `BACKGROUND_X11` thread may have briefly existed in
2009 but probably never shipped; it's been unused since then, and even
the comments mentioning it have been pruned (bug 909028, bug 624422).
The other thread types besides IO have been commented out ever since
they were first committed.

This patch also removes `x11_util.h`, which has been unused since 2017
(bug 1426284); earlier in history, it had one of those comments
mentioning the nonexistent X11 thread.

Differential Revision: https://phabricator.services.mozilla.com/D85346
2020-07-29 23:31:38 +00:00
Jed Davis 0e88912e37 Bug 1632687 - Part 3: Introduce an OS-dependent ChannelId type to reflect that Unix doesn't use channel IDs. r=mccr8
The Chromium-derived IPC code was, as far as I can tell, originally
designed for Windows and assumed that channels would be named pipes,
managed and connected to via `std::wstring` paths.  The port to Unix,
however, used unnamed `socketpair()` and passed them directly from
process to process, so it has no use for these channel IDs...  but it
still computes and propagates them, even though they're not used, using
deprecated wide-string APIs.

This patch introduces a typedef for an abstract channel ID, which is a
`wstring` on Windows and an empty struct on Unix, to allow removing the
string code where it's not needed without needing to completely redesign
the channel abstraction.

Differential Revision: https://phabricator.services.mozilla.com/D72260
2020-07-22 19:04:48 +00:00
Jed Davis d3f86fcc5c Bug 1632687 - Part 2: Remove the channel ID prefixes, which we've never used. r=mccr8
Chromium's fix for CVE-2011-3079 added an optional prefix parameter for
channel IDs, but we've never used it and have no plans to.  (Chromium
itself doesn't appear to have used it except with the prefixes "gpu"
and "nacl", and the code has since been removed completely in favor of
Mojo.)  So let's simplify things and remove it.

Differential Revision: https://phabricator.services.mozilla.com/D84276
2020-07-22 19:04:46 +00:00
Jed Davis 053045fdbe Bug 1632687 - Part 1.5: Protect the hard-coded IPC child fd from accidental multiple use. r=mccr8
This "create a pipe" operation has a mode where, on Unix, it doesn't
create a new transport but rather uses a hard-coded fd for the initial
IPC channel in a child process.  (It was originally written for Windows
and the assumption of using named pipes and pathnames for everything.)

That seems like a footgun, so this patch checks for trying to "create"
that pipe twice.  However, it doesn't check for accidentally calling it
in the parent process.

Differential Revision: https://phabricator.services.mozilla.com/D72259
2020-07-22 19:04:44 +00:00
Jed Davis c24433b717 Bug 1632687 - Part 1: Remove IPC PipeMap. r=mccr8
The PipeMap class tries to simulate the Windows channel model (named
pipes that the client opens by a pathname) on Unix.  However, it's
effectively dead code -- the map is empty except in some unit tests that
we never imported.

What we do is generate a "channel ID" with string formatting, then don't
pass it to the child or ever insert anything into the map, then the child
looks up an empty string and doesn't find it, so it uses the hard-coded
fixed fd for the initial channel.

Basically, it does nothing except maybe confuse unfamiliar readers, so
let's get rid of it.

Differential Revision: https://phabricator.services.mozilla.com/D72258
2020-07-22 19:04:37 +00:00
Andrew Osmond d933968108 Bug 1582954 - Use posix_fallocate if available to avoid lazy allocation for shared memory. r=jld
WebRender makes extensive use of shared memory buffers, particularly for
images decoded in the content process. These images can be arbitrarily
large, and there being insufficient memory for an allocation must be
handled gracefully.

On Linux, we will currently crash with a SIGBUS signal during image
decoding instead of just displaying the broken image tag. This is
because the pages backing the shared memory are only allocated when we
write to them. This blocks shipping WebRender on Linux.

This patch uses posix_fallocate to force the reservation of the pages,
and allows failing gracefully if they are unavailable.

Differential Revision: https://phabricator.services.mozilla.com/D80650
2020-07-20 17:47:52 +00:00
Jed Davis 127b9aecbb Bug 1635572 - Remove workaround for shared memory security bug in old macOS versions. r=spohl
CVE-2018-4435 (https://crbug.com/project-zero/1671) was fixed in macOS
10.12 and up, but when we added uses of shm_open that would be affected
by it we still supported 10.9, so we added a workaround that tests for
the bug (by trying to exploit it) and falls back to the slower
alternative of temporary files if necessary.

The minimum supported version is now 10.12, and we've already
committed changes (e.g., to sandboxing) that would break the browser
on older versions, so we can remove this code.  Note that we also have
cross-platform gtests that check for this type of bug, so we'll have some
warning if it's ever reintroduced.

Differential Revision: https://phabricator.services.mozilla.com/D83197
2020-07-13 21:35:22 +00:00
Kashav Madan 4fb30e0688 Bug 1643862 - Move channel buffers into separate heap allocations, r=jld
Moving these out-of-line reduces some IPC::Channel::ChannelImpl slop.

Differential Revision: https://phabricator.services.mozilla.com/D79183
2020-07-03 14:01:41 +00:00
Kashav Madan cfc4c0e2cf Bug 1643732 - Choose a more conservative size for input_cmsg_buf_, r=jld
We'll never read more than MAX_DESCRIPTORS_PER_MESSAGE file descriptors in a
single message, so size the buffer based on that value.

Differential Revision: https://phabricator.services.mozilla.com/D79162
2020-07-03 14:01:28 +00:00
Jim Porter 632c7aa9aa Bug 1613496 - Add IPC profiler markers to track when messages are processed by the IO thread queues r=gerald,froydnj
This adds 3 new profiler markers for each IPC message:

 * One just before the first byte is sent over the IPC channel
 * One just after the last byte is sent over the IPC channel
 * One just after the last byte is received from the IPC channel

With the already-existing IPC markers (for when SendXXX and RecvXXX are
called), this allows us to calculate the following statistics:

 * Send thread latency
 * IPC send duration
 * IPC recv latency
 * Recv thread latency

For more information on how this is presented in the UI, see:
<https://github.com/firefox-devtools/profiler/pull/2535>.

Differential Revision: https://phabricator.services.mozilla.com/D70790
2020-06-30 18:39:42 +00:00
Jean-Yves Avenard 4a24fe3c8e Bug 1647958 - P3. Have GetCurrentSerialEventTarget returns the currently running MessageLoop. r=nika
We want it to returning the actual nsThread if that's where the MessageLoop would dispatch its tasks; otherwise return the MessageLoop's EventTarget

Depends on D80357

Differential Revision: https://phabricator.services.mozilla.com/D80811
2020-06-30 08:04:10 +00:00