Commit Graph

1320 Commits

Author SHA1 Message Date
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
Narcis Beleuzu
feebca4edf Backed out 4 changesets (bug 1557282) as requested by tjr . CLOSED TREE
Backed out changeset deabd1e1018b (bug 1557282)
Backed out changeset 25e5b5ba8ac3 (bug 1557282)
Backed out changeset 30afcaf2782a (bug 1557282)
Backed out changeset f83095f739e0 (bug 1557282)

--HG--
extra : rebase_source : 1730b805fbd8d0b786f7dcec71aa9c02a8f7a93a
2020-03-12 19:39:27 +02:00
Bob Owen
301ca2b09e Bug 1557282 Part 4: Use USER_LIMITED from the start of the socket process sandbox.
Depends on D66612

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

--HG--
extra : moz-landing-system : lando
2020-03-12 16:58:43 +00:00
Bob Owen
29fc28b9f3 Bug 1557282 Part 3: Use SetLockdownDefaultDacl and AddRestrictingRandomSid in sandbox policies.
Depends on D66611

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

--HG--
extra : moz-landing-system : lando
2020-03-12 16:58:36 +00:00
Bob Owen
a48bb12597 Bug 1557282 Part 1: Take chromium commit c1ce57ea5d31208af589b4839390a44ab20b0c8f.
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 16:56:48 +00:00
Haik Aftandilian
10a487cd99 Bug 1614983 - Create a new sandbox profile for the socket process r=spohl
Add, but don't enable, a sandbox policy to be used with the socket process.
A follow-up fix (bug 1611288) will change the socket process code to use the
sandbox. The macOS socket sandbox is similar to the utility sandbox (only
used for the RDD process), with additions to allow networking I/O, access to
files for DNS resolution, access to certificate stores, and notifications about
network configuration changes.

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

--HG--
extra : moz-landing-system : lando
2020-03-11 22:20:13 +00:00
Bogdan Tara
fb2b3d4e41 Backed out 2 changesets (bug 1614933) for busages complaining about IdleSchedulerChild.cpp CLOSED TREE
Backed out changeset ff92f800a74e (bug 1614933)
Backed out changeset 5cee8f603ae4 (bug 1614933)
2020-03-10 17:21:55 +02:00
Gabriele Svelto
9336e8143b 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-10 14:59:22 +00:00
Gabriele Svelto
49040b8671 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-10 14:59:22 +00:00
Michael Froman
98301e7475 Bug 1608558 - pt4 - use security.sandbox.socket.process.level for linux socket process sandbox. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D63716

--HG--
extra : moz-landing-system : lando
2020-03-09 14:57:13 +00:00
Michael Froman
5e124284d9 Bug 1608558 - pt3 - add EvaluateSocketCall and missing cases to EvaluateSyscall for Socket process sandbox. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D62445

--HG--
extra : moz-landing-system : lando
2020-03-09 14:56:43 +00:00
Michael Froman
40fb8ff87d Bug 1608558 - pt2 - add SandboxBrokerPolicyFactory::GetSocketProcessPolicy to allow access to certs. r=jld,gcp
Differential Revision: https://phabricator.services.mozilla.com/D62444

--HG--
extra : moz-landing-system : lando
2020-03-09 14:56:24 +00:00
Michael Froman
140e0771d3 Bug 1608558 - pt1 - add linux sandboxing to socket process. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D60014

--HG--
extra : moz-landing-system : lando
2020-03-09 14:56:03 +00:00
Mark Banner
15cfe23b88 Bug 1620542 - Automatically fix ESLint errors in .eslintrc.js files. r=mossop
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2020-03-07 10:09:44 +00:00
Toshihito Kikuchi
d992a091fa Bug 1615401 - Part 3: Use OSInfo::Kernel32Version() to select a thunk resolver. r=bobowen
Cherry-picking Chromium's commit 01c8afd0dc14a1acef383c5f231258d0cfac95e5
to fix the crash caused by Chromium's sandbox code.

The original bug on Chromium side: https://crbug.com/1053805

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

Depends on D65802
2020-03-06 18:52:25 +02:00
Toshihito Kikuchi
866761cd8a Bug 1615401 - Part 2: Keep Chromium's file_version_info_win.cpp updated r=bobowen
Cherry-picking the following commits from Chromium to keep file_version_info_win.cpp
up-to-date.

1. Use StringPiece rather than std::string for Version parsing.
15a9d1733f

2. [Cleanup] Un-const the result of base::Version::GetString()
fde745d058

3. Export Windows file version as base::Version
e93de3a37d

4. Tidy FileVersionInfoWin.
4bb23ded3a

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

Depends on D65744
2020-03-06 22:24:01 +02:00
Toshihito Kikuchi
0d29a60c01 Bug 1615401 - Part 1: Partially implement FileVersionInfoWin to use from OSInfo::Kernel32BaseVersion(). r=bobowen
This patch partially implements `FileVersionInfoWin` and `base::FilePath` class of
Chromium sandbox so that a coming patch can use `base::win::OSInfo::Kernel32BaseVersion()`.

Differential Revision: https://phabricator.services.mozilla.com/D65744
2020-03-06 18:51:54 +02:00
Sylvestre Ledru
3c97d64247 Bug 1616780 - Also add __NR_sched_setattr to the list of thread function r=jld
Differential Revision: https://phabricator.services.mozilla.com/D64736

--HG--
extra : moz-landing-system : lando
2020-02-29 04:14:52 +00:00
Sylvestre Ledru
a2d5cb90b0 Bug 1616780 - Add __NR_sched_getattr to the list of thread function r=jld
Introduced in:
8aeca4fa64

Shipping in glib 2.63.5 (available in Debian experimental)

Thanks to @padenot for the suggestion!

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

--HG--
extra : moz-landing-system : lando
2020-02-24 22:04:16 +00:00
Eric Rahm
124379887c Bug 1617327 - Part 2: Remove nsAutoPtr usage from ipc, security, IDB. r=mccr8,janv
This removes `nsAutoPtr` usage from ipc/. security/ failed to build due to missing includes so I fixed that as well. IDB was using `ThreadLocal` from ipc which had a member changed to a `UniquePtr` so needed to be updated as well. localstorage was missing some includes.

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

--HG--
extra : moz-landing-system : lando
2020-02-24 19:26:40 +00:00
Michael Froman
e5696f1486 Bug 1611290 - Windows sandbox for socket process. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D62772

--HG--
extra : moz-landing-system : lando
2020-02-21 15:49:54 +00:00
Emilio Cobos Álvarez
8991187005 Bug 1614535 - Whitelist pread64 in the common policy. r=gcp
Differential Revision: https://phabricator.services.mozilla.com/D62468

--HG--
extra : moz-landing-system : lando
2020-02-11 18:20:34 +00:00
Emilio Cobos Álvarez
aa1769613f Bug 1613991 - Register FS brokers with the profiler. r=jld
Differential Revision: https://phabricator.services.mozilla.com/D62073

--HG--
extra : moz-landing-system : lando
2020-02-07 21:43:25 +00:00
David Major
c8447603c3 Bug 1614003 - Remove unused file mfbt/NullPtr.h r=froydnj
C++14 has a replacement anyway.

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

--HG--
extra : moz-landing-system : lando
2020-02-07 19:08:17 +00:00
Gian-Carlo Pascutto
c666ac4425 Bug 1613921 - Add missing patches against Chromium sandboxing code. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D62031

--HG--
extra : moz-landing-system : lando
2020-02-07 14:06:34 +00:00