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

130 Коммитов

Автор SHA1 Сообщение Дата
Jed Davis 6558ec1572 Bug 1771382 - Adjust the Linux RDD sandbox to handle the nvidia driver being loaded but not used. r=gcp
On multi-GPU systems, even though the GPU we're going to use for
accelerated video decoding is driven by Mesa, sometimes the nvidia
proprietary driver can be loaded and attempt to probe devices.  This
patch attempts to make the sandbox policy quietly return errors for
those syscalls, instead of treating them as unexpected (and crashing on
Nightly).

Differential Revision: https://phabricator.services.mozilla.com/D149652
2022-06-23 00:00:54 +00:00
Chris Martin 190ac22f48 Bug 1770098 - Disable Win32k Lockdown with incompatible mitigations r=handyman,Gankra
Differential Revision: https://phabricator.services.mozilla.com/D148962
2022-06-16 14:05:00 +00:00
Jed Davis c807158580 Bug 1770905 - Allow GeckoMediaPlugin processes on Linux to be profiled if memfd_create is available. r=gcp,mstange,media-playback-reviewers,padenot
There are two parts to this patch; both affect only Linux:

1. The GMP sandbox policy is adjusted to allow certain syscalls used in
   shared memory creation (ftruncate and fallocate).  However, the file
   broker is not used; the process still has no access to files in /dev/shm.

2. The profiler is not initialized for GMP processes unless memfd_create
   is available (so the process can create shared memory to send
   profiling data back, without filesystem access), or the GMP sandbox
   is disabled (either at runtime or build time).

As of this patch, profiling GMP processes on Linux should succeed on
distros with kernel >=3.17 (Oct. 2014), but native stack frames won't
have symbols (and may be incorrectly unwound, not that it matters much
without symbols); see the bug for more info.  Pseudo-stack frames and
markers should work, however.

Differential Revision: https://phabricator.services.mozilla.com/D148470
2022-06-15 20:55:24 +00:00
Jed Davis c4d1df3cf7 Bug 1770905 - Quietly reject `readlink` in the Linux GeckoMediaPlugin sandbox. r=gcp
The profiler may try to readlink `/proc/self/exe` to determine the
executable name; currently, its attempt to get information about loaded
objects is broken for other reasons, so this isn't helpful.  Thus, this
patch has it fail with `EINVAL` (meaning "not a symbolic link) instead of
being treated as unexpected.

(In the future, if we need to, we could simulate that syscall by
recording the target of `/proc/self/exe` before sandboxing, and
recognizing that specific case in a trap function.)

Differential Revision: https://phabricator.services.mozilla.com/D148469
2022-06-15 20:55:23 +00:00
Jed Davis b1826e7b68 Bug 1770523 - Return to not allowing X11 access in the RDD process. r=gcp
The patch for bug 1769499 lets the RDD process create a headless EGL
context using GBM, which needs access only to the GPU device files, not
the display server.  This means that the X11 access recently added in
bug 1769182 can be turned back off.

Differential Revision: https://phabricator.services.mozilla.com/D147792
2022-06-01 16:42:53 +00:00
Alexandre Lissy 74b64ad41e Bug 1769616 - Error(ENOSYS) for set_mempolicy() on Content and Utility AudioDecoder r=jld
Differential Revision: https://phabricator.services.mozilla.com/D146833
2022-05-21 00:01:28 +00:00
Alexandre Lissy cd689b44aa Bug 1769033 - Add OpenBSD sandboxing support r=gaston
Differential Revision: https://phabricator.services.mozilla.com/D146568
2022-05-20 08:25:04 +00:00
Jed Davis 73a294a2b8 Bug 1769182 - Allow the RDD process to use EGL under X11 on Linux. r=gcp
This patch mostly turns on the features set up by the earlier patches:
allow connecting to the X server and reading various related things
(.Xauthority, GPU device info in sysfs, etc.).  It also turns off Mesa's
shader cache in the RDD process; that shouldn't be needed here, and
disabling it lets us avoid dealing with a few things in the sandbox
policy that we'd rather not (e.g., `getpwuid`).

Differential Revision: https://phabricator.services.mozilla.com/D146275
2022-05-19 17:02:33 +00:00
Nika Layzell b8bbcfbc33 Bug 1769124 - Require Recv methods to return IPCResult, r=ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D146243
2022-05-13 02:20:23 +00:00
Chris Peterson 8c5719edb5 Bug 1767947 - Fix macOS build error on aarch64. r=mac-reviewers,tnikkel
To fix this build error:

ERROR -  /builds/worker/fetches/clang/lib/clang/14.0.1/include/xmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"

Wrap #include "emmintrin.h" with (the relevant subset of) the same #ifdefs nsRect.h uses here:

https://searchfox.org/mozilla-central/rev/bf243bc817f97b0bb74af710bd9d874370468e8b/gfx/src/nsRect.h#19-26

Differential Revision: https://phabricator.services.mozilla.com/D145685
2022-05-06 03:29:52 +00:00
Chris Peterson 51164d0dcf Bug 1767881 - Fix non-unified build error in security/sandbox/common. r=haik
#including ApplicationServices.h within `namespace ApplicationServices` indirectly causes emmintrin.h to also be #included in namespace ApplicationServices in non-unified builds.

In file included from security/sandbox/common/test/SandboxTestingChild.cpp:12:
In file included from objdir-x86_64-apple-darwin21.4.0-clang-mozbuild/dist/include/mozilla/ipc/UtilityProcessChild.h:10:
In file included from objdir-x86_64-apple-darwin21.4.0-clang-mozbuild/dist/include/mozilla/ipc/UtilityAudioDecoderParent.h:9:
In file included from objdir-x86_64-apple-darwin21.4.0-clang-mozbuild/ipc/ipdl/_ipdlheaders/mozilla/PRemoteDecoderManagerParent.h:23:
In file included from objdir-x86_64-apple-darwin21.4.0-clang-mozbuild/dist/include/PlatformDecoderModule.h:23:
In file included from objdir-x86_64-apple-darwin21.4.0-clang-mozbuild/dist/include/mozilla/layers/KnowsCompositor.h:10:
In file included from objdir-x86_64-apple-darwin21.4.0-clang-mozbuild/dist/include/mozilla/layers/LayersTypes.h:14:
In file included from objdir-x86_64-apple-darwin21.4.0-clang-mozbuild/dist/include/Units.h:19:
objdir-x86_64-apple-darwin21.4.0-clang-mozbuild/dist/include/nsRect.h:294:26: error: unknown type name '__m128i'; did you mean 'ApplicationServices::__m128i'?
static MOZ_ALWAYS_INLINE __m128i floor_ps2epi32(__m128 x) {
                         ^~~~~~~
                         ApplicationServices::__m128i
/Users/chris/.mozbuild/clang/lib/clang/14.0.1/include/emmintrin.h:20:19: note: 'ApplicationServices::__m128i' declared here
typedef long long __m128i __attribute__((__vector_size__(16), __aligned__(16)));

Differential Revision: https://phabricator.services.mozilla.com/D145516
2022-05-05 04:00:58 +00:00
Jed Davis 272d93bb18 Bug 1759196 - Fix the Linux sandbox's handling of 32-bit arguments on 64-bit platforms. r=gcp,bobowen
Background: When 32-bit types are passed in registers on x86-64 (and
probably other platforms?), the function call ABI does not specify the
contents of the upper half, and the Linux kernel syscall ABI appears to
have the same behavior.

In practice, the upper half is usually zero (or maybe sign-extended from
the lower half), because 64-bit operations aren't cheaper than 32-bit,
and 32-bit operations zero-extend their outputs; therefore, this case
usually doesn't happen in the first place, and any kind of spill or
register move will zero the upper half.  However, arbitrary values are
possible, and a case like this has occurred with the Firefox profiler
using `clock_gettime`.  (This paragraph is applicable to x86-64 and
ARM64; other 64-bit architecutures may behave differently.)

But the Chromium seccomp-bpf compiler, when testing the value of a 32-bit
argument on a 64-bit platform, requires that the value be zero-extended
or sign-extended, and (incorrectly, as far as I can tell) considers
anything else an ABI violation.

With this patch, when that case is detected, we use the `SIGSYS` handler
to zero-extend the problematic argument and re-issue the syscall.

(It would also be possible to just ignore the upper half, and that would
be faster, but that could lead to subtle security holes if the type
used in `bpf_dsl` is incorrect and the kernel really does treat it as
64-bit.)

Differential Revision: https://phabricator.services.mozilla.com/D143964
2022-04-22 02:00:51 +00:00
Norisz Fay 2accd3d077 Backed out changeset f177a4875b01 (bug 1759196) for causing build bustages on Unified_cpp_sandbox_common0.o CLOSED TREE 2022-04-22 00:29:44 +03:00
Jed Davis f8d698d203 Bug 1759196 - Fix the Linux sandbox's handling of 32-bit arguments on 64-bit platforms. r=gcp,bobowen
Background: When 32-bit types are passed in registers on x86-64 (and
probably other platforms?), the function call ABI does not specify the
contents of the upper half, and the Linux kernel syscall ABI appears to
have the same behavior.

In practice, the upper half is usually zero (or maybe sign-extended from
the lower half), because 64-bit operations aren't cheaper than 32-bit,
and 32-bit operations zero-extend their outputs; therefore, this case
usually doesn't happen in the first place, and any kind of spill or
register move will zero the upper half.  However, arbitrary values are
possible, and a case like this has occurred with the Firefox profiler
using `clock_gettime`.  (This paragraph is applicable to x86-64 and
ARM64; other 64-bit architecutures may behave differently.)

But the Chromium seccomp-bpf compiler, when testing the value of a 32-bit
argument on a 64-bit platform, requires that the value be zero-extended
or sign-extended, and (incorrectly, as far as I can tell) considers
anything else an ABI violation.

With this patch, when that case is detected, we use the `SIGSYS` handler
to zero-extend the problematic argument and re-issue the syscall.

(It would also be possible to just ignore the upper half, and that would
be faster, but that could lead to subtle security holes if the type
used in `bpf_dsl` is incorrect and the kernel really does treat it as
64-bit.)

Differential Revision: https://phabricator.services.mozilla.com/D143964
2022-04-21 21:09:52 +00:00
Alexandre Lissy e21d4968c8 Bug 1755316 - Add Utility AudioDecoder Sandbox test r=jld,haik
Differential Revision: https://phabricator.services.mozilla.com/D141471
2022-04-07 10:04:52 +00:00
Alexandre Lissy 3d8f9e85b0 Bug 1753424 - Support running multiple UtilityProcess r=nika
Differential Revision: https://phabricator.services.mozilla.com/D139817
2022-03-26 19:46:43 +00:00
Alexandre Lissy caad540f29 Bug 1753424 - Update SandboxTest code with sandboxingKind r=jld
Differential Revision: https://phabricator.services.mozilla.com/D140744
2022-03-26 19:46:43 +00:00
Cristian Tuns b217ab7e55 Backed out 6 changesets (bug 1753424) for causing build bustages CLOSED TREE
Backed out changeset 930136daf858 (bug 1753424)
Backed out changeset d62c1e5d1881 (bug 1753424)
Backed out changeset 911060d2bd8e (bug 1753424)
Backed out changeset cce723862a92 (bug 1753424)
Backed out changeset 97b3fd69185b (bug 1753424)
Backed out changeset 4748652694c7 (bug 1753424)
2022-03-26 14:49:47 -04:00
Alexandre Lissy 94b46a0084 Bug 1753424 - Support running multiple UtilityProcess r=nika
Differential Revision: https://phabricator.services.mozilla.com/D139817
2022-03-26 09:53:47 +00:00
Alexandre Lissy 4885ddade7 Bug 1753424 - Update SandboxTest code with sandboxingKind r=jld
Differential Revision: https://phabricator.services.mozilla.com/D140744
2022-03-26 09:53:46 +00:00
Butkovits Atila 68679c8f29 Backed out 5 changesets (bug 1753424) for causing bustages. CLOSED TREE
Backed out changeset e2b40064eb59 (bug 1753424)
Backed out changeset 0892c1d3c379 (bug 1753424)
Backed out changeset 4df499ef4647 (bug 1753424)
Backed out changeset f27fbfb9e8f1 (bug 1753424)
Backed out changeset 0f244f2eb2de (bug 1753424)
2022-03-26 16:39:16 +02:00
Alexandre Lissy baebfcdc76 Bug 1753424 - Support running multiple UtilityProcess r=nika
Differential Revision: https://phabricator.services.mozilla.com/D139817
2022-03-26 09:53:47 +00:00
Alexandre Lissy 90da4746ad Bug 1753424 - Update SandboxTest code with sandboxingKind r=jld
Differential Revision: https://phabricator.services.mozilla.com/D140744
2022-03-26 09:53:46 +00:00
Randell Jesup fcaf70841e Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 18:47:08 +00:00
Noemi Erli 2390d257e6 Backed out changeset 12a59e5a50bf (bug 1207753) for causing build bustage CLOSED TREE 2022-03-16 18:32:51 +02:00
Randell Jesup 4b033a5256 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 16:16:14 +00:00
Butkovits Atila 927ad62c6a Backed out changeset a68ee4b09f92 (bug 1207753) for causing Hazard bustages. CLOSED TREE 2022-03-16 14:38:14 +02:00
Randell Jesup 7d4b5fae04 Bug 1207753 - Add MOZ_UNANNOTATED to all Mutexes/Monitors r=nika,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D140849
2022-03-16 12:01:14 +00:00
criss b61bbd064d Merge autoland to mozilla-central. a=merge 2022-03-16 11:49:56 +02:00
Haik Aftandilian e08fe4e5c5 Bug 1759408 - [macOS] Add sandboxing tests to more process types r=gerard-majax
Add the WindowServer test and process launch tests to each Mac child process type.

Differential Revision: https://phabricator.services.mozilla.com/D140941
2022-03-16 04:36:54 +00:00
Cosmin Sabou 74d7d4ed0c Backed out changeset 49a22cd6d6ee (bug 1759408) for causing build bustages on SandboxTestingChildTests.h. CLOSED TREE 2022-03-15 08:09:09 +02:00
Haik Aftandilian 5500a5a34a Bug 1759408 - [macOS] Add sandboxing tests to more process types r=gerard-majax
Add the WindowServer test and process launch tests to each Mac child process type.

Differential Revision: https://phabricator.services.mozilla.com/D140941
2022-03-15 05:47:18 +00:00
Julien Wajsberg 5aed3f508f Bug 1756791 - Allow the getcpu syscall in the sandbox r=gcp
Recently bug 1753305 introduced the use of the getcpu syscall to add
this information to a profiler marker, but didn't allow this syscall
from the sandbox. In most situations this syscall doesn't happen because
of the VDSO mechanism. However in the cases where VDSO isn't used such
as running under rr, the sandbox crashes the process when starting the
profiler.

Thanks :padenot, :lissyx, :jcristau for all the help.

Differential Revision: https://phabricator.services.mozilla.com/D139712
2022-03-09 10:15:14 +00:00
Jed Davis 9082363e4e Bug 1129492 - Remove X11 access from the Linux content process sandbox. r=gcp,jgilbert
Background: The X11 protocol has a very permissive security model;
clients have essentially full access to the windows of other clients,
and to global resources like input devices.  Previously, our sandbox
policy for content processes needed to allow access to the X server;
this limited its effectiveness against a dedicated attacker.

This patch turns on the `security.sandbox.content.headless` pref added
in bug 1640345, which removes the sandbox policy rules that allowed
making new X11 connections, as well as opening the Xauthority file,
reading hardware info needed by Mesa, etc.  It also runs content
processes in headless mode (whence the name) so they won't connect to a
display server at startup.

This also removes access to the Wayland compositor: the sandbox policy
never allowed that (as of when socket connections became default-deny),
but now content processes won't connect to it at startup.  Wayland is
more capability-oriented so this is less significant for security, but at
a minimum it removes unnecessary attack surface.

Note that if the `webgl.out-of-process` pref is turned off, WebGL
will break unless `security.sandbox.content.headless` is also turned
off.  (Similarly, `widget.non-native-theme.enabled` is needed to render
scrollbars and form controls in content.)  As a result, this patch
adjusts the job definitions used by CI to test in-process WebGL so that
that they will continue to work.

Differential Revision: https://phabricator.services.mozilla.com/D138613
2022-03-01 20:36:18 +00:00
Tom Ritter cfbe02ff6e Bug 1750859: If not all decoders are remoted, you're disqualified from win32k r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D139043
2022-02-17 18:59:17 +00:00
Bob Owen e82a8ce887 Bug 1695556 p3: Add file tests for content process sandbox. r=handyman,ipc-reviewers,jld
Depends on D135693

Differential Revision: https://phabricator.services.mozilla.com/D135694
2022-02-10 16:56:02 +00:00
Nika Layzell dabb46c84d Bug 1736371 - Default new actors to be refcounted, r=alwu,media-playback-reviewers,mccr8
The changes to ipdl actors were mechanical, and largely automated using
a script.

Differential Revision: https://phabricator.services.mozilla.com/D137237
2022-02-09 17:29:47 +00:00
Tom Ritter d59df896db Bug 1751494 - Move win32k logic from sandbox to apprunner r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D137324
2022-02-02 16:33:11 +00:00
Tom Ritter 6013bc9b5a Bug 1751494 - Add additional checks/returns to GetContentWin32kLockdownState r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D136802
2022-02-02 16:33:10 +00:00
Tom Ritter 77751c55be Bug 1751494 - Add new enum values to ContentWin32kLockdownState r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D136801
2022-02-02 16:33:10 +00:00
Andi-Bogdan Postelnicu 30631a4a9b Bug 1519636 - Reformat recent changes to the Google coding style. r=sylvestre
Updated with clang-format version 13.0.0 (taskcluster-dIIauZE0TkuXy6_23BQhcw)

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D137147
2022-01-31 17:00:21 +00:00
Alexandre Lissy 52bcca7a4f Bug 1749606 - Allow clock_gettime() for same-process r=jld,gerald
This is used by the new code from the profiler that is able to detect
unregistered threads. Blocking it will make child-process hit sandbox
violation.

Differential Revision: https://phabricator.services.mozilla.com/D135648
2022-01-21 23:03:26 +00:00
Jed Davis ddb3043ed2 Bug 1744203 - Fix the `connect_abstract_permit` test to handle X11 connections not being allowed. r=gerard-majax
Differential Revision: https://phabricator.services.mozilla.com/D132854
2022-01-13 23:35:08 +00:00
Jed Davis 00df4118bc Bug 1744203 - Fix SandboxTesting when test cases expect a specific error. r=gerard-majax
The original SandboxTesting protocol assumed tests would just care about
whether operations succeeded or failed, but now we have tests that check
for specific error codes.  Currently that doesn't work well: getting an
error with the wrong error code is misreported as the syscall succeeding.

This patch changes the protocol to simply indicate whether the test
passed and give an unstructured message about what happened, and fixes
the `SandboxTestingChild::*Test` methods to include the relevant
information in the message.

Differential Revision: https://phabricator.services.mozilla.com/D132853
2022-01-13 23:35:08 +00:00
Csoregi Natalia 70ac86b966 Bug 1736605 - Fix lint. r=fix CLOSED TREE 2022-01-13 23:26:26 +02:00
Chris Martin b7ee1508ef Bug 1736605- Enable out-of-process WebGL without HW accel
Currently, there are situations where Remote WebGL is disabled due to
lack of HW support (For example, if it is run in a Virtual Machine)

This makes it so that the WebGL remoting is enabled anyway, since it is
needed for Win32k Lockdown.

Differential Revision: https://phabricator.services.mozilla.com/D135650
2022-01-13 20:51:22 +00:00
Butkovits Atila 20fcf81609 Backed out changeset 28880b7218fc (bug 1736605) for causing Xpcshell failrues at test_TelemetryEnvironment.js. CLOSED TREE 2022-01-13 00:44:32 +02:00
Alexandre Lissy 161f130b0a Bug 1731890 - Adding Utility process with basic sandbox r=agi,nika,bobowen
Differential Revision: https://phabricator.services.mozilla.com/D126297
2022-01-12 20:52:58 +00:00
Chris Martin d9c4fe1b24 Bug 1736605- Enable out-of-process WebGL without HW accel r=jgilbert
Currently, there are situations where Remote WebGL is disabled due to
lack of HW support (For example, if it is run in a Virtual Machine)

This makes it so that the WebGL remoting is enabled anyway, since it is
needed for Win32k Lockdown.

Differential Revision: https://phabricator.services.mozilla.com/D135649
2022-01-12 19:08:42 +00:00
Jed Davis 739cc884e7 Bug 1743928 - Allow DMA-Buf ioctls for RDD. r=stransky,alwu
In some cases (doing video decode on the CPU and uploading the result
with dmabuf) we'll need to use `DMA_BUF_IOCTL_SYNC` in the RDD process.
This patch allows that ioctl type ('b', used only by dmabuf and Android
binder; the latter doesn't apply on Desktop), for forward compatibility
with any future usage of dmabuf ioctls.

Differential Revision: https://phabricator.services.mozilla.com/D133715
2021-12-16 21:23:11 +00:00