Commit Graph

984 Commits

Author SHA1 Message Date
Bob Owen
cf86e40aa1 Bug 1445167 Part 2: Make LOG_FATAL messages in chromium sandbox code crash. r=jld 2018-03-20 10:45:31 +00:00
Bob Owen
af1e9f58c5 Bug 1445167 Part 1: Revert change to make USER_NON_ADMIN a blacklist. r=handyman
This is only used by default in the file content process now and we also have a
FILES_ALLOW_READONLY rule for all paths anyway.
2018-03-20 10:42:05 +00:00
Haik Aftandilian
331dda9367 Bug 1444291 - Part 3 - Add read access to the Mac Flash sandbox, support sandbox levels r=Alex_Gaynor
Replace the boolean pref "security.sandbox.mac.flash.enabled"
with "dom.ipc.plugins.sandbox-level.flash" to support sandbox
levels and be consistent with the Windows pref name.

Adds filesystem read access to the sandbox using sandbox extensions
granted by the file dialog machinery (level 1).

Add support for level 2 which blocks read access.

Allow the sandbox to be disabled with MOZ_DISABLE_NPAPI_SANDBOX.


MozReview-Commit-ID: 4rfobEoxQpF

--HG--
extra : rebase_source : 05dc54b46063967e959bc3fced21c61e5463de48
2018-03-15 20:23:19 -07:00
Haik Aftandilian
b8c5b2eae6 Bug 1444291 - Part 2 - Add additional sysctl access to the Mac Flash sandbox r=Alex_Gaynor
Adds additional sysctls that are used by the Flash plugin process and alphabetize the list.

MozReview-Commit-ID: 7CaPtaKe874

--HG--
extra : rebase_source : 909228ef9617029eaf7cb16565751150cd1c7404
2018-03-07 22:07:27 -08:00
Haik Aftandilian
09693ee75d Bug 1444291 - Part 1 - Reduce Mac Flash sandbox cache and temp dir permissions r=Alex_Gaynor
Remove access to DARWIN_USER_CACHE_DIR. Limit DARWIN_USER_TEMP_DIR
access to the FlashTmp subdirectory. Remove xattr read access to
~/Library/Caches/ and ~/Library/Preferences.

MozReview-Commit-ID: 9svk0BoxVXs

--HG--
extra : rebase_source : 5ea9c7ecc0189455eceb190fb300170d42d0b890
2018-03-15 17:33:12 -07:00
Coroiu Cristina
62bb56ad86 Backed out 3 changesets (bug 1444291) for bustage at build/src/dom/plugins/ipc/PluginProcessChild.cpp
Backed out changeset 48a9c2131347 (bug 1444291)
Backed out changeset dfc31b6c9f53 (bug 1444291)
Backed out changeset 8ee3e65465ed (bug 1444291)
2018-03-16 03:07:35 +02:00
Haik Aftandilian
3aaa8d9f78 Bug 1444291 - Part 3 - Add read access to the Mac Flash sandbox, support sandbox levels r=Alex_Gaynor
Replace the boolean pref "security.sandbox.mac.flash.enabled"
with "dom.ipc.plugins.sandbox-level.flash" to support sandbox
levels and be consistent with the Windows pref name.

Adds filesystem read access to the sandbox using sandbox extensions
granted by the file dialog machinery (level 1).

Add support for level 2 which blocks read access.

Allow the sandbox to be disabled with MOZ_DISABLE_NPAPI_SANDBOX.


MozReview-Commit-ID: 4rfobEoxQpF

--HG--
extra : rebase_source : 87f2f00867c4522ae3102abbc44fd05db63c7ec7
2018-03-13 15:38:11 -07:00
Haik Aftandilian
d1fbc6bb50 Bug 1444291 - Part 2 - Add additional sysctl access to the Mac Flash sandbox r=Alex_Gaynor
Adds additional sysctls that are used by the Flash plugin process and alphabetize the list.

MozReview-Commit-ID: 7CaPtaKe874

--HG--
extra : rebase_source : 078697987ac7fec77c75953035b924422fc93066
2018-03-07 22:07:27 -08:00
Haik Aftandilian
018807a65d Bug 1444291 - Part 1 - Reduce Mac Flash sandbox cache and temp dir permissions r=Alex_Gaynor
Remove access to DARWIN_USER_CACHE_DIR. Limit DARWIN_USER_TEMP_DIR
access to the FlashTmp subdirectory. Remove xattr read access to
~/Library/Caches/ and ~/Library/Preferences.

MozReview-Commit-ID: 9svk0BoxVXs

--HG--
extra : rebase_source : 669c4fa446c9cab6b32cf60091e91eae2d08625f
2018-03-15 17:33:12 -07:00
Andreea Pavel
46575fad3b Merge mozilla-central to autoland. a=merge on a CLOSED TREE 2018-03-15 00:10:23 +02:00
Bob Owen
f2f76a9b94 Bug 1445614: Only warn when SetAlternateDesktop fails. r=jimm 2018-03-14 18:39:36 +00:00
Jed Davis
0b5eeab7a5 Bug 1445003 - Detect RenderDoc and adjust the sandbox policy so it can work. r=gcp
RenderDoc, a graphics debugging tool, uses a preload library that
creates a listening socket (Internet-domain) early in startup and
accepts connections from the frontend.  If it's detected (via env vars),
we allow accept/accept4 (but not socket/bind/listen), and remain in
the parent process's network namespace so that other processes can
connect to the socket.

This doesn't change the sandbox policy if not running under RenderDoc.

MozReview-Commit-ID: 964RW4BFh4u

--HG--
extra : rebase_source : d4a954e68431d84fa2e0edea4171421a948794af
2018-03-12 20:21:08 -06:00
Gian-Carlo Pascutto
4fb9bf8576 Bug 1416016 - Resolve symlinks in the file broker as a last resort. r=jld
MozReview-Commit-ID: B7OMyARk9u8

--HG--
extra : rebase_source : 1106c8f877f748a2ef7e6af3b8e6965a3cf67e33
2018-03-09 21:14:39 +01:00
Jed Davis
6c8bcd4625 Bug 1440206 - Allow brokered access to a subset of connect() in the Linux content sandbox. r=gcp
This is to support WebGL with hybrid graphics drivers that connect to
a secondary X server for GL (Primus and VirtualGL), without allowing
access to arbitrary sockets.  In addition to local X11 connections,
Primus needs to connect to the Bumblebee daemon (otherwise it will exit
the calling process).

The broker support is limited to AF_UNIX, to non-datagram sockets (see
bug 1066750), and to pathname addresses.  Abstract addresses could
theoretically be handled but there isn't currently a compelling reason
to, and the broker very much assumes it's dealing with a C-style string
referring to a filesystem path and not an arbitrary byte sequence
(including NULs).

At a higher level: If the GPU X server is remote then it won't work,
but it won't work anyway because WebGL requires features that aren't
supported by indirect GLX.  If the GPU X server is local but the browser
is inside a chroot, it will fail to connect unless /tmp/.X11-unix is
bind-mounted into the chroot; hopefully this use case is not common.

MozReview-Commit-ID: IvI2jYDRZZ2
2018-03-09 19:31:23 -07:00
Jed Davis
60310ac5ad Bug 1434392 - Don't preload libmozsandbox in grandchild processes, only the sandboxed children themselves. r=gcp
--HG--
extra : rebase_source : a2c784640c65e0e476fc6ccf8639581462902c86
2018-03-07 18:55:20 -07:00
Gian-Carlo Pascutto
dadfe06714 Bug 1438394 - Do SysV IPC check before bailing out early. r=jld
The SandboxLaunchPrepare currently bails out early if it detects a
lack of user namespaces. Hoist the check for drivers needing SysV
IPC up so it's done before that early exit, and the required env
variables get correctly set.

With this we no longer fail with a SIGSYS sandbox error, though
in a debug build we still crash because many assumptions in the
graphics stack get broken when that fails to initialize the driver
for WebGL.

MozReview-Commit-ID: 8n3Hx6VSjTF

--HG--
extra : rebase_source : 99bf2d25a7435b0eb95f186a00cc7723a196be4c
2018-03-07 19:05:00 +01:00
Dorel Luca
3ccafa2b66 Merge mozilla-inbound to mozilla-central. a=merge 2018-03-02 00:09:29 +02:00
Sebastian Hengst
118e03a936 merge mozilla-central to mozilla-inbound 2018-03-01 20:32:20 +02:00
Masatoshi Kimura
b1b043af08 Bug 1442266 - Stop including unnecessary <iostream>. r=froydnj
MozReview-Commit-ID: B0JDqyBanFE

--HG--
extra : rebase_source : dec1e2678083e3fb2b9a6b89322d1fa747ed6d4a
2018-03-01 23:07:56 +09:00
Bob Owen
8efbee5948 Bug 1441801 Part 2: Fix line endings in sandboxBroker.cpp. r=jimm 2018-03-01 14:37:26 +00:00
Bob Owen
be5a4dadac Bug 1441801 Part 1: Stop using the chromium sandbox DLL blocking mechanism on Nightly. r=jimm 2018-03-01 14:37:25 +00:00
Jed Davis
6d88e1e82d Bug 1438391 - Detect VirtualGL and weaken the sandbox enough for it to work. r=gcp
MozReview-Commit-ID: BXmm8JSfkeI

--HG--
extra : rebase_source : 7e56f39df23fa4cc2ad0e38702f8ad6353d74e69
2018-02-22 19:14:41 -07:00
Jed Davis
61d0766fcf Bug 1438401 - Quietly fail shmget() in sandboxed content processes. r=gcp
The X11 symbol interposition isn't enough, possibly because Cairo can
also use XCB.  Interposing XCB is more difficult because the API exposes
more protocol details.  Instead, just allow shmget to be called and
fail; this will tell Cairo that it can't use SysV IPC with the X server,
which is what we want.

MozReview-Commit-ID: 5y9tE7UXMTE

--HG--
extra : rebase_source : bb1e81116742a299bc4e412062327e69032ab3b3
2018-02-27 21:30:08 -07:00
Jed Davis
9bdbd2d99f Bug 1438389 - Quietly disallow chown() in sandboxed content processes. r=gcp
Also covers fchownat() and attempts to be ready for newer archs like ARM64.

Bonus fix: extend bug 1354731 (mknod) fix to cover mknodat so this part
of the policy isn't glaringly inconsistent about "at" syscalls.

Tested locally by attaching gdb and injecting syscalls.

MozReview-Commit-ID: CCOk0jZVoG4

--HG--
extra : rebase_source : 1d0cafd9d91586eaec0233ff15b3bbb1ef7485f0
2018-02-15 16:10:00 -07:00
Narcis Beleuzu
2d9816273c Merge inbound to mozilla-central. a=merge 2018-02-16 11:49:59 +02:00
David Parks
9a797c5ce2 Bug 1415160: Part 2 - Add mitigations to plugin process if not running from network drive r=bobowen
Adds MITIGATION_IMAGE_LOAD_NO_REMOTE and MITIGATION_IMAGE_LOAD_NO_LOW_LABEL to the plugin process if we aren't running from a networked drive.  The same condition applies to these mitigations in the content process.

--HG--
extra : rebase_source : b61f91f3e56f6b4930a03331b7791a9173857518
2017-12-21 12:36:02 -08:00
David Parks
90d62139c0 Bug 1415160: Part 1 - Enable new NPAPI Windows Process Mitigations; r=bobowen
Enables new process mitigations that have been included from Chromium upstream.

--HG--
extra : rebase_source : 8997bef9c6a6c660b39e68ebfabf90f4de162bca
2017-12-20 22:58:26 -08:00
Haik Aftandilian
c90be35636 Bug 1436566 - [Mac] Land disabled-by-default sandboxing for the Flash NPAPI plugin process. r=Alex_Gaynor,jimm
MozReview-Commit-ID: Es0GbMLKvH5

--HG--
extra : rebase_source : 991f20ac25735508d790947991f59214fb06e54f
2018-02-12 15:46:31 -08:00
Alex Gaynor
106fa9d993 Bug 1405088 - Part 1 - remove file-write permissions from macOS content temporary directory; r=haik
With this change, the macOS content sandbox has no ability to create files
anywhere on disk (in release builds). If the content process needs a file to
write to, it needs to obtain a file descriptor from the parent process.

MozReview-Commit-ID: 7LoG1PW0UDR

--HG--
extra : rebase_source : 4ac0a7f187d45c9b6c0f8a658edfdae0509054ac
2017-10-02 10:48:01 -04:00
Alex Gaynor
0d04153faf Bug 1407693 - Part 1 - Expose method for sharing a HANDLE to a child process in the sandboxing API; r=bobowen
MozReview-Commit-ID: 3LBCzPS6Mzg

--HG--
extra : rebase_source : 7e1ea157eeea5810ad21d781e93b7046aebf2bd6
2017-11-27 14:34:48 -06:00
Jed Davis
f57faf8137 Bug 1436882 - Fix termination signal when clone()ing child processes. r=gcp
This fixes a mistake in bug 1401062: the termination signal was omitted,
so it's 0, and if it isn't exactly SIGCHLD, then a tracer/debugger will
receive PTRACE_EVENT_CLONE rather than PTRACE_EVENT_FORK.  This causes
GDB to see the child process as a thread instead of a separate process,
and it becomes very confused after the process calls execve().

MozReview-Commit-ID: Baf2RFHVWRU

--HG--
extra : rebase_source : 50839967fc766bb9db123fe1af99a88495f8421b
2018-02-08 17:30:03 -07:00
Jed Davis
927e70c7a5 Bug 1425274 - Filter socketpair() in content sandbox on 32-bit x86 with new-enough kernels. r=gcp
This replaces the globals for whether socket calls (and ipc(2) calls, but
we never used that) have real arguments with a parameter, which in hindsight
should have been done in bug 1273852, which is when we started handling
both socketcall(2) and separate socket calls in the same policy.  This
allows handling the two cases differently.

MozReview-Commit-ID: 1pfckmCpJlW

--HG--
extra : rebase_source : 4b8459f01e8748fea95cbcb6eeb689f01417ca5b
2018-01-29 17:36:06 -07:00
Jed Davis
4be220d5f3 Bug 1376910 - Remove SysV IPC access from Linux content sandbox when possible. r=gcp
There are a few things that use SysV IPC, which we discovered the last
time we tried to do this, which need to be accomodated:

1. The ALSA dmix plugin; if the build has ALSA support (off by default)
and if audio remoting is disabled, SysV IPC is allowed.

2. ATI/AMD's old proprietary graphics driver (fglrx), which is obsolete
and doesn't support newer hardware, but still has users; if it's
detected, SysV IPC is allowed.

3. Graphics libraries trying to use the MIT-SHM extension; this is
already turned off for other reasons (see bug 1271100), but that shim
seems to not load early enough in some cases, so it's copied into
libmozsandbox, which is preloaded before anything else in LD_PRELOAD.

Also, msgget is now blocked in all cases; the only case it was known
to be used involved ESET antivirus, which is now handled specially
(bug 1362601).  In any case, the seccomp-bpf policy has never allowed
actually *using* message queues, so creating them is not very useful.

MozReview-Commit-ID: 5bOOQcXFd9U

--HG--
extra : rebase_source : ea79c0a7e31f58f056be15b551c57dde974dfae2
2018-01-26 19:43:10 -07:00
Andreea Pavel
93f2f80c9d Backed out 2 changesets (bug 1407693) for windows mingw32 bustages at /builds/worker/workspace/build/src/ipc/glue/GeckoChildProcessHost.cpp:1032 on a CLOSED TREE
Backed out changeset 9c3346021c21 (bug 1407693)
Backed out changeset f18e1e557cf6 (bug 1407693)
2018-02-07 21:42:47 +02:00
Alex Gaynor
fe879d087a Bug 1407693 - Part 1 - Expose method for sharing a HANDLE to a child process in the sandboxing API; r=bobowen
MozReview-Commit-ID: 3LBCzPS6Mzg

--HG--
extra : rebase_source : 70b31bde82bfd3721b75cc9dc7171b2c1efc5f9f
2017-11-27 14:34:48 -06:00
David Parks
312f33b8c5 Bug 1426733: Use restricting SIDs in Windows NPAPI process r=bobowen
Allow NPAPI sandbox to use restricting SIDs.

--HG--
extra : rebase_source : be53cfa3b05bd6d0f5b24b8f4f0b41e623d40e9a
2017-12-20 21:35:26 -08:00
Bob Owen
92db53b861 Bug 1432381: Replace sidestep resolvers with stubs as they are not actually used. r=aklotz
These cause compilation issues for MinGW.
It looks like these are a legacy from the original sandbox code before it was
integrated into chromium.
2018-02-06 08:52:26 +00:00
Boris Zbarsky
12e9f78050 Bug 1435483 part 16. Switch to using dom::Exception, not nsIException, in C++ code. r=qdot
nsIException is builtinclass in idl, so whatever code we had to handle
non-dom::Exception nsIExceptions is dead code.

MozReview-Commit-ID: 6VnqDWt0041
2018-02-05 16:34:05 -05:00
Boris Zbarsky
c8bd8682bf Bug 1435483 part 10. Add infallible "asyncCaller" and "caller" getters on nsIStackFrame. r=qdot
MozReview-Commit-ID: 8pdMDFHWlVt
2018-02-05 16:34:05 -05:00
Boris Zbarsky
b7eaf4b6ae Bug 1435483 part 9. Add an infallible "name" getter on nsIStackFrame. r=qdot
MozReview-Commit-ID: ADxO2A8nkel
2018-02-05 16:34:05 -05:00
Boris Zbarsky
2c00c8c971 Bug 1435483 part 6. Add an infallible "lineNumber" getter on nsIStackFrame. r=qdot
MozReview-Commit-ID: 7aYg9kJhiab
2018-02-05 16:34:04 -05:00
Boris Zbarsky
02f7baafc0 Bug 1435483 part 5. Add an infallible "filename" getter on nsIStackFrame. r=qdot
MozReview-Commit-ID: D3uuehuDqOB
2018-02-05 16:34:04 -05:00
Gian-Carlo Pascutto
ff91a17fb3 Bug 1386404 - Use the full tmpdir finding logic. r=jld
MozReview-Commit-ID: BDBslEZsctJ

--HG--
extra : rebase_source : 6814c3fc5183083b38bfe651f6c7e9d19965f785
extra : histedit_source : fb71245f51fefcc7c221f951316c16583239aefc%2C71d59492798b368e5d09f295f5e74bb32790c75b
2018-01-30 21:31:07 +01:00
Gian-Carlo Pascutto
adc2daa77b Bug 1386404 - Whitelist the prefix used by the XPCOM leak logs. r=haik
MozReview-Commit-ID: HI68lvyJIPQ

--HG--
extra : rebase_source : b68015624aa02c911cd4361b8ea177ae585a5ef5
extra : histedit_source : ca88e3de7f3f7d76e82e259e03145d2f843d0a1b
2017-11-03 13:18:56 +01:00
Gian-Carlo Pascutto
220379341a Bug 1386404 - Only do the tmp remapping if needed. r=jld
This helps with getting the tests that are running out of /tmp
to pass, who get confused if their paths change underneath them.

It's also a bit faster.

MozReview-Commit-ID: CWtngVNhA0t

--HG--
extra : rebase_source : 1be7a99cd3640d15ddecd1c050d19d1b30e5202d
extra : histedit_source : 5787bfe610504356a04819039469083adf2ce77c
2017-10-26 18:02:10 +02:00
Gian-Carlo Pascutto
7fd8a36d1c Bug 1386404 - Intercept access to /tmp and rewrite to content process tempdir. r=jld
MozReview-Commit-ID: 2h9hw6opYof

--HG--
extra : rebase_source : 73c677be84d62ed958d07b0aca0947dd0e9448c7
extra : histedit_source : 499d483f58372b7b06a36da3fdf0ea3afc12feeb
2017-10-26 17:50:49 +02:00
Gian-Carlo Pascutto
5ce7639e7d Bug 1386404 - Enable access to the entire chrome dir from content. r=jld
This may be required if people have @import in their userContent.css, and
in any case our tests check for this.

MozReview-Commit-ID: 8uJcWiC2rli

--HG--
extra : rebase_source : a93dfc2c62d3ac35dece87e4b4596cde761de207
extra : histedit_source : 455e6a79527226f398a861a72c1cfdef2c1761df
2017-10-26 18:57:03 +02:00
Gian-Carlo Pascutto
6520179659 Bug 1386404 - Enable content-process specific tmpdir on Linux. r=jld
MozReview-Commit-ID: 6Hijq0to9MG

--HG--
extra : rebase_source : 8435b8e39d9723c52b0176a7686895185136aa6e
extra : histedit_source : 50c41172788fddead6357f1d566d0e48de8c90d6
2018-01-09 16:29:40 +01:00
Jed Davis
8b8051496a Bug 1213998 - Apply chroot() to sandboxed content processes on Linux. r=gcp
MozReview-Commit-ID: DGepECmw3pq

--HG--
extra : rebase_source : c8fe74c8fa8ea91379499f1cbfd5424dc5e9be2c
2018-01-16 19:10:51 -07:00
Jed Davis
e3c2621d53 Bug 1430949 - Isolate network namespace in Linux content sandbox level 4. r=gcp
This is turned off if the X11 server is remote -- including TCP to
localhost -- because otherwise it would be blocked.  Note that ssh X
forwarding presents a TCP-only server.

The Nightly default for the force-namespace hidden pref is changed to
false, because we will now normally be using namespaces if available.

MozReview-Commit-ID: L9BbLdoLvLg

--HG--
extra : rebase_source : c737b65551deb134de18028714774e0aabb5baf5
2018-01-23 22:31:06 -07:00