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

1744 Коммитов

Автор SHA1 Сообщение Дата
Jed Davis ac85827e83 Bug 1698778 - Allow filtering SysV IPC call arguments. r=gcp
On 32-bit x86, Linux originally used a single system call, ipc(2), for
all SysV IPC.  This is similar to socketcall(2), but the arguments are
passed directly (shifted by one position) instead of indirected via
a pointer, so seccomp-bpf can filter them normally.  Also similar to
socketcall(2), individual syscalls were added later (in kernel 5.1,
vs. 4.3 for socket calls), so the policy needs to handle both of them,
adjusting argument offsets as needed.  This patch adds an argument to
`EvaluateIpcCall` to allow that.

Differential Revision: https://phabricator.services.mozilla.com/D131678
2021-11-23 01:14:40 +00:00
M. Sirringhaus 59c1dc3789 Bug 1736990 - Expose /dev/random and /proc/sys/crypto/fips_enabled in sandboxes. r=bryce,gcp
For running in FIPS mode, NSS needs to check /proc/sys/crypto/fips_enabled, to be able to tell whether FIPS is enabled or not.
FIPS also mandates using /dev/random instead of /dev/urandom.

Differential Revision: https://phabricator.services.mozilla.com/D129126
2021-11-16 14:16:19 +00:00
Jed Davis 3f4202c5c0 Bug 1401774 - Make fd exhaustion errors from the Linux sandbox broker more obvious. r=gcp
If we get `MSG_CTRUNC` back from `recvmsg` in this context, it means
a file descriptor couldn't be received; because the sender will never
attach too many fds, the only reasonable cause is fd exhaustion in the
receiving process.  Therefore, we should return `EMFILE` ("Too many open
files") instead of `EMSGSIZE` ("Message too long") to reduce confusion
when reading log messages.

Differential Revision: https://phabricator.services.mozilla.com/D129891
2021-11-03 23:53:43 +00:00
Jed Davis b0774ee6e3 Bug 1408438 - Remove O_ASYNC from Linux sandbox file broker allowed flags. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D129890
2021-11-03 23:53:43 +00:00
Jon Bauman 874adf9b96 Bug 1734058 - Update dav1d to new version f52aee04fbd711cddab23d0aa9b196e9c963e7b8 from 2021-10-04 21:58:36. r=mjf,haik
This is a fairly significant update, so required a few changes to Gecko code, but I've commented on the interesting details, so they should be easy to find

Differential Revision: https://phabricator.services.mozilla.com/D129465
2021-10-26 17:11:36 +00:00
Bob Owen 93b7d525df Bug 1713973 p4: Test brokered complex breaker against Uniscribe in content. r=jfkthame
Depends on D129143

Differential Revision: https://phabricator.services.mozilla.com/D129144
2021-10-26 09:58:52 +00:00
Bob Owen 2db5ff3913 Bug 1713973 p2: Add Uniscribe Line Breaking via chromium-sandbox IPC. r=tkikuchi,jfkthame
This adds a new cross call using the chromium shared memory IPC to proxy use of
the Uniscribe line breaker, because it cannot be used in the content process
with win32k lockdown enabled.

If the text being processed is too long to fit into the IPC params then it is
processed in chunks.

This change implements an INPTR_TYPE in the sandbox, which appears to have
been removed at some point.
It also fixes a bug in OpcodeFactory::MakeOpAction, so that a null param is
passed and we can use an empty parameter set.

New files are in chromium-shim as these are most likely to require changes and
this means we will not have to update the main chromium patch.

Depends on D129125

Differential Revision: https://phabricator.services.mozilla.com/D126809
2021-10-26 09:58:51 +00:00
Florian Quèze bcdfb763fc Bug 1736040 - collect CPU time through Glean, r=chutten,gerald,gcp
Differential Revision: https://phabricator.services.mozilla.com/D128609
2021-10-25 18:27:24 +00:00
Haik Aftandilian 96b2e2a022 Bug 1467758 - WindowServer connection never being terminated r=spohl
Drop the window server connection from the content process sandbox when out-of-process WebGL is enabled.

Differential Revision: https://phabricator.services.mozilla.com/D128842
2021-10-19 16:38:33 +00:00
Jed Davis cbde13526d Bug 1725148 - Fix how we find the Xauthority file for sandbox policies. r=gcp
If the `XAUTHORITY` env var is unset, libXau will fall back to
`$HOME/.Xauthority`, but our content sandbox policy didn't handle that
case when it needs to allow access to that file; this patch corrects
that oversight.

This broke WebGL as of bug 1635451, because we no longer eagerly connect
to the X server before sandbox startup, only as needed for WebGL.

Usually the `XAUTHORITY` env var is set even if the file is in its
default location, but some environments (including but not limited to
the Linux VMs on Chrome OS) do not set it.

Differential Revision: https://phabricator.services.mozilla.com/D127984
2021-10-14 03:12:40 +00:00
Kershaw Chang 6f1e16637d Bug 1732150 - Remove MITIGATION_DYNAMIC_CODE_DISABLE when we want to parsing PAC on socket process, r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D127552
2021-10-11 19:17:58 +00:00
Cristian Tuns 557947a3d8 Backed out 2 changesets (bug 1732150, bug 1475641) for causing GTest failures on SocketProcessChild.cpp. CLOSED TREE
Backed out changeset 45877c2e8d6b (bug 1475641)
Backed out changeset d6684da1c643 (bug 1732150)
2021-10-11 07:07:33 -04:00
Kershaw Chang 467f33dd4d Bug 1732150 - Remove MITIGATION_DYNAMIC_CODE_DISABLE when we want to parsing PAC on socket process, r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D127552
2021-10-11 08:30:41 +00:00
Olivier Tilloy bf8b8ae679 Bug 1732580 - Allow read access to files under $SNAP/ in the webcontent sandbox. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D127565
2021-10-08 19:12:16 +00:00
Jens Stutte 4320224207 Bug 1731564: Use motivated SpinEventLoopUntil inside security/*. r=bobowen
Depends on D127231

Differential Revision: https://phabricator.services.mozilla.com/D127232
2021-10-07 08:06:14 +00:00
Marian-Vasile Laza 18fb16c542 Backed out 18 changesets (bug 1731564) for causing build bustages on SpinEventLoopUntil. CLOSED TREE
Backed out changeset 0464dbdc8584 (bug 1731564)
Backed out changeset 0d996df13545 (bug 1731564)
Backed out changeset 5630a0e7a109 (bug 1731564)
Backed out changeset 37b41d187cdb (bug 1731564)
Backed out changeset d37700fa60b6 (bug 1731564)
Backed out changeset b0ce7db44b99 (bug 1731564)
Backed out changeset aa5ec3aa1535 (bug 1731564)
Backed out changeset 73b648f1fa70 (bug 1731564)
Backed out changeset bb8fb0f9833e (bug 1731564)
Backed out changeset 0d8905144f5d (bug 1731564)
Backed out changeset 2cfb094a1ec3 (bug 1731564)
Backed out changeset 78d3b0257a6a (bug 1731564)
Backed out changeset e9d32926e93c (bug 1731564)
Backed out changeset 874cab520ce5 (bug 1731564)
Backed out changeset d8071cc32bd9 (bug 1731564)
Backed out changeset 283c5393cbbc (bug 1731564)
Backed out changeset 317bc38e3de5 (bug 1731564)
Backed out changeset 53e3f4862439 (bug 1731564)
2021-10-07 00:09:19 +03:00
Jens Stutte 7b6bc8c02e Bug 1731564: Use motivated SpinEventLoopUntil inside security/*. r=bobowen
Depends on D127231

Differential Revision: https://phabricator.services.mozilla.com/D127232
2021-10-06 19:45:15 +00:00
Alexandre Lissy a44a09d056 Bug 1733814 - Add /run/host/local-fonts to sandbox r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D127519
2021-10-05 08:19:03 +00:00
Csoregi Natalia f4117debbf Backed out changeset b9abaf976608 (bug 1652463) as per request. CLOSED TREE 2021-09-30 21:05:47 +03:00
Daniel Holbert 80262e03fb Bug 1730265: Add includes to SandboxTestingChild.cpp and SandboxTestingParent.cpp to fix build errors with --disable-unified-build. r=handyman
These includes provide some types and functionality that these files need. In
the default build environment, there's no issue because they pick up these
includes via piggybacking on neighboring files that they're unified with; but
in a non-unified build, the files need to directly have these includes, to
avoid build errors.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1730265#c0 for the specific
build errors being addressed here.

Differential Revision: https://phabricator.services.mozilla.com/D125285
2021-09-10 22:07:52 +00:00
Ben Hearsum 1ce8af6321 Bug 1714200: annotate remaining M1 test failures. r=jmaher,application-update-reviewers,bytesized DONTBUILD
Depends on D124907

Differential Revision: https://phabricator.services.mozilla.com/D124908
2021-09-08 18:14:01 +00:00
Kershaw Chang db54d51818 Bug 1729453 - Allow socket process to enable TCSM, r=haik
Differential Revision: https://phabricator.services.mozilla.com/D124798
2021-09-08 07:17:23 +00:00
Mark Banner 11bfa90d06 Bug 1602940 - Automated replacements to use Services.uuid. r=Gijs,necko-reviewers,preferences-reviewers,kershaw
Depends on D124391

Differential Revision: https://phabricator.services.mozilla.com/D124392
2021-09-06 09:53:52 +00:00
Emilio Cobos Álvarez cfca657d9c Bug 1722487 - Avoid some work for font list updates. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D123363
2021-08-26 23:17:54 +00:00
Jed Davis 3e1dc3d1eb Bug 1712506 - In the Linux CDM sandbox, don't log when denying access to certain files. r=gcp
The Widevine CDM tries to open certain procfs/sysfs files, as noted
in the bug, but doesn't appear to need them; some of them are opened
repeatedly, causing log spam.  This patch suppresses logging for the
files where this is known to happen, by adding "opened file" objects
that always silently fail.

It would also be possible to turn off all of this logging by default
and make it conditional on MOZ_SANDBOX_LOGGING, but it's relatively
low-noise (compared to content process file access) and provides some
value (see bug 1725828), so for now let's leave it enabled and just
blocklist a few files.

Differential Revision: https://phabricator.services.mozilla.com/D123562
2021-08-26 23:10:30 +00:00
Bob Owen 86f8ba4dc4 Bug 1652463: Add rule to allow socket process to create server side of our IPC pipes. r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D83976
2021-08-25 11:43:46 +00:00
Andi-Bogdan Postelnicu 2fc4f70e9b Bug 1725145 - Preparation for the hybrid build env. r=necko-reviewers,firefox-build-system-reviewers,valentin,glandium
Automatically generated path that adds flag `REQUIRES_UNIFIED_BUILD = True` to `moz.build`
when the module governed by the build config file is not buildable outside on the unified environment.

This needs to be done in order to have a hybrid build system that adds the possibility of combing
unified build components with ones that are built outside of the unified eco system.

Differential Revision: https://phabricator.services.mozilla.com/D122345
2021-08-25 10:46:17 +00:00
Alexandre Lissy f41c9baf2b Bug 1723753 - Remove XRE_USER_SYS_EXTENSION_DEV_DIR r=handyman,robwu,haik,gcp
Differential Revision: https://phabricator.services.mozilla.com/D121647
2021-08-10 15:54:02 +00:00
stransky 2e7b1387b7 Bug 1721326 - Use small stack for DoClone(). r=jld
Patch author is Florian Weimer <fweimer 'at' redhat.com>

Differential Revision: https://phabricator.services.mozilla.com/D120709
2021-08-04 06:24:47 +00:00
Alexandre Lissy 5064274394 Bug 1718210 - Enable SandboxTest on Windows/Debug r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D121047
2021-07-29 15:07:24 +00:00
Alexandre Lissy e59f6995be Bug 1718084 - Test allow $HOME/.config and block $HOME/.config/mozilla/ r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D119179
2021-07-27 08:07:22 +00:00
Alexandre Lissy 583a763b25 Bug 1718084 - Block access to $HOME/.config/mozilla/ r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D119180
2021-07-27 08:07:21 +00:00
Alexandre Lissy 6301b3cd09 Bug 1718084 - Reorganize test for lower complexity r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D119375
2021-07-27 08:07:21 +00:00
Alexandre Lissy f7a9b9a730 Bug 1719279 - Properly add $HOME/.cache/fontconfig allowance r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D119178
2021-07-20 12:24:56 +00:00
Bob Owen 189584d4f9 Bug 1716024 p1: Change CET support to compatible modules only. r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D117550
2021-07-19 07:36:19 +00:00
Alexandre Lissy 41550dc422 Bug 1695195 - Set SandboxReporter profiler thread name r=jld
Differential Revision: https://phabricator.services.mozilla.com/D119361
2021-07-15 19:06:35 +00:00
Alexandre Lissy 27dc28950f Bug 1718046 - Use String concatenation rather than AppendPrintf r=handyman
Using AppendPrintf implies pure ASCII content, and strerror() might
return localized string, so this will break.

Differential Revision: https://phabricator.services.mozilla.com/D119286
2021-07-12 19:10:04 +00:00
Jed Davis ce1dc6dc06 Bug 1719391 - Fix fd leak during Linux sandbox file broker creation. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D119456
2021-07-09 21:05:51 +00:00
Makoto Kato f912325645 Bug 1719115 - Add riscv64 defines to build/build_config.h. r=firefox-build-system-reviewers,andi
mozilla-central has some imported files of build_config.h from Chromium.
Actually although they doesn't have riscv64 defines yet, I would like to
add it to build Firefox for riscv64.

Differential Revision: https://phabricator.services.mozilla.com/D119051
2021-07-06 08:05:40 +00:00
Jed Davis a8d8e90b70 Bug 1635451 - Attempt to start WebGL even in headless mode. r=jgilbert
Currently we return an error when creating a WebGL context in headless
mode, but our WebGL implementation renders to an offscreen context, so
in theory it could work normally in a headless browser, and in practice
it already does work on some OSes.  This patch removes that check; the
attempt to use GL may fail, in which case we'll return an error to
content.

The main purpose of this patch is to run content processes with headless
mode set in an otherwise non-headless browser, but it should also be
useful for fully headless mode.  Comments in bug NNNNNNN indicate that
this change should be sufficient for headless WebGL on Windows and MacOS,
although it may not have been extensively tested.

Linux is more complicated.  The EGL/X11 backend manages its own
connection to the X server (indirectly via the EGL library); a later
patch in this series allows doing that in GLX mode as well.  Our Wayland
support can't do this yet, but it should be possible.

This patch also modifies the Linux sandbox policy so that content
processes can connect to a local X server (via the file broker) even when
the parent process is in headless mode.

Differential Revision: https://phabricator.services.mozilla.com/D118721
2021-07-06 07:42:41 +00:00
Alexandre Lissy 3ae5731d66 Bug 1715182 - Tests for SandboxBroker abstract socket r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D118717
2021-06-25 08:44:28 +00:00
Jed Davis 010dd946d2 Bug 1715182 - Sandbox broker abstract socket connect support. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D118716
2021-06-25 08:44:28 +00:00
Alexandre Lissy bedf0db47d Bug 1054621 - Add GMPlugin Sandbox Tests r=handyman,bryce
Differential Revision: https://phabricator.services.mozilla.com/D117533
2021-06-24 06:51:24 +00:00
Alexandre Lissy 426e10f0e2 Bug 1652156 - Add RDD Process Testing to the Sandbox Testing Framework. r=handyman,mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D116894
2021-06-24 06:51:24 +00:00
Nika Layzell 7802bbb486 Bug 1706374 - Part 12b: Use NodeController for primary process channels, r=handyman
This extends on the changes in part 12a and consumes the new PortRef-based API
in all existing process types other than the fork server. The IPDL C++ unit
tests were already broken before this change, and were not updated.

Differential Revision: https://phabricator.services.mozilla.com/D112777
2021-06-22 18:17:23 +00:00
Alexandre Lissy fa60d28ad7 Bug 1717599 - Ensure XDG_CONFIG_DIRS / XDG_CONFIG_HOME are non empty r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D118483
2021-06-22 14:50:05 +00:00
Butkovits Atila 83f57b5c69 Backed out 22 changesets (bug 1714226, bug 1706374, bug 1713148) for causing build bustages on MessageChannel.cpp. CLOSED TREE
Backed out changeset ea469eaa54ca (bug 1713148)
Backed out changeset fd8523d5126e (bug 1713148)
Backed out changeset f2e5309c914c (bug 1713148)
Backed out changeset 2da57973ed55 (bug 1713148)
Backed out changeset 677e1ee99bb2 (bug 1713148)
Backed out changeset b4c0619e79bf (bug 1706374)
Backed out changeset c02fa459e77d (bug 1706374)
Backed out changeset 72dc6537cf0b (bug 1706374)
Backed out changeset 48088463c656 (bug 1706374)
Backed out changeset b09ae4c3a94b (bug 1706374)
Backed out changeset 04422175004b (bug 1706374)
Backed out changeset 110b2384e7d1 (bug 1706374)
Backed out changeset ab2b086abbd4 (bug 1706374)
Backed out changeset ffde07f73249 (bug 1706374)
Backed out changeset c6303af17ff4 (bug 1706374)
Backed out changeset 02249671c2f9 (bug 1706374)
Backed out changeset a6a5d05b5636 (bug 1706374)
Backed out changeset e21b6defb805 (bug 1706374)
Backed out changeset c72c5be9ddb1 (bug 1706374)
Backed out changeset 23cd961575a6 (bug 1706374)
Backed out changeset b412d6e9e145 (bug 1706374)
Backed out changeset a8ec285d6472 (bug 1714226)
2021-06-22 04:03:56 +03:00
Nika Layzell 1d4aba6770 Bug 1706374 - Part 12b: Use NodeController for primary process channels, r=handyman
This extends on the changes in part 12a and consumes the new PortRef-based API
in all existing process types other than the fork server. The IPDL C++ unit
tests were already broken before this change, and were not updated.

Differential Revision: https://phabricator.services.mozilla.com/D112777
2021-06-21 21:53:11 +00:00
Alexandre Lissy f47bb119d5 Bug 1672421 - Use XDG_CONFIG_HOME instead of XDG_CONFIG_PATH r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D117646
2021-06-21 16:47:53 +00:00
Andi-Bogdan Postelnicu f07c975367 Bug 1519636 - Reformat recent changes to the Google coding style. r=necko-reviewers,emilio
Updated with clang-format version 12.0.0 (taskcluster-FZRqPXamQIOU_i4hF0cAcg)

Differential Revision: https://phabricator.services.mozilla.com/D117905
2021-06-17 11:00:22 +00:00
Landry Breuil 2885db7706 Bug 1713745 - include nsXULAppAPI.h to reach GeckoProcessType definition r=gcp
Otherwise the build fails on OpenBSD:
In file included from security/sandbox/common/SandboxSettings.cpp:7:
/usr/obj/m-c/dist/include/mozilla/SandboxSettings.h:39:26: error: unknown type name 'GeckoProcessType'
bool StartOpenBSDSandbox(GeckoProcessType type);

Differential Revision: https://phabricator.services.mozilla.com/D116633
2021-06-14 17:17:24 +00:00
Alexandre Lissy 6b0aef97c6 Bug 1715461 - Improve ARM64 syscall generation r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D117270
2021-06-09 13:51:19 +00:00
Alexandre Lissy 6070f4b26f Bug 1715254 - Deny clone3 to force glibc fallback r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D117297
2021-06-09 13:45:28 +00:00
David Parks 78bd808d59 Bug 1682030 - Remove OSX flash sandbox. r=haik
Removes the Flash sandbox descriptor as part of removing all NPAPI plugin support.

Differential Revision: https://phabricator.services.mozilla.com/D108097
2021-06-06 23:26:26 +00:00
Alexandre Lissy f82be201dc Bug 1714459 - Remove duplicated linux/arm64 syscalls definitions r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D116827
2021-06-04 14:11:32 +00:00
Alexandre Lissy 95528d6cb2 Bug 1713776 - Allow faccessat2 r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D116597
2021-06-03 20:04:08 +00:00
Alexandre Lissy 686d342f66 Bug 1714315 - Unregister sandbox test observers r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D116708
2021-06-03 17:26:17 +00:00
Alexandre Lissy 6b5f586e94 Bug 1710625 - SandboxTest with SocketProcess r=necko-reviewers,handyman,jld,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D114861
2021-06-03 06:45:59 +00:00
M. Sirringhaus a44abd1d0d Bug 1696359 - Broken build on arm/arm64 with older kernel (missing __NR_statx, __NR_rseq) r=jld
Differential Revision: https://phabricator.services.mozilla.com/D107206
2021-06-03 00:07:21 +00:00
Joel Maher 2e841d22cb Bug 1704640 - Move mochitest browser-chrome / media from osx 10.14 to osx 10.15. r=ahal,preferences-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D115951
2021-05-27 16:06:03 +00:00
Andi-Bogdan Postelnicu 1cf28e7475 Bug 1519636 - Reformat recent changes to the Google coding style. r=emilio
Updated with clang-format version 12.0.0 (taskcluster-KEgO7qdgQ8uaewA6NkRnRA)

Differential Revision: https://phabricator.services.mozilla.com/D115804
2021-05-24 15:08:47 +00:00
Chris Martin 1d91d0549c Bug 1709383 - Add Win32k Lockdown status to about:support and Crash Reporter r=gsvelto,flod,bobowen,mossop,fluent-reviewers,chutten
- Move the decision logic for Win32k Lockdown to a common area where it can
  be re-used
- Cache the Win32k Lockdown state, since the result will never change
- Add IDL to allow JavaScript to query it
- Add it to the "about:support" page
- Add an annotation to Crash Reporter after the first time it's read

Differential Revision: https://phabricator.services.mozilla.com/D114850
2021-05-20 19:28:59 +00:00
Chris Martin 8cbf8ae88c Bug 1709383 - Gate Win32k Lockdown on whether WebRender is actually enabled r=bobowen
Win32k Lockdown requires WebRender, but WR is not currently guaranteed
on all computers. It can also fail to initialize and fallback to
non-WR render path.

We don't want a situation where "Win32k Lockdown + No WR" occurs without
the user explicitly requesting unsupported behavior.

Differential Revision: https://phabricator.services.mozilla.com/D114849
2021-05-20 19:28:59 +00:00
Csoregi Natalia 91ab999d72 Backed out 2 changesets (bug 1709383) for failures on test_TelemetryEnvironment.js. CLOSED TREE
Backed out changeset 64774be5aaff (bug 1709383)
Backed out changeset 17a95b19bb75 (bug 1709383)
2021-05-20 20:33:51 +03:00
Chris Martin b2a51853d0 Bug 1709383 - Add Win32k Lockdown status to about:support and Crash Reporter r=gsvelto,flod,bobowen,mossop,fluent-reviewers,chutten
- Move the decision logic for Win32k Lockdown to a common area where it can
  be re-used
- Cache the Win32k Lockdown state, since the result will never change
- Add IDL to allow JavaScript to query it
- Add it to the "about:support" page
- Add an annotation to Crash Reporter after the first time it's read

Differential Revision: https://phabricator.services.mozilla.com/D114850
2021-05-20 14:28:03 +00:00
Chris Martin e92b057a83 Bug 1709383 - Gate Win32k Lockdown on whether WebRender is actually enabled r=bobowen
Win32k Lockdown requires WebRender, but WR is not currently guaranteed
on all computers. It can also fail to initialize and fallback to
non-WR render path.

We don't want a situation where "Win32k Lockdown + No WR" occurs without
the user explicitly requesting unsupported behavior.

Differential Revision: https://phabricator.services.mozilla.com/D114849
2021-05-20 14:28:03 +00:00
Mike Hommey 0ec9b5902e Bug 1711836 - Fix GCC warning about the use of strncpy in SandboxBroker::ThreadMain. r=jld
Differential Revision: https://phabricator.services.mozilla.com/D115449
2021-05-20 08:22:20 +00:00
Paul Adenot 2af226f89d Bug 1686681 - Dedup a copy-pasted block computing a constant about TTY. r=jld
Differential Revision: https://phabricator.services.mozilla.com/D113163
2021-05-18 15:57:15 +00:00
Paul Adenot 481376c0b0 Bug 1686681 - Handle ioctl(TCGETS, ...) by saying this is not a TTY. r=jld
When doing (e.g.) `MOZ_LOG=PlatformDecoderModule:4`, ffmpeg ends up doing
`ioctl(TCGETS, ...)` via `tcgetattr`, and this crashes the RDD. We don't care
much about the result, so let's just say `ENOTTY`.

Differential Revision: https://phabricator.services.mozilla.com/D113162
2021-05-18 15:57:15 +00:00
Alexandre Lissy 7f76b6c221 Bug 1647957 - Allow RDD and Socket processes to read /proc/self/{statm,smaps} on Linux r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D114853
2021-05-11 16:23:23 +00:00
Alexandre Lissy 2758edd4f2 Bug 1710614 - Limit prctl() in Socket Process r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D114848
2021-05-11 13:36:07 +00:00
Alexandre Lissy 904d40e6b7 Bug 1710603 - Allow stat on / from socket process for glibc 2.33 getaddrinfo() r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D114841
2021-05-11 13:06:30 +00:00
Alexandre Lissy 7ace129b41 Bug 1706008 - Block PR_CAPBSET_READ with EINVAL r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D114253
2021-05-05 16:13:51 +00:00
Jed Davis 6f45e8a477 Bug 1705045 - Quietly deny `MADV_MERGEABLE` in Linux sandbox policies that filter `madvise`. r=gcp
This `madvise` type is used by one Linux distro's libc, and in
principle could be used by other userspace libraries trying to optimize
performance, and I'd rather not allow it (see bug for more details).

Therefore, this patch returns an error instead of treating it as an
unknown syscall (which crashes on Nightly).

However, the content policy doesn't yet filter `madvise` (bug 1510861);
this patch doesn't change that.

Differential Revision: https://phabricator.services.mozilla.com/D112884
2021-04-30 00:24:15 +00:00
Bob Owen c0ca93fed8 Bug 1701791 p1: Don't enable win32k lockdown for the file content process. r=handyman
Win32k is required for moz-icon in the file content process and we don't want to
block enabling for web content processes on this and other uses that may only be
in the file content process.

Differential Revision: https://phabricator.services.mozilla.com/D112960
2021-04-27 07:41:15 +00:00
Joel Maher 8a9f37b534 Bug 1706716 green up mda, xpcshell, browser-chrome, reftest for apple silicon. r=necko-reviewers,extension-reviewers,preferences-reviewers,application-update-reviewers,zombie,ahal,bytesized
Differential Revision: https://phabricator.services.mozilla.com/D113001
2021-04-22 18:39:40 +00:00
Mike Hommey 6a41d8d7ad Bug 1515229 - Make MozStackWalk/MozWalkTheStack frame skipping more reliable. r=gerald,nika,bobowen,jld
Differential Revision: https://phabricator.services.mozilla.com/D110899
2021-04-16 04:06:02 +00:00
Butkovits Atila 8255e3083f Backed out changeset 5c6b15fcea71 (bug 1515229) for causing GTest failures. CLOSED TREE 2021-04-15 13:37:29 +03:00
Mike Hommey 2eacd46d46 Bug 1515229 - Make MozStackWalk/MozWalkTheStack frame skipping more reliable. r=gerald,nika,bobowen,jld
Differential Revision: https://phabricator.services.mozilla.com/D110899
2021-04-14 22:31:36 +00:00
smolnar 22c6eb14ba Backed out changeset f7b0cdc3aeb0 (bug 1515229) for causing xpc failures in test_feature_stackwalking. CLOSED TREE 2021-04-14 12:25:37 +03:00
Mike Hommey 133396cb94 Bug 1515229 - Make MozStackWalk/MozWalkTheStack frame skipping more reliable. r=gerald,nika,bobowen,jld
Differential Revision: https://phabricator.services.mozilla.com/D110899
2021-04-14 04:47:09 +00:00
David Parks 6b176f5987 Bug 1682030 - Remove NPAPI plugin process from GeckoChildProcess r=jld,gsvelto
Eliminates the NPAPI plugin process type from the GeckoChildProcess enum as part of NPAPI removal.  In order to avoid altering enum values when updating the process list, the GECKO_PROCESS_TYPE macro has been updated to include the desired enum value.  We want to resist altering the values as they need to be consistent e.g. in telemetry reports.

We also remove plugins from adjacent spots that need to maintain consistency with GeckoChildProcess -- most notably the nsICrashService.

Differential Revision: https://phabricator.services.mozilla.com/D108689
2021-04-06 19:28:20 +00:00
David Parks d06598d3f3 Bug 1682030 - Remove Windows NPAPI plugin proccess sandbox r=bobowen
Removes Windows NPAPI process sandboxing code, including the code to establish a viable temp directory that was accessible by the sandboxed process.

Differential Revision: https://phabricator.services.mozilla.com/D108688
2021-04-06 19:28:19 +00:00
Csoregi Natalia d68661e2cc Backed out 24 changesets (bug 1682030) for bustage on ProcessHangMonitor.cpp and nsCOMPtr.h. CLOSED TREE
Backed out changeset 5b1644096477 (bug 1682030)
Backed out changeset 35ae60eea3c7 (bug 1682030)
Backed out changeset 3eca76a6d639 (bug 1682030)
Backed out changeset 259c45447ad9 (bug 1682030)
Backed out changeset de9222dc8c31 (bug 1682030)
Backed out changeset 2986c7e14349 (bug 1682030)
Backed out changeset 6af3410bdb93 (bug 1682030)
Backed out changeset 42b0621c2927 (bug 1682030)
Backed out changeset 366e3e371858 (bug 1682030)
Backed out changeset 9adb2865adea (bug 1682030)
Backed out changeset 6af6af3bc03a (bug 1682030)
Backed out changeset da94a91b35ae (bug 1682030)
Backed out changeset 9143da258d0e (bug 1682030)
Backed out changeset 5e20d06952ba (bug 1682030)
Backed out changeset 6253d7e1ce7d (bug 1682030)
Backed out changeset 0e06ddeea3e2 (bug 1682030)
Backed out changeset 9c58d57c9e44 (bug 1682030)
Backed out changeset e90edd89430e (bug 1682030)
Backed out changeset 5861b8166b10 (bug 1682030)
Backed out changeset b4b88cdc7993 (bug 1682030)
Backed out changeset b80054e9805c (bug 1682030)
Backed out changeset 580d857674c0 (bug 1682030)
Backed out changeset a9cdf93c2662 (bug 1682030)
Backed out changeset 9c9c8b4998e2 (bug 1682030)
2021-04-06 03:54:12 +03:00
David Parks 3f9c44a9ed Bug 1682030 - Remove NPAPI plugin process from GeckoChildProcess r=jld,gsvelto
Eliminates the NPAPI plugin process type from the GeckoChildProcess enum as part of NPAPI removal.  In order to avoid altering enum values when updating the process list, the GECKO_PROCESS_TYPE macro has been updated to include the desired enum value.  We want to resist altering the values as they need to be consistent e.g. in telemetry reports.

We also remove plugins from adjacent spots that need to maintain consistency with GeckoChildProcess -- most notably the nsICrashService.

Differential Revision: https://phabricator.services.mozilla.com/D108689
2021-04-05 23:48:43 +00:00
David Parks 4e9ed60079 Bug 1682030 - Remove Windows NPAPI plugin proccess sandbox r=bobowen
Removes Windows NPAPI process sandboxing code, including the code to establish a viable temp directory that was accessible by the sandboxed process.

Differential Revision: https://phabricator.services.mozilla.com/D108688
2021-04-05 23:48:43 +00:00
Simon Giesecke 6ae9169f08 Bug 1698098 - Make use of nsBaseHashtable::Clone. r=xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D107617
2021-03-19 09:01:46 +00:00
Simon Giesecke b9621d6376 Bug 1695162 - Use range-based for instead of custom hashtable iterators. r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D108585
2021-03-17 15:49:46 +00:00
Jed Davis 8262eb0e29 Bug 1690921 - Detect socket syscalls only once per process when building Linux sandbox policies. r=gcp
The function to detect whether the kernel has separate syscalls for
socket operations (rather than only `socketcall`) had a comment that
it's called only once, which is no longer true.  So, this seems like a
good time to add a cache (but not on newer archs like `x86_64` where the
answer is constant).

This patch also removes the ifdefs on `__NR_socket`, because all archs
have it now, and our local headers will define it even if the build
host's headers don't.

Differential Revision: https://phabricator.services.mozilla.com/D105853
2021-03-12 21:12:11 +00:00
Jed Davis 2d6db34852 Bug 1690921 - Limit IPC `sendmsg` gather list sizes based on socket buffer capacity. r=mccr8,gcp
When setting up calls to `sendmsg` for IPC on Unix systems, we generate
`iovec`s for the entire message or until the `IOV_MAX` limit is reached,
whichever comes first.  However, messages can be very large (up to 256
MiB currently), while the OS socket buffer is relatively small (8KiB on
macOS and FreeBSD, ~200KiB on Linux).

This patch detects the socket buffer size with the `SO_SNDBUF` socket
option and cuts off the `iovec` array after it's reached; it also adjusts
the Linux sandbox policy to allow reading that value in all processes.

On my test machines this increases throughput on large messages by about
2.5x on macOS (from ~0.3 to ~0.7 GB/s), but on Linux the improvement is
only about 5% (most of the running time is spent elsewhere).

Differential Revision: https://phabricator.services.mozilla.com/D105852
2021-03-12 21:12:10 +00:00
Jan Alexander Steffens (heftig) 4920407bb3 Bug 1696845 - Use dlsym for gdk_*_display_get_type. r=stransky
Using `dlsym` for `gdk_wayland_display_get_type` is a cleaner solution
to bug 1696319, allowing running with a GTK that lacks the Wayland
backend.

Also adds a symmetric implementation for `gdk_x11_display_get_type`,
which should help running without X11.

Differential Revision: https://phabricator.services.mozilla.com/D107406
2021-03-11 14:32:53 +00:00
Bryce Seager van Dyk c7fc3894ed Bug 1694450 - Return Error(ENOSYS) for unsupported madvise args in the GMP process. r=jld
Because Widevine may probe madvise using advice arguments we do not currently
support, including invalid arguments, this patch changes the handling of these
args so we will not crash in nightly.

Differential Revision: https://phabricator.services.mozilla.com/D106537
2021-03-10 20:58:44 +00:00
Simon Giesecke ad01a10a3b Bug 1634281 - Use nsTHashMap instead of nsDataHashtable. r=xpcom-reviewers,necko-reviewers,jgilbert,nika,valentin
Note that this patch only transforms the use of the nsDataHashtable type alias
to a directly equivalent use of nsTHashMap. It does not change the specification
of the hash key type to make use of the key class deduction that nsTHashMap
allows for in some cases. That can be done in a separate step, but requires more
attention.

Differential Revision: https://phabricator.services.mozilla.com/D106008
2021-03-10 10:47:47 +00:00
Simon Giesecke eefee48405 Bug 1693541 - Improve uses of nsBaseHashtable and descendants and avoid multiple subsequent lookups in security/sandbox/linux/broker. r=jld
Differential Revision: https://phabricator.services.mozilla.com/D106116
2021-03-10 10:37:05 +00:00
Narcis Beleuzu 198358fc15 Backed out changeset a4f4f640eaa7 (bug 1696845) for bustages on pangofc-fontmap.h 2021-03-10 04:49:51 +02:00
Jan Alexander Steffens (heftig) 1261a74d17 Bug 1696845 - Use dlsym for gdk_*_display_get_type. r=stransky
Using `dlsym` for `gdk_wayland_display_get_type` is a cleaner solution
to bug 1696319, allowing running with a GTK that lacks the Wayland
backend.

Also adds a symmetric implementation for `gdk_x11_display_get_type`,
which should help running without X11.

Differential Revision: https://phabricator.services.mozilla.com/D107406
2021-03-09 22:55:47 +00:00
Bob Owen 0066fab260 Bug 1570460: Add fonts path and named pipe creation to windows content process sandbox policy. r=handyman
These are needed for USER_LOCKDOWN access token level and untrusted integrity.

Differential Revision: https://phabricator.services.mozilla.com/D107464
2021-03-09 08:34:07 +00:00
Simon Giesecke 9af107a839 Bug 1691913 - Rename nsBaseHashtable::Put to InsertOrUpdate. r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
This makes the naming more consistent with other functions called
Insert and/or Update. Also, it removes the ambiguity whether
Put expects that an entry already exists or not, in particular because
it differed from nsTHashtable::PutEntry in that regard.

Differential Revision: https://phabricator.services.mozilla.com/D105473
2021-02-26 09:11:46 +00:00
Haik Aftandilian 8a14bd779c Bug 1692220 - Add a test to ensure the com.apple.FontRegistry dir is readable from content processes r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D105822
2021-02-19 21:57:00 +00:00
Jonathan Kew 6a82712eab Bug 1692220 - Allow content-process read access to libFontRegistry caches. r=haik
Differential Revision: https://phabricator.services.mozilla.com/D105801
2021-02-19 21:56:59 +00:00
Alexis Beingessner ade0725530 Bug 1686616 - make GfxInfo use Components instead of Services. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D105522
2021-02-18 13:26:29 +00:00
Michael Goossens 0747b8564f Bug 1649590 - Convert XPIProvider.jsm to use IOUtils r=emalysz,mixedpuppy,barret,gcp
Differential Revision: https://phabricator.services.mozilla.com/D97354
2021-02-10 02:46:04 +00:00
Csoregi Natalia cc417af149 Backed out changeset ee49da8ea890 (bug 1649590) for failures on browser_content_sandbox_fs.js. CLOSED TREE 2021-02-05 04:21:45 +02:00
Michael Goossens 1fa798a7eb Bug 1649590 - Convert XPIProvider.jsm to use IOUtils r=emalysz,mixedpuppy,barret,gcp
Differential Revision: https://phabricator.services.mozilla.com/D97354
2021-02-04 23:08:01 +00:00
Bob Owen 4967e1cddf Bug 1689398 p2: Add prefs to allow CET Strict Mode to be turned on for each sandboxed child process. r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D103474
2021-01-31 16:47:11 +00:00
Bob Owen cc73dd0338 Bug 1689398 p1: Add MITIGATION_CET_STRICT_MODE to chromium sandbox code. r=handyman
The patch for the chromium changes doesn't include the updates to
windows_version, because these are already in the release version of chromium
and so will be picked up when we next update.

Differential Revision: https://phabricator.services.mozilla.com/D103473
2021-01-31 16:46:48 +00:00
Geoff Lankow 610cbaea58 Bug 1667294 - Skip parts of SandboxBroker::LaunchApp when launching a Thunderbird process. r=tkikuchi
Thunderbird does not yet have the same blocklist initialization as Firefox, so we skip calling InitDllBlocklistOOP to avoid a MOZ_RELEASE_ASSERT.

Differential Revision: https://phabricator.services.mozilla.com/D99173
2021-01-19 22:33:02 +00:00
Toshihito Kikuchi 7545ed9378 Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell
This patch is to improve the way to detect an injected dependent module for
automatic DLL blocking (bug 1659438).

In the previous version, we created a list of dependent modules in the launcher
process and shared it with other processes via the shared section.  However, it
was not compatible with third-party applications who tamper the Import Table and
revert it in the injected module's DllMain (bug 1682834) because we parsed the
Import Table in the launcher process after it was reverted.

With this patch, we check the Import Table in `patched_NtMapViewOfSection`,
so we can see tampering before it's reverted.  More specifically, we create
a list of dependent modules in the browser process as below.

1. The launcher process creates a section object and initializes
   the kernel32.dll's functions in it.

2. The launcher process transfers a writable handle of the shared
   section to the browser process.

3. In the browser process, if an injected dependent module is being
   mapped by `NtMapViewOfSection`, we add its NT path to the shared
   section and block it with `REDIRECT_TO_NOOP_ENTRYPOINT`.

4. The `main` function of the browser process converts the writable
   handle of the shared section into a readonly handle.

5. The browser process transfers a readonly handle of the shared
   section to a sandbox process.

Since automatic DLL blocking may still cause a compat issue like bug 1682304,
we activate it only in Nightly for now.

Differential Revision: https://phabricator.services.mozilla.com/D101460
2021-01-13 15:13:18 +00:00
smolnar 0b57365558 Backed out changeset 48a0fcaf46b8 (bug 1684532) for causing gtest perma failure. CLOSED TREE 2021-01-13 11:49:37 +02:00
Toshihito Kikuchi b27dd298e9 Bug 1684532 - Detect injected dependent modules in NtMapViewOfSection. r=mhowell
This patch is to improve the way to detect an injected dependent module for
automatic DLL blocking (bug 1659438).

In the previous version, we created a list of dependent modules in the launcher
process and shared it with other processes via the shared section.  However, it
was not compatible with third-party applications who tamper the Import Table and
revert it in the injected module's DllMain (bug 1682834) because we parsed the
Import Table in the launcher process after it was reverted.

With this patch, we check the Import Table in `patched_NtMapViewOfSection`,
so we can see tampering before it's reverted.  More specifically, we create
a list of dependent modules in the browser process as below.

1. The launcher process creates a section object and initializes
   the kernel32.dll's functions in it.

2. The launcher process transfers a writable handle of the shared
   section to the browser process.

3. In the browser process, if an injected dependent module is being
   mapped by `NtMapViewOfSection`, we add its NT path to the shared
   section and block it with `REDIRECT_TO_NOOP_ENTRYPOINT`.

4. The `main` function of the browser process converts the writable
   handle of the shared section into a readonly handle.

5. The browser process transfers a readonly handle of the shared
   section to a sandbox process.

Since automatic DLL blocking may still cause a compat issue like bug 1682304,
we activate it only in Nightly for now.

Differential Revision: https://phabricator.services.mozilla.com/D101460
2021-01-13 08:38:16 +00:00
Paul Adenot b8fa268285 Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld
Differential Revision: https://phabricator.services.mozilla.com/D99138
2021-01-12 12:34:59 +00:00
Mihai Alexandru Michis f12a97c159 Backed out 3 changesets (bug 1205985) for causing xpcshell failures in test_TelemetrySession.js
CLOSED TREE

Backed out changeset f82f5070bee5 (bug 1205985)
Backed out changeset 89b03879ce7d (bug 1205985)
Backed out changeset 9ba60febbcf8 (bug 1205985)
2021-01-11 13:44:23 +02:00
Paul Adenot 57e6014622 Bug 1205985 - Implement something to get the process uptime with and without the time the device was suspended. r=haik,dmajor,jld
Differential Revision: https://phabricator.services.mozilla.com/D99138
2021-01-11 10:05:29 +00:00
Gerald Squelart a82ad0bb16 Bug 1329600 - Capture CPU usage on Linux - r=canaltinova,gcp
Differential Revision: https://phabricator.services.mozilla.com/D99416
2021-01-04 11:37:46 +00:00
Jed Davis 145e038874 Bug 1678174 - Add remaining time64 syscalls to the Linux sandboxes. r=gcp
32-bit Linux architectures have gained new versions of every system
call handling time values, to allow a transition to 64-bit time_t that
will continue to work after the year 2038; newer versions of glibc will
attempt them and fall back to the 32-bit path (without caching the
failure, so at best we take the overhead of handling SIGSYS).

This patch allows time64 syscalls in the same cases where we allow their
time32 versions, including the restrictions on clockid_t to prevent
interacting with other processes or threads of other processes.  (I've
confirmed that the argument types match otherwise, so it's safe to reuse
the same policies.)

Differential Revision: https://phabricator.services.mozilla.com/D98693
2020-12-08 01:02:18 +00:00
Emilio Cobos Álvarez 8fa401f652 Bug 1680166 - GCC is smarter than clang, so ignore the warning properly.
CLOSED TREE

MANUAL PUSH: Base toolchain build bustage.
2020-12-02 14:31:39 +01:00
Emilio Cobos Álvarez d97661003b Bug 1680166 - Return EFAULT when given a null path to stat* calls in the sandbox filter. r=gcp
It's a common way to check the existence of system calls. Glibc may fall
back to fstatat when statx is called, passing down the null path.

Since we handle fstatat, let's return -EFAULT the same way the real
fstatat syscall would do.

This is needed for the sandbox not to constantly crash due to this statx
call in rustc:

09c9c9f7da/library/std/src/sys/unix/fs.rs (L119-L123)

Differential Revision: https://phabricator.services.mozilla.com/D98414
2020-12-02 11:05:16 +00:00
Jean-Yves Avenard 53f8a78ca2 Bug 1679356 - P1. Make the VP9 HW decoder work on Apple Silicon. r=haik
We relax the sandbox to allow querying the IOAVDHEVCDecodeCapabilities property

Differential Revision: https://phabricator.services.mozilla.com/D97983
2020-11-27 21:26:11 +00:00
Sylvestre Ledru 5079cc5b3f Bug 1588710 - Do not fail on stack protector on some asm chromium & breakpad sandboxing code r=mhentges
caused:
[task 2020-11-05T10:14:26.012Z] 10:14:26     INFO -  In file included from Unified_cpp_sandbox_linux2.cpp:137:
[task 2020-11-05T10:14:26.012Z] 10:14:26    ERROR -  /builds/worker/checkouts/gecko/security/sandbox/chromium/sandbox/linux/seccomp-bpf/syscall.cc:369:3: error: Unable to protect inline asm that clobbers stack pointer against stack clash [-Werror,-Wstack-protector]
[task 2020-11-05T10:14:26.012Z] 10:14:26     INFO -    asm volatile(
[task 2020-11-05T10:14:26.013Z] 10:14:26     INFO -    ^
[task 2020-11-05T10:14:26.013Z] 10:14:26     INFO -  1 error generated.

Differential Revision: https://phabricator.services.mozilla.com/D97567
2020-11-27 10:14:01 +00:00
Jean-Yves Avenard 1ec040c4a0 Bug 1676999 - P1. Remove preference. r=bobowen
The RDD process can no longer work without having access to win32k ; enabling this pref would lead to a crash on Nightly and failure to work elsewhere.

Differential Revision: https://phabricator.services.mozilla.com/D97753
2020-11-20 17:22:51 +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
Toshihito Kikuchi 056103e63e Bug 1620114 - Enable pre-spawn CIG in RDD. r=bobowen
This patch enables pre-spawn CIG in the RDD process.

If CIG prevents a module in the executable's Import Directory Table, Windows totally
fails to launch a process.  So we add a policy rule of `SUBSYS_SIGNED_BINARY` for
all files under the directory containing the executable such as mozglue.dll, and
modules injected via Import Directory Table.  The latter ones will be blocked by our
blocklist with `REDIRECT_TO_NOOP_ENTRYPOINT` (bug 1659438).

Differential Revision: https://phabricator.services.mozilla.com/D96933
2020-11-19 21:59:47 +00:00
Cosmin Sabou f3018c915c No bug - Fix typo to trigger mochitest jobs.
CLOSED TREE
2020-11-12 21:18:08 +02:00
Philipp Ammann 93c8ef1413 Bug 1661450 - Guard X11-only code behind #ifdef MOZ_X11 r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D88803
2020-08-31 11:41:22 +00:00
Cosmin Sabou 4d167c5d6b Backed out 5 changesets (bug 1661450) for causing build bustages. CLOSED TREE
Backed out changeset b01a3dceb3eb (bug 1661450)
Backed out changeset 4a0b897aa1b2 (bug 1661450)
Backed out changeset 561d7cce5353 (bug 1661450)
Backed out changeset 088f1afeff27 (bug 1661450)
Backed out changeset 04db3acdf84f (bug 1661450)
2020-11-05 12:00:59 +02:00
Philipp Ammann d3b31d1286 Bug 1661450 - Guard X11-only code behind #ifdef MOZ_X11 r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D88803
2020-08-31 11:41:22 +00:00
Aaron Klotz a2f9ffcda8 Bug 1675090: Use rvalue ref in SandboxTarget::RegisterSandboxStartCallback; r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D95776
2020-11-03 19:36:42 +00:00
Jed Davis 4f544dfb07 Bug 1673770 - Extend the handling of fstatat-as-fstat to sandboxes that don't use a file broker. r=gcp
The fix for bug 1660901, to handle the subset of fstatat that is
equivalent to fstat, was incomplete: it was added to the existing
hook for the file broker, so processes that don't use a broker (like
GMP) didn't get the fix.  That wasn't a problem when the only use of
that feature was in content processes via GTK, but now that glibc has
reimplemented fstat that way, it's necessary for all processes.

Differential Revision: https://phabricator.services.mozilla.com/D95108
2020-10-29 17:41:28 +00:00
Bob Owen 400cb18bfe Bug 1673194: Remove dynamic code disable for 64-bit RDD process. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D95050
2020-10-29 08:51:39 +00:00
Jed Davis 28fdbc26d8 Bug 1673202 - Call fstat directly in Linux sandbox fstatat interception. r=gcp
Sandbox policies handle the case of `fstatat(fd, "", AT_EMPTY_PATH|...)`
by invoking the SIGSYS handler (because seccomp-bpf can't tell if the
string will be empty when the syscall would use it), which makes the
equivalent call to `fstat`.

Unfortunately, recent development versions of glibc implement `fstat` by
calling `fstatat`, which causes unbounded recursion and stack overflow.
(This depends on the headers present at build time; see the bug for more
details.)  This patch switches it to use the `fstat` (or `fstat64` on
32-bit) syscall directly.

Differential Revision: https://phabricator.services.mozilla.com/D94798
2020-10-27 21:05:09 +00:00
Toshihito Kikuchi 83d95e2106 Bug 1671316 - Part1. Introduce CrossExecTransferManager. r=mhowell
This patch introduces a class `CrossExecTransferManager` to manage the data
transfer from the current process to a remote process via `WriteProcessMemory`.
The class also encapsulates a logic to bridge the gap between two executable's
imagebase.

Differential Revision: https://phabricator.services.mozilla.com/D94652
2020-10-27 14:09:00 +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
Bob Owen a8453ad25d Bug 1668876: Take chromium commit b8479b16bfe703cb09147f4d5cff0cfa3bd91366. r=tkikuchi
Differential Revision: https://phabricator.services.mozilla.com/D94583
2020-10-23 16:01:59 +00:00
Emilio Cobos Álvarez fb68da6916 Bug 1672482 - Move getdents allowance to SandboxPolicyCommon. r=jld,gcp
I think since it takes an FD this might be ok, but let me know if this
somehow doesn't cut it and a more nuanced fix is needed.

Since stuff like PR_GetNumberOfProcessors() uses it with some glibc
versions, which is pretty basic functionality, we probably need to make
it work in all processes.

Differential Revision: https://phabricator.services.mozilla.com/D94358
2020-10-23 09:05:29 +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
Jean-Yves Avenard c69d4669c4 Bug 1595994 - P13. Enable ffvpx in RDD on linux. r=mattwoodrow,gcp
Depends on D91689

Differential Revision: https://phabricator.services.mozilla.com/D91690
2020-10-20 23:28:00 +00:00
Jean-Yves Avenard a8439d3ed7 Bug 1595994 - P12. Allow ffvpx and the AppleDecoderModule in the RDD. r=haik,jolin
Ultimately, we should be able to remove everything that got added to the RDD sandbox from the content's one.

Fly-by fix; allow checking if AVX512 is supported in content sandbox.

Splitting sandbox setting from Utility to a new RDD one as per review comment in P12 considering it's no longer an IPC only sandbox.

Depends on D91688

Differential Revision: https://phabricator.services.mozilla.com/D91689
2020-10-20 23:27:52 +00:00
Jean-Yves Avenard b47c6221dd Bug 1595994 - PE: Loosen RDD sandbox. r=bobowen
For performant video decoding we need access to DXGI/D3D11 similarly to GPU
process.

Depends on D54883

Differential Revision: https://phabricator.services.mozilla.com/D56856
2020-10-20 23:27:00 +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 567fc3fb12 Bug 1664922 - Allow CPU information in the "utility" sandbox policy, for nsSystemInfo. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D90603
2020-10-07 17:31:37 +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 5d2c793134 Bug 1664922 - Allow CPU information in the "utility" sandbox policy, for nsSystemInfo. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D90603
2020-10-06 20:21:32 +00:00
Bert Peers 5444eeeaf6 Bug 1668145 - Detect all Mac GPUs. r=jrmuizel,haik
This also adds a diagonstic assert to make sure the code works in all process types.
And it adds another item to the sandbox IOKit property name allowlist, so that
the detection works in content processes.

This landed before, in bug 1649490, but without the sandbox adjustment (so it
didn't work in content processes).

Differential Revision: https://phabricator.services.mozilla.com/D91950
2020-10-02 01:10:20 +00:00
Jed Davis cd985e90bd Bug 1663550 - Fix the alignment of the stack for the sandbox's clone() trampoline. r=gcp
The ABI on ARM64 requires 16-byte stack alignment, and that includes the
small temporary stack that exists only so that we can `longjmp` off of
it in the child process after calling `clone`.

Differential Revision: https://phabricator.services.mozilla.com/D90001
2020-09-16 20:48:02 +00:00
Jed Davis e997e40530 Bug 1663550 - Update sandbox policy for various syscalls obsoleted on Linux/arm64. r=gcp
In addition to e.g. lacking `open` in favor of `openat`, Linux/arm64
also removes a number of older syscalls along similar lines, like `dup2`
in favor of `dup3`, and all variants of `select` other than `pselect6`.

Differential Revision: https://phabricator.services.mozilla.com/D90000
2020-09-16 20:23:22 +00:00
Jed Davis e149e83eea Bug 1663550 - Implement brokering for the remaining `at` syscalls in the Linux sandbox. r=gcp
Linux/arm64 omits syscalls that can be implemented in terms of newer
syscalls by inserting constant arguments; this means that all of the
basic filesystem operations use the `at` versions, like `unlinkat`
replacing both `unlink` and `rmdir`.  We've supported some of them when
x86 libcs started using them, but there are several others we were
missing; this patch adds them.

Differential Revision: https://phabricator.services.mozilla.com/D89999
2020-09-16 20:12:20 +00:00
Jed Davis 54eee381cc Bug 1663550 - Rearrange the broker glue to handle none of the non-`at` syscalls existing. r=gcp
Linux/arm64 seems to exclude any syscalls that were redundant when it was
created (specifically, that can be implemented in terms of another by
inserting constant arguments), which includes all the of the non-`at`
filesystem syscalls --- for example, `open` vs. `openat`.

This patch rearranges ifdefs to handle that case; later patches will
fill in the currently unhandled syscalls in the `at`-only side.

Differential Revision: https://phabricator.services.mozilla.com/D89998
2020-09-16 19:45:52 +00:00
Jed Davis 1cabbae048 Bug 1663550 - Minor cleanups for Linux sandbox policy. r=gcp
Not strictly part of ARM support, but worth committing, and in
particular printing the `AT_*` flags in hex is helpful for matching them
against headers when `*at` syscalls fail.

Differential Revision: https://phabricator.services.mozilla.com/D89997
2020-09-16 19:01:32 +00:00
Jed Davis 9afac8dfc8 Bug 1663550 - Remove obsolete sandbox rule allowing utime(). r=gcp
We no longer use GConf (bug 1433685), so we can remove the sandbox rule
allowing it to call utime().  That syscall doesn't exist on ARM or ARM64,
so this rule would have to be ifdef'ed if it were re-added.

Differential Revision: https://phabricator.services.mozilla.com/D89996
2020-09-16 18:53:23 +00:00
Jed Davis 4ec3f298b0 Bug 1663550 - Add "arm" and "arm64" architecture names to Linux sandbox telemetry. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D89995
2020-09-16 18:52:52 +00:00
Jed Davis 8ea790a391 Bug 1663550 - Add security/sandbox/chromium files needed for ARM/ARM64. r=bobowen
Chromium's Linux sandboxing code needs some architecture-specific files
for ARM and ARM64 that we don't currently include in our partial import.
These are copied from Chromium tag 81.0.4044.138 (matching the latest
import of the rest of security/sandbox/chromium) without changes.

Differential Revision: https://phabricator.services.mozilla.com/D89994
2020-09-15 14:46:35 +00:00
Toshihito Kikuchi d77b5bdf35 Bug 1662560 - Always retrieve the imagebase of the child process's executable from a process handle. r=mhowell
The earlier fix ea452bb92e6a proved the executable's imagebase in a child
process is not always the same as the local imagebase.  This patch applies
the new approach to retieve the imagebase from a handle to all channels.

Interestingly, we observed the launcher failures at `VirtualProtectEx` only
when launching a sandboxed process, not when launching the browser process.
In the long term, we may need to take care of all `WriteProcessMemory` calls
for a child process for greater safety, but given that observation, this
patch only updates `RestoreImportDirectory` and `InitializeDllBlocklistOOP`.

Differential Revision: https://phabricator.services.mozilla.com/D90316
2020-09-15 21:10:06 +00:00
Chris Peterson 55b64360f6 Bug 1662961 - Replace MOZ_MUST_USE with [[nodiscard]] in security/sandbox/linux. r=jld
The MOZ_MUST_USE macro is defined as clang's and gcc's nonstandard __attribute__((warn_unused_result)). Now that we compile as C++17 by default (bug 1560664), we can replace MOZ_MUST_USE with C++17's standard [[nodiscard]] attribute.

The [[nodiscard]] attribute must precede a function declaration's declaration specifiers (like static, extern, inline, or virtual). The __attribute__((warn_unused_result)) attribute does not have this order restriction.

Differential Revision: https://phabricator.services.mozilla.com/D89235
2020-09-09 17:02:45 +00:00
Julien Cristau ae8cb5feaf Bug 1660901 - ignore AT_NO_AUTOMOUNT in fstatat system call. r=jld
Per the manpage "Both stat() and lstat() act as though AT_NO_AUTOMOUNT
was set.", so don't bail if it's set in a call to fstatat.

Differential Revision: https://phabricator.services.mozilla.com/D89121
2020-09-06 20:20:39 +00:00
Jed Davis 7bf48bbf12 Bug 1660901 - Add some test cases for fstatat inside the content sandbox. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D88500
2020-08-28 09:33:53 +00:00
Jed Davis 08c45b9f68 Bug 1660901 - Support the fstat-like subset of fstatat in the Linux sandbox policies. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D88499
2020-08-28 09:23:58 +00:00
Haik Aftandilian 6e9c6f97f9 Bug 1660045 - Patch 2 - Allow mappings from translated binary directories r=spohl
Differential Revision: https://phabricator.services.mozilla.com/D87014
2020-08-27 07:04:35 +00:00
Toshihito Kikuchi eaaa31291a Bug 1630444: Part3 - Send the launcher process failure ping from the browser process. r=aklotz
This patch adds a new property `process_type` to the launcher process failure
ping, indicating which process type the browser process failed to initialize
as a sandboxed process.

Depends on D83639

Differential Revision: https://phabricator.services.mozilla.com/D83640
2020-08-26 19:01:27 +00:00
Mike Hommey 4ec1f6d39f Bug 1659057 - Allow hw.memsize system call. r=spohl
This fixes the following error when running on Apple Silicon DTK:

AGX: agxs_util.cpp:355:size_t getSystemMemorySize(): !!! Verification failed: status == 0

Differential Revision: https://phabricator.services.mozilla.com/D87048
2020-08-14 13:40:34 +00:00
Jean-Yves Avenard 35583748a1 Bug 1657521 - P4. Allow VP9 HW decoder in mac sandbox. r=haik
Differential Revision: https://phabricator.services.mozilla.com/D86546
2020-08-13 02:16:19 +00:00
Bogdan Tara 98b30d23bf Backed out 5 changesets (bug 1657521) for assertion failure at Refs.h CLOSED TREE
Backed out changeset a0f450666c5b (bug 1657521)
Backed out changeset e97937bf5e3a (bug 1657521)
Backed out changeset 8d70f3cb5e3b (bug 1657521)
Backed out changeset 5c3c1ec039d2 (bug 1657521)
Backed out changeset 132eb437fdda (bug 1657521)
2020-08-12 11:14:44 +03:00
Jean-Yves Avenard 08ed820595 Bug 1657521 - P5. Allow VP9 HW decoder in mac sandbox. r=haik
Differential Revision: https://phabricator.services.mozilla.com/D86546
2020-08-12 04:08:58 +00:00
Haik Aftandilian d9488224c3 Bug 1655655 - Some MP4 Videos Fail to Play on Big Sur r=spohl
Allow access to the "com.apple.trustd.agent" service in the content process sandbox. VTDecompressionSessionCreate() fails without it, causing playback failure for some MP4 videos.

Translate deprecated OS version numbers so that sandbox version checks don't need to check for 10.16.

Differential Revision: https://phabricator.services.mozilla.com/D85213
2020-07-29 21:59:32 +00:00
Mihai Alexandru Michis c92d36d257 Backed out changeset afc05ca167e7 (bug 1652463) for causing mochitest media spi failures. 2020-07-22 18:37:47 +03:00
Bob Owen 6094408d95 Bug 1652463: Add rule to allow socket process to create server side of our IPC pipes. r=handyman
Differential Revision: https://phabricator.services.mozilla.com/D83976
2020-07-20 18:00:42 +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
Simon Giesecke fea9dab7f2 Bug 1651714 - Reduce expensive includes for TabMessageUtils.h. r=smaug
With these changes, on my Linux analysis with ClangBuildAnalyzer, the
top two expensive headers, DOMTypes.h and TabMessageUtils.h are no longer
among the 30 most expensive headers.

Differential Revision: https://phabricator.services.mozilla.com/D82935
2020-07-15 13:24:20 +00:00
Jed Davis 08546b4b69 Bug 1650751 - Add FMODE_NONOTIFY to ignored file flags in Linux sandbox. r=gcp
As of kernel 5.8 (commit [e9c15badb][]), Linux will set the internal
`FMODE_NONOTIFY` flag on files that don't exist in the filesystem,
including (unnamed) pipes and sockets.  Although this flag isn't
properly part of the userspace API, it will be returned by F_GETFL, so
userspace code that tries to change file flags will pass it to F_SETFL.

The implementation of `F_SETFL` has an allow list of flags userspace can
change (`SETFL_MASK`) and ignores all others, but our sandbox has a list
of flags *known* to be ignored, because currently unknown flags could
potentially be accepted by the kernel in the future.

This patch adds `FMODE_NONOTIFY` as an ignored flag.

[e9c15badb]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e9c15badbb7b20ccdbadf5da14e0a68fbad51015

Differential Revision: https://phabricator.services.mozilla.com/D83205
2020-07-13 12:18:00 +00:00
Jed Davis 43278156c3 Bug 1651701 - Allow rseq in the Linux sandboxes. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D83142
2020-07-13 12:56:24 +00:00
Kris Maglione 9d78661f88 Bug 1649221: Update ChromeUtils.generateQI callers to pass strings. r=mccr8,remote-protocol-reviewers,marionette-reviewers,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,preferences-reviewers,agi,whimboo,Bebe,twisniewski
Differential Revision: https://phabricator.services.mozilla.com/D81594
2020-07-10 23:58:28 +00:00
Jed Davis 3bfc3ec49f Bug 1640345 - Add a hidden pref to prevent sandboxed content processes from connecting to the X server. r=gcp
This adds the boolean pref security.sandbox.content.headless (on Linux
only) which does two things:

1. Sets the MOZ_HEADLESS env var for content processes, so that they
don't initialize GTK and don't connect to the X server.

2. Disallows brokered access to parts of the filesystem used only for
graphics -- most critically connecting to the X11 socket itself, but
also opening GPU device nodes and the parts of sysfs used by Mesa, for
example.

This is experimental; use at your own risk.

Setting this pref will break native widgets, so it's also necessary to
set widget.disable-native-theme-for-content

Additionally, it breaks Flash and WebGL; see bug 1638466 for the latter.

Differential Revision: https://phabricator.services.mozilla.com/D81425
2020-07-01 21:10:36 +00:00
Jed Davis 30edd06026 Bug 1644917 - Part 2: Cache as much of the content sandbox file policy as possible. r=gcp,Gijs
Now that filesystem broker policy entries that depend on prefs can be
cached in the "common" policy object, let's do this wherever possible.

Partially fixes bug 1600189.

Differential Revision: https://phabricator.services.mozilla.com/D81424
2020-07-02 11:26:11 +00:00
Jed Davis c3572e2dda Bug 1644917 - Part 1: Construct content sandbox "common" policy lazily. r=gcp,Gijs
When the SandboxBrokerPolicyFactory is constructed, prefs aren't
available, which constrains the cached subset of the content process
policy to entries that don't depend on prefs.  Delaying the computation
until a content process is started removes that restriction.

(This also delays the reading of dynamic linker configuration to discover
library directories, so a test needs to be adjusted.)

Differential Revision: https://phabricator.services.mozilla.com/D81423
2020-07-02 11:27:21 +00:00
Jed Davis c9ea5d4842 Bug 1644917 - Part 0: Make AddDynamicPathList a static non-member function. r=gcp
Not strictly necessary, but I noticed this while I was making changes:
AddDynamicPathList can be a simple static function instead of a private
static method, and doesn't need to be in the header.

Differential Revision: https://phabricator.services.mozilla.com/D81422
2020-07-01 20:49:19 +00:00
Nika Layzell 22a65a237e Bug 1650163 - Part 1: Switch native remoteType values to nsCString, r=farre,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D82104
2020-07-08 20:15:59 +00:00
Mihai Alexandru Michis 1ba2a3f6f6 Backed out 3 changesets (bug 1650163) for causing bustages in nsContentSecurityManager.cpp
CLOSED TREE

Backed out changeset 51d7c644a1e6 (bug 1650163)
Backed out changeset 3d2b6908447a (bug 1650163)
Backed out changeset 79141707d47b (bug 1650163)
2020-07-08 21:18:44 +03:00
Nika Layzell c850a94434 Bug 1650163 - Part 1: Switch native remoteType values to nsCString, r=farre,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D82104
2020-07-08 14:54:48 +00:00
Toshihito Kikuchi 2810e91249 Bug 1639030 - Part 3: Roll-up patch to apply remaining mozilla changes to chromium sandbox. r=bobowen
This commit applies patches under security/sandbox/chromium-shim/patches/after_update/.

Differential Revision: https://phabricator.services.mozilla.com/D79561
2020-07-08 12:54:35 +00:00
Toshihito Kikuchi 0e041b91bd Bug 1639030 - Part 2: Roll-up of chromium sandbox update and patches to get a running browser. r=bobowen
This commit does:
- Sync files under security/sandbox/chromium/ with Chromium 81.0.4044.138
- Update files under security/sandbox/chromium-shim/
- Apply patches under security/sandbox/chromium-shim/patches/with_update/
- Add mozilla::AddWin32kLockdownPolicy to apply MITIGATION_WIN32K_DISABLE before SUBSYS_WIN32K_LOCKDOWN

Differential Revision: https://phabricator.services.mozilla.com/D79560
2020-07-08 12:54:33 +00:00
Toshihito Kikuchi b7f3f014fe Bug 1639030 - Part 1: Update with_update and after_update patches. r=bobowen
This commit updates files under security/sandbox/chromium-shim/patches/
to prepare our codebase for Chromium sandbox update.  See patch files for
the details of each patch.

This also removes the following patches from with_update no longer needed.

1) update_chromium_linux_x86_syscalls.patch is included in
   b4f3df4e77
2) ifdef_out_ApplyMitigationsToCurrentThread.patch cannot be used because
   we use ApplyMitigationsToCurrentThread since the following commit.
   4bed2eb502
3) mingw_base_win_get_caller.patch is included in
   d8b73eb8f0
4) fix_incorrect_int_use_in_Kernel32BaseVersion.patch is fixed by
   https://hg.mozilla.org/mozilla-central/rev/dc9d71fb3bac807a37dbfba35d609ac4ffff1980
5) revert_removal_of_AlterEnvironment_on_Windows.patch is altered by adding
   environment_internal.h/cc as a different commit.
6) mingw_undefine_MemoryBarrier.patch is no longer needed as
   base::subtle::MemoryBarrier was removed by
   bdbaaf4e7e
7) public_siginfo_fields.patch is included in
   6bd491daaf

Differential Revision: https://phabricator.services.mozilla.com/D79558
2020-07-08 12:54:18 +00:00
Narcis Beleuzu 8359f16846 Backed out 7 changesets (bug 1650163, bug 1649477) for bustages on JSActor.cpp . CLOSED TREE
Backed out changeset 4a21afb65254 (bug 1650163)
Backed out changeset c41753a56f5a (bug 1650163)
Backed out changeset 5fb444c35764 (bug 1650163)
Backed out changeset 830aa93d2b0c (bug 1649477)
Backed out changeset eca6e9dce450 (bug 1649477)
Backed out changeset 5b217aa88289 (bug 1649477)
Backed out changeset 8959d02b840f (bug 1649477)
2020-07-08 04:09:27 +03:00
Nika Layzell df351180c3 Bug 1650163 - Part 1: Switch native remoteType values to nsCString, r=farre
Differential Revision: https://phabricator.services.mozilla.com/D82104
2020-07-06 20:30:58 +00:00
Dorel Luca feebf13084 Backed out 3 changesets (bug 1639030) for MDA failures in dom/media/test/test_eme_autoplay.html. CLOSED TREE
Backed out changeset e614d160ab92 (bug 1639030)
Backed out changeset e93c2e3b1e62 (bug 1639030)
Backed out changeset c40a82e96834 (bug 1639030)
2020-07-06 16:16:42 +03:00
Toshihito Kikuchi 1f41e7ebe4 Bug 1639030 - Part 3: Roll-up patch to apply remaining mozilla changes to chromium sandbox. r=bobowen
This commit applies patches under security/sandbox/chromium-shim/patches/after_update/.

Differential Revision: https://phabricator.services.mozilla.com/D79561
2020-07-06 04:04:19 +00:00
Toshihito Kikuchi 0cbcab5ebb Bug 1639030 - Part 2: Roll-up of chromium sandbox update and patches to get a running browser. r=bobowen
This commit does:
- Sync files under security/sandbox/chromium/ with Chromium 81.0.4044.138
- Update files under security/sandbox/chromium-shim/
- Apply patches under security/sandbox/chromium-shim/patches/with_update/
- Apply a workaround for Clang's bug to compile *_interception.cc
- Add mozilla::AddWin32kLockdownPolicy to apply MITIGATION_WIN32K_DISABLE before SUBSYS_WIN32K_LOCKDOWN

Differential Revision: https://phabricator.services.mozilla.com/D79560
2020-07-06 04:04:12 +00:00
Toshihito Kikuchi 8e7730db34 Bug 1639030 - Part 1: Update with_update and after_update patches. r=bobowen
This commit updates files under security/sandbox/chromium-shim/patches/
to prepare our codebase for Chromium sandbox update.  See patch files for
the details of each patch.

This also removes the following patches from with_update no longer needed.

1) update_chromium_linux_x86_syscalls.patch is included in
   b4f3df4e77
2) ifdef_out_ApplyMitigationsToCurrentThread.patch cannot be used because
   we use ApplyMitigationsToCurrentThread since the following commit.
   4bed2eb502
3) mingw_base_win_get_caller.patch is included in
   d8b73eb8f0
4) fix_incorrect_int_use_in_Kernel32BaseVersion.patch is fixed by
   https://hg.mozilla.org/mozilla-central/rev/dc9d71fb3bac807a37dbfba35d609ac4ffff1980
5) revert_removal_of_AlterEnvironment_on_Windows.patch is altered by adding
   environment_internal.h/cc as a different commit.
6) mingw_undefine_MemoryBarrier.patch is no longer needed as
   base::subtle::MemoryBarrier was removed by
   bdbaaf4e7e
7) public_siginfo_fields.patch is included in
   6bd491daaf

Differential Revision: https://phabricator.services.mozilla.com/D79558
2020-07-06 04:03:59 +00:00
Sylvestre Ledru caf785c695 Bug 1519636 - Reformat recent changes to the Google coding style r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D82178
2020-07-04 09:38:43 +00:00
Dorel Luca 751ff32a41 Backed out 3 changesets (bug 1639030) for build bustage. CLOSED TREE
Backed out changeset d7bd92ae8de6 (bug 1639030)
Backed out changeset dc961d2004fd (bug 1639030)
Backed out changeset 2c6cfddbc1af (bug 1639030)
2020-07-03 23:26:12 +03:00
Toshihito Kikuchi e77485c628 Bug 1639030 - Part 3: Roll-up patch to apply remaining mozilla changes to chromium sandbox. r=bobowen
This commit applies patches under security/sandbox/chromium-shim/patches/after_update/.

Differential Revision: https://phabricator.services.mozilla.com/D79561
2020-07-03 19:15:53 +00:00
Toshihito Kikuchi 617828f9d5 Bug 1639030 - Part 2: Roll-up of chromium sandbox update and patches to get a running browser. r=bobowen
This commit does:
- Sync files under security/sandbox/chromium/ with Chromium 81.0.4044.138
- Update files under security/sandbox/chromium-shim/
- Apply patches under security/sandbox/chromium-shim/patches/with_update/
- Apply a workaround for Clang's bug to compile *_interception.cc
- Add mozilla::AddWin32kLockdownPolicy to apply MITIGATION_WIN32K_DISABLE before SUBSYS_WIN32K_LOCKDOWN

Differential Revision: https://phabricator.services.mozilla.com/D79560
2020-07-03 19:15:30 +00:00
Toshihito Kikuchi 197278374e Bug 1639030 - Part 1: Update with_update and after_update patches. r=bobowen
This commit updates files under security/sandbox/chromium-shim/patches/
to prepare our codebase for Chromium sandbox update.  See patch files for
the details of each patch.

This also removes the following patches from with_update no longer needed.

1) update_chromium_linux_x86_syscalls.patch is included in
   b4f3df4e77
2) ifdef_out_ApplyMitigationsToCurrentThread.patch cannot be used because
   we use ApplyMitigationsToCurrentThread since the following commit.
   4bed2eb502
3) mingw_base_win_get_caller.patch is included in
   d8b73eb8f0
4) fix_incorrect_int_use_in_Kernel32BaseVersion.patch is fixed by
   https://hg.mozilla.org/mozilla-central/rev/dc9d71fb3bac807a37dbfba35d609ac4ffff1980
5) revert_removal_of_AlterEnvironment_on_Windows.patch is altered by adding
   environment_internal.h/cc as a different commit.
6) mingw_undefine_MemoryBarrier.patch is no longer needed as
   base::subtle::MemoryBarrier was removed by
   bdbaaf4e7e
7) public_siginfo_fields.patch is included in
   6bd491daaf

Differential Revision: https://phabricator.services.mozilla.com/D79558
2020-07-03 19:15:17 +00:00
Kershaw Chang b615d8681a Bug 1640612 - Allow socket process to read /etc, r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D80718
2020-06-26 08:32:46 +00:00
Kershaw Chang af6512b101 Bug 1640612 - Allow FIONREAD ioctl for socket process, r=jld
Differential Revision: https://phabricator.services.mozilla.com/D79071
2020-06-26 08:32:48 +00:00
Kershaw Chang f700a7ee35 Bug 1640612 - Deal with uname() for socket process, r=jld
Differential Revision: https://phabricator.services.mozilla.com/D78148
2020-06-26 08:32:50 +00:00
Haik Aftandilian 3547934f67 Bug 1648838 - Remove OS-specific sandboxing code for unsupported macOS versions (up to 10.11 inclusive) r=spohl
Remove macOS 10.11 (and earlier) specific rules from the content and Flash sandbox profiles.

Differential Revision: https://phabricator.services.mozilla.com/D81813
2020-07-01 14:27:13 +00:00
Simon Giesecke cd8b8939b9 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Jean-Yves Avenard 488ccd8244 Bug 1648326 - Don't dispatch runnable on the running taskqueue. r=bobowen,jld
The current taskqueue is blocked until the current function has finished; Running the event loop would only process events on the running thread.

Additionally, we make mIPCLaunchThread an nsISerialEventTarget to guarantee that at shutdown the tasks are run in order regardless of the IPC Launch Thread type.

Differential Revision: https://phabricator.services.mozilla.com/D81511
2020-07-01 06:46:59 +00:00
Noemi Erli 9c9875dead Backed out 4 changesets (bug 1644917, bug 1640345) for causing failures in browser_preferences_usage.js CLOSED TREE
Backed out changeset 0f8b6494d3eb (bug 1640345)
Backed out changeset 4da77f0a0687 (bug 1644917)
Backed out changeset 54904fe41df8 (bug 1644917)
Backed out changeset ef0321787c8f (bug 1644917)
2020-06-30 05:27:44 +03:00
Jed Davis 0940e5ba82 Bug 1640345 - Add a hidden pref to prevent sandboxed content processes from connecting to the X server. r=gcp
This adds the boolean pref security.sandbox.content.headless (on Linux
only) which does two things:

1. Sets the MOZ_HEADLESS env var for content processes, so that they
don't initialize GTK and don't connect to the X server.

2. Disallows brokered access to parts of the filesystem used only for
graphics -- most critically connecting to the X11 socket itself, but
also opening GPU device nodes and the parts of sysfs used by Mesa, for
example.

This is experimental; use at your own risk.

Setting this pref will break native widgets, so it's also necessary to
set widget.disable-native-theme-for-content

Additionally, it breaks Flash and WebGL; see bug 1638466 for the latter.

Differential Revision: https://phabricator.services.mozilla.com/D81425
2020-06-29 22:32:10 +00:00
Jed Davis 172a1b1ced Bug 1644917 - Part 2: Cache as much of the content sandbox file policy as possible. r=gcp
Now that filesystem broker policy entries that depend on prefs can be
cached in the "common" policy object, let's do this wherever possible.
Should also fix bug 1621231.

Differential Revision: https://phabricator.services.mozilla.com/D81424
2020-06-29 22:32:07 +00:00
Jed Davis 771b8498b1 Bug 1644917 - Part 1: Construct content sandbox "common" policy lazily. r=gcp
When the SandboxBrokerPolicyFactory is constructed, prefs aren't
available, which constrains the cached subset of the content process
policy to entries that don't depend on prefs.  Delaying the computation
until a content process is started removes that restriction.

Differential Revision: https://phabricator.services.mozilla.com/D81423
2020-06-29 22:32:05 +00:00
Jed Davis 0808445a13 Bug 1644917 - Part 0: Make AddDynamicPathList a static non-member function. r=gcp
Not strictly necessary, but I noticed this while I was making changes:
AddDynamicPathList can be a simple static function instead of a private
static method, and doesn't need to be in the header.

Differential Revision: https://phabricator.services.mozilla.com/D81422
2020-06-29 22:32:03 +00:00
Haik Aftandilian 6a9d502918 Bug 1647816 - Make sandboxing OS version checks aware of major version r=spohl
Fix the content and Flash sandbox policies to use the major and minor number for OS version checks allowing video playback to work properly on macOS 11 Big Sur.

Pass the macOS major and minor version to sandbox policies as a combined string.

Remove unused OSXVersion methods and members and more minor cleanup in Sandbox.mm.

Leave in the checks for unsupported versions (macOS 10.9 - 10.11) for now in case this fix needs to be uplifted.

Differential Revision: https://phabricator.services.mozilla.com/D81385
2020-06-26 19:12:39 +00:00
Dorel Luca 03ea5569f1 Backed out 3 changesets (bug 1640612) on dev's request for regressing Bug 1648624
Backed out changeset c2d1a0de6874 (bug 1640612)
Backed out changeset 188dc24e864a (bug 1640612)
Backed out changeset 2fe263339790 (bug 1640612)
2020-06-26 11:28:14 +03:00
Kershaw Chang a674c80bfb Bug 1640612 - Allow socket process to read /etc, r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D80718
2020-06-24 20:43:30 +00:00
Kershaw Chang aba86f73b8 Bug 1640612 - Allow FIONREAD ioctl for socket process, r=jld
Differential Revision: https://phabricator.services.mozilla.com/D79071
2020-06-24 20:43:01 +00:00
Kershaw Chang c49db2fc38 Bug 1640612 - Deal with uname() for socket process, r=jld
Differential Revision: https://phabricator.services.mozilla.com/D78148
2020-06-24 20:42:47 +00:00
Jean-Yves Avenard 87438519f0 Bug 1637500 - P2. Rename methods as they are not always dealing with "threads". r=froydnj
Before P1, GetCurrentThreadSerialEventTarget would have always returned the same data as NS_GetCurrentThread, making the comment incorrect Now it will properly return the running TaskQueue if any.

This change of name more clearly exposes what they are doing, as we aren't always dealing with threads directly; but a nsISerialEventTarget

Differential Revision: https://phabricator.services.mozilla.com/D80354
2020-06-23 05:05:36 +00:00
Bogdan Tara 55458f847e Backed out 3 changesets (bug 1639030) for sandbox related bustages CLOSED TREE
Backed out changeset 55b963f34eb0 (bug 1639030)
Backed out changeset 0c2d7e8a4131 (bug 1639030)
Backed out changeset 9d82c8fa3d3b (bug 1639030)
2020-06-15 20:36:02 +03:00
Toshihito Kikuchi fb0684d83f Bug 1639030 - Part 3: Roll-up patch to apply remaining mozilla changes to chromium sandbox. r=bobowen
This commit applies patches under security/sandbox/chromium-shim/patches/after_update/.

Depends on D79560

Differential Revision: https://phabricator.services.mozilla.com/D79561
2020-06-15 15:57:13 +00:00
Toshihito Kikuchi 8a6f673311 Bug 1639030 - Part 2: Roll-up of chromium sandbox update and patches to get a running browser. r=bobowen
This commit does:
- Sync files under security/sandbox/chromium/ with Chromium 81.0.4044.138
- Update files under security/sandbox/chromium-shim/
- Apply patches under security/sandbox/chromium-shim/patches/with_update/
- Apply a workaround for Clang's bug to compile filesystem_interception.cc
- Add mozilla::AddWin32kLockdownPolicy to apply MITIGATION_WIN32K_DISABLE before SUBSYS_WIN32K_LOCKDOWN

Depends on D79558

Differential Revision: https://phabricator.services.mozilla.com/D79560
2020-06-15 15:57:03 +00:00
Toshihito Kikuchi be67c3dc79 Bug 1639030 - Part 1: Update with_update and after_update patches. r=bobowen
This commit updates files under security/sandbox/chromium-shim/patches/
to prepare our codebase for Chromium sandbox update.  See patch files for
the details of each patch.

This also removes the following patches from with_update no longer needed.

1) update_chromium_linux_x86_syscalls.patch is included in
   b4f3df4e77
2) ifdef_out_ApplyMitigationsToCurrentThread.patch cannot be used because
   we use ApplyMitigationsToCurrentThread since the following commit.
   4bed2eb502
3) mingw_base_win_get_caller.patch is included in
   d8b73eb8f0
4) fix_incorrect_int_use_in_Kernel32BaseVersion.patch is fixed by
   https://hg.mozilla.org/mozilla-central/rev/dc9d71fb3bac807a37dbfba35d609ac4ffff1980
5) revert_removal_of_AlterEnvironment_on_Windows.patch is altered by adding
   environment_internal.h/cc as a different commit.
6) mingw_undefine_MemoryBarrier.patch is no longer needed as
   base::subtle::MemoryBarrier was removed by
   bdbaaf4e7e
7) public_siginfo_fields.patch is included in
   6bd491daaf

Differential Revision: https://phabricator.services.mozilla.com/D79558
2020-06-15 15:56:51 +00:00
Alexis Beingessner 0d843d258d Bug 1642721 - convert security.sandbox.logging.enabled to a StaticPref. r=bobowen
Depends on D78933

Differential Revision: https://phabricator.services.mozilla.com/D78934
2020-06-11 12:35:45 +00:00
Alexis Beingessner 83994a45b8 Bug 1642721 - convert the last two securit.sandbox.*.win32k VarCache prefs. r=bobowen
converts:
  * security.sandbox.rdd.win32k-disable
  * security.sandbox.gmp.win32k-disable

I'm assuming the pattern established by the other, newer, win32k StaticPrefs can
be followed here, and the xpcom checks aren't needed.

Differential Revision: https://phabricator.services.mozilla.com/D78933
2020-06-11 12:34:10 +00:00
Jed Davis 9c23d852e1 Bug 1639181 - Allow a safe subset of fd flag fcntls in the common sandbox policy. r=gcp
Content processes allow a restricted subset of F_{GET,SET}{FD,FL} that
prevents setting unknown or known-unsafe flags, which was copied to the
socket process policy; this patch moves it to the common policy and
removes RDD's copy of GMP's override.

The immediate reason for this is DMD using F_GETFL via fdopen to use a
file descriptor passed over IPC, but in general this should be safe and
it's a reasonable thing to expect to be able to use.

Differential Revision: https://phabricator.services.mozilla.com/D77379
2020-05-29 18:18:43 +00:00
Gian-Carlo Pascutto 31a659bfbe Bug 1571290 - Allow clock_gettime64 in the 32-bit linux seccomp-bpf profile. r=jld
Differential Revision: https://phabricator.services.mozilla.com/D76351
2020-05-22 23:11:59 +00:00
Gian-Carlo Pascutto b37cb7e592 Bug 1455498 - Whitelist directories passed in LD_LIBRARY_PATH. r=jld
Differential Revision: https://phabricator.services.mozilla.com/D70554
2020-05-07 15:40:42 +00:00
Toshihito Kikuchi e83bcb5130 Bug 1630281 - Cache the executable's IAT for ntdll.dll before COM initialization. r=mhowell
When the browser process starts a sandbox process, we copy the executable's IAT
for ntdll.dll into the new process to prevent DLL injection via IAT tampering as
the launcher process does.  However, if IAT has been modified by a module injected
via `SetWindowHookEx`, the browser process cannot copy IAT because a modified IAT
is invalid in a different process, failing to start any sandbox processes.

The proposed fix is to cache IAT before COM initialization which may load
modules via `SetWindowHookEx` for the first time in the process.

Differential Revision: https://phabricator.services.mozilla.com/D73303
2020-04-30 18:26:18 +00:00
Toshihito Kikuchi 80dfd02627 Bug 1629361 - Disable the launcher process when a content process fails to start. r=mhowell
If a third-party application modifies IAT of ntdll.dll in the browser process
after process launch, the browser process fails to launch a sandbox process,
resulting in a situation where a window is opened without any functionality.

This patch is to mitigate that situation by disabling the launcher process
when the browser process fails to launch a sandbox process.

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

--HG--
extra : moz-landing-system : lando
2020-04-14 16:14:22 +00:00
Jeff Gilbert cb26f272b1 Bug 1623885 - Add "subsystem" to Mesa sandbox policy to fix libdrm-2.4.101+. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D70579

--HG--
extra : moz-landing-system : lando
2020-04-12 21:21:32 +00:00
Jonathan Kew 3ec88e7ea4 Bug 1495900 - Add fontconfig cache directories to content-process sandbox read paths. r=jld
Differential Revision: https://phabricator.services.mozilla.com/D70170

--HG--
extra : moz-landing-system : lando
2020-04-11 02:28:35 +00:00
Gabriele Svelto 2bc88d71e0 Bug 1614933 - Gather content processes' crash annotations at exception time instead of using IPC; r=froydnj
Crash annotations in content processes are currently sent over IPC via
shared memory buffers. To pave the way for the Rust rewrite of the exception
handler we are removing this code and gathering all the crash annotations
within the content processes themselves. This patch causes annotations to be
stored in the global table of each content process. They are then streamed
out to the parent process by the exception handler together with the
exception-time annotations.

This has a number of benefits:

* we have one less channel to exchange data between content processes and
  the parent process
* we save memory because we don't need to allocate the shared memory buffers
* annotations are faster because we don't stream them all out every time one
  changes
* we won't truncate annotations anymore if we run out of space in the shared
  segment.
* we don't need delayed annotations anymore, so we can get rid of the
  associated machinery

As I refactored the code I tried to adjust all the obsolete comments,
consolidate shared code and remove the redundant steps that were sometimes
present. In many places we had two entire crash annotation tables we merged to
change just a couple; that comes from the fact that historically we loaded
them from disk. Now it doesn't matter anymore and we can just go ahead and
change the ones we care about.

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

--HG--
extra : moz-landing-system : lando
2020-04-08 06:55:40 +00:00
Gabriele Svelto ab22b90deb Bug 1614933 - Ensure that glibc's lazy initializers run before we enable the content process sandbox on Linux; r=jld
Differential Revision: https://phabricator.services.mozilla.com/D63471

--HG--
extra : moz-landing-system : lando
2020-04-08 06:55:40 +00:00
Chris Martin 777045b2f1 Bug 1347710 - Make GPU sandbox allow access to shader cache r=bobowen
When the GPU sandbox is enabled, access to most of the filesystem is blocked.

The GPU process uses a directory, "%profiledir%/shader-cache", to cache
compiled shared for performance reasons. Not allowing access to that directory
results in a HUGE performance backslide when the sandbox is turned on.

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

--HG--
extra : moz-landing-system : lando
2020-04-06 20:45:06 +00:00
Michael Froman fce38bc562 Bug 1626385 - allow shmem in linux sandbox for socket process to support profiler. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D69582

--HG--
extra : moz-landing-system : lando
2020-04-03 15:28:55 +00:00
Bob Owen f5aab0f5cb Bug 1625508: Use SetLockdownDefaultDacl for the socket process. r=handyman
Add rule to allow content processes to duplicate named pipes to other child
processes. This is why SetLockdownDefaultDacl wasn't working before because it
broke the local handle duplication.
This also reverts the change that was using USER_LIMITED from the start of the
process because that breaks DLL loading when installed somewhere that relies on
the user's own SID for access.

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

--HG--
extra : moz-landing-system : lando
2020-03-30 18:05:08 +00:00
Jed Davis bfc8e3cd04 Bug 1624743 -- Allow intra-process kcmp with KCMP_FILE in Linux content sandbox for amdgpu. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D68669

--HG--
extra : moz-landing-system : lando
2020-03-30 16:13:59 +00:00
Jed Davis c5f7ab0639 Bug 1622728 - Allow file seals in content process sandbox policy, for Wayland. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D68664

--HG--
extra : moz-landing-system : lando
2020-03-30 16:14:17 +00:00
Jed Davis aecdf7eb30 Bug 1604834 - Assign thread names during the sandbox launch process. r=gcp
We've had some bugs where the sandboxed child process and/or the chroot
helper process deadlocks during launch, often reported by end users,
and it's confusing to have the mysterious hanging task inherit the name
of the launching thread; this patch fixes that by giving them more
informative names.

`prctl(PR_SET_NAME, ...)` is used directly, instead of via one of our
wrappers for it, to avoid the possibility of async signal unsafe
operations.

This doesn't name the pre-exec child process in the cases where regular
`fork()` is used, but as far as I know we haven't had any bugs (yet?)
where that would matter.

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

--HG--
extra : moz-landing-system : lando
2020-03-25 14:13:18 +00:00
Brindusan Cristian 4646c1f41f Backed out 2 changesets (bug 1614933) for bc failures at browser_tabicon_after_bg_tab_crash.js.
Backed out changeset 59503d3a702f (bug 1614933)
Backed out changeset 578c8ba9598f (bug 1614933)
2020-03-22 17:30:07 +02:00
Gabriele Svelto 322404bebb Bug 1614933 - Gather content processes' crash annotations at exception time instead of using IPC; r=froydnj
Crash annotations in content processes are currently sent over IPC via
shared memory buffers. To pave the way for the Rust rewrite of the exception
handler we are removing this code and gathering all the crash annotations
within the content processes themselves. This patch causes annotations to be
stored in the global table of each content process. They are then streamed
out to the parent process by the exception handler together with the
exception-time annotations.

This has a number of benefits:

* we have one less channel to exchange data between content processes and
  the parent process
* we save memory because we don't need to allocate the shared memory buffers
* annotations are faster because we don't stream them all out every time one
  changes
* we won't truncate annotations anymore if we run out of space in the shared
  segment.
* we don't need delayed annotations anymore, so we can get rid of the
  associated machinery

As I refactored the code I tried to adjust all the obsolete comments,
consolidate shared code and remove the redundant steps that were sometimes
present. In many places we had two entire crash annotation tables we merged to
change just a couple; that comes from the fact that historically we loaded
them from disk. Now it doesn't matter anymore and we can just go ahead and
change the ones we care about.

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

--HG--
extra : moz-landing-system : lando
2020-03-21 17:13:08 +00:00
Gabriele Svelto 9186cc2ed8 Bug 1614933 - Ensure that glibc's lazy initializers run before we enable the content process sandbox on Linux; r=jld
Differential Revision: https://phabricator.services.mozilla.com/D63471

--HG--
extra : moz-landing-system : lando
2020-03-22 13:03:36 +00:00
Toshihito Kikuchi 09e98f7a10 Bug 1615139 - Remove RestoreImportDirectory from SandboxBroker::LaunchApp. r=aklotz
When the launcher process is enabled, we run `RestoreImportDirectory` twice as
below.  This patch removes the 1st one.

1st call:
xul!mozilla::SandboxBroker::LaunchApp
--> xul!mozilla::RestoreImportDirectory

2nd call:
xul!mozilla::SandboxBroker::LaunchApp
--> firefox!mozilla::InitializeDllBlocklistOOP
--> firefox!mozilla::InitializeDllBlocklistOOPInternal
--> firefox!mozilla::RestoreImportDirectory

To handle the case where the launcher process is disabled, we need to call
`RestoreImportDirectory` from `InitializeDllBlocklistOOP` if the browser
process is not bootstrapped.

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

--HG--
extra : moz-landing-system : lando
2020-03-19 23:15:27 +00:00
Simon Giesecke 92497d5662 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in security. r=rrelyea
Differential Revision: https://phabricator.services.mozilla.com/D65499

--HG--
extra : moz-landing-system : lando
2020-03-16 10:56:56 +00:00
Bogdan Tara c60fd3fdd2 Backed out 4 changesets (bug 1613985) for causing build bustages CLOSED TREE
Backed out changeset fba0caac746c (bug 1613985)
Backed out changeset 8605d7a19107 (bug 1613985)
Backed out changeset 41e858fbf235 (bug 1613985)
Backed out changeset 847433cf1e0a (bug 1613985)
2020-03-16 12:41:41 +02:00
Simon Giesecke 554d54a0be Bug 1613985 - Use default for equivalent-to-default constructors/destructors in security. r=rrelyea
Differential Revision: https://phabricator.services.mozilla.com/D65499

--HG--
extra : moz-landing-system : lando
2020-03-16 09:57:45 +00:00
Jed Davis 14f4c37266 Bug 1621808 - Fix crash messages for seccomp-bpf failures. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D66524

--HG--
extra : moz-landing-system : lando
2020-03-12 08:28:39 +00:00
Jed Davis 07db95a267 Bug 1621686 - Fix socket process sandbox's handling of prctl to prevent crash on kernels before 3.17. r=gcp,mjf
The special handling of PR_SET_NO_NEW_PRIVS can't be overridden with
Allow(); otherwise every thread in the process will repeatedly apply
copies of the policy to itself until it reaches whatever limits the
kernel imposes, and then we crash so we don't continue execution
seemingly unsandboxed.  (See also bug 1257361.)

The prctl policy for the socket process is still allow-all after this
patch; it just prevents crashing the socket process on startup on
kernels before 3.17 (which don't support applying the policy atomically
to all threads).

This patch also adds a comment to try to document this failure mode.

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

--HG--
extra : moz-landing-system : lando
2020-03-12 13:46:46 +00:00
Bob Owen 8dd34fb2d8 Bug 1557282 Part 4: Use USER_LIMITED from the start of the socket process sandbox. r=handyman,gcp
Differential Revision: https://phabricator.services.mozilla.com/D66613

--HG--
extra : moz-landing-system : lando
2020-03-12 20:41:09 +00:00
Bob Owen 7446217e9b Bug 1557282 Part 3: Use SetLockdownDefaultDacl and AddRestrictingRandomSid in sandbox policies. r=handyman,gcp
Differential Revision: https://phabricator.services.mozilla.com/D66612

--HG--
extra : moz-landing-system : lando
2020-03-12 20:40:25 +00:00
Bob Owen 739da258cc Bug 1557282 Part 1: Take chromium commit c1ce57ea5d31208af589b4839390a44ab20b0c8f. r=handyman,gcp
This adds AddRestrictingRandomSid feature, which fixes our issues with
SetLockdownDefaultDacl, apart from when we are running from a network drive.

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

--HG--
extra : moz-landing-system : lando
2020-03-12 20:39:40 +00:00