public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ian Stakenvicius" <axs@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/mozilla:master commit in: www-client/firefox/files/, www-client/firefox/
Date: Fri, 12 May 2017 21:11:16 +0000 (UTC)	[thread overview]
Message-ID: <1494623465.3a64b6cc7293f9e7150d52ad2fef7775167c4524.axs@gentoo> (raw)

commit:     3a64b6cc7293f9e7150d52ad2fef7775167c4524
Author:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
AuthorDate: Fri May 12 21:11:05 2017 +0000
Commit:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
CommitDate: Fri May 12 21:11:05 2017 +0000
URL:        https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=3a64b6cc

firefox-53: make seccomp sandbox violations non-fatal

 .../firefox-53-turn_of_crash_on_seccomp_fail.patch | 100 +++++++++++++++++++++
 www-client/firefox/firefox-53.0.ebuild             |   1 +
 2 files changed, 101 insertions(+)

diff --git a/www-client/firefox/files/firefox-53-turn_of_crash_on_seccomp_fail.patch b/www-client/firefox/files/firefox-53-turn_of_crash_on_seccomp_fail.patch
new file mode 100644
index 0000000..2d0c06b
--- /dev/null
+++ b/www-client/firefox/files/firefox-53-turn_of_crash_on_seccomp_fail.patch
@@ -0,0 +1,100 @@
+
+# HG changeset patch
+# User Jed Davis <jld@mozilla.com>
+# Date 1485552350 25200
+# Node ID 7781de08a1c6d84a92e9d54a78ac9f54f8c4c240
+# Parent  952f0a7824ad897dd0f76318b567341e7d8ad46d
+Bug 1286865 - Step 0: Turn off crash-on-seccomp-fail by default on non-nightly. r=gcp
+
+MozReview-Commit-ID: 1It6HNizbAc
+
+diff --git a/security/sandbox/linux/Sandbox.cpp b/security/sandbox/linux/Sandbox.cpp
+--- a/security/sandbox/linux/Sandbox.cpp
++++ b/security/sandbox/linux/Sandbox.cpp
+@@ -68,16 +68,18 @@ MOZ_IMPORT_API void
+ } // extern "C"
+ #endif // MOZ_ASAN
+ 
+ // Signal number used to enable seccomp on each thread.
+ int gSeccompTsyncBroadcastSignum = 0;
+ 
+ namespace mozilla {
+ 
++static bool gSandboxCrashOnError = false;
++
+ // This is initialized by SandboxSetCrashFunc().
+ SandboxCrashFunc gSandboxCrashFunc;
+ 
+ #ifdef MOZ_GMP_SANDBOX
+ // For media plugins, we can start the sandbox before we dlopen the
+ // module, so we have to pre-open the file and simulate the sandboxed
+ // open().
+ static SandboxOpenedFile gMediaPluginFile;
+@@ -143,25 +145,28 @@ SigSysHandler(int nr, siginfo_t *info, v
+   args[2] = SECCOMP_PARM3(&savedCtx);
+   args[3] = SECCOMP_PARM4(&savedCtx);
+   args[4] = SECCOMP_PARM5(&savedCtx);
+   args[5] = SECCOMP_PARM6(&savedCtx);
+ 
+   // TODO, someday when this is enabled on MIPS: include the two extra
+   // args in the error message.
+   SANDBOX_LOG_ERROR("seccomp sandbox violation: pid %d, syscall %d,"
+-                    " args %d %d %d %d %d %d.  Killing process.",
++                    " args %d %d %d %d %d %d.%s",
+                     pid, syscall_nr,
+-                    args[0], args[1], args[2], args[3], args[4], args[5]);
++                    args[0], args[1], args[2], args[3], args[4], args[5],
++                    gSandboxCrashOnError ? "  Killing process." : "");
+ 
+-  // Bug 1017393: record syscall number somewhere useful.
+-  info->si_addr = reinterpret_cast<void*>(syscall_nr);
++  if (gSandboxCrashOnError) {
++    // Bug 1017393: record syscall number somewhere useful.
++    info->si_addr = reinterpret_cast<void*>(syscall_nr);
+ 
+-  gSandboxCrashFunc(nr, info, &savedCtx);
+-  _exit(127);
++    gSandboxCrashFunc(nr, info, &savedCtx);
++    _exit(127);
++  }
+ }
+ 
+ /**
+  * This function installs the SIGSYS handler.  This is slightly
+  * complicated because we want to use Chromium's handler to dispatch
+  * to specific trap handlers defined in the policy, but we also need
+  * the full original signal context to give to Breakpad for crash
+  * dumps.  So we install Chromium's handler first, then retrieve its
+@@ -510,16 +515,31 @@ void
+ SandboxEarlyInit(GeckoProcessType aType)
+ {
+   const SandboxInfo info = SandboxInfo::Get();
+   if (info.Test(SandboxInfo::kUnexpectedThreads)) {
+     return;
+   }
+   MOZ_RELEASE_ASSERT(IsSingleThreaded());
+ 
++  // Set gSandboxCrashOnError if appropriate.  This doesn't need to
++  // happen this early, but for now it's here so that I don't need to
++  // add NSPR dependencies for PR_GetEnv.
++  //
++  // This also means that users with "unexpected threads" setups won't
++  // crash even on nightly.
++#ifdef NIGHTLY_BUILD
++  gSandboxCrashOnError = true;
++#endif
++  if (const char* envVar = getenv("MOZ_SANDBOX_CRASH_ON_ERROR")) {
++    if (envVar[0]) {
++      gSandboxCrashOnError = envVar[0] != '0';
++    }
++  }
++
+   // Which kinds of resource isolation (of those that need to be set
+   // up at this point) can be used by this process?
+   bool canChroot = false;
+   bool canUnshareNet = false;
+   bool canUnshareIPC = false;
+ 
+   switch (aType) {
+   case GeckoProcessType_Default:
+

diff --git a/www-client/firefox/firefox-53.0.ebuild b/www-client/firefox/firefox-53.0.ebuild
index a911896..e4f93e1 100644
--- a/www-client/firefox/firefox-53.0.ebuild
+++ b/www-client/firefox/firefox-53.0.ebuild
@@ -125,6 +125,7 @@ src_prepare() {
 	# Apply our patches
 	eapply "${WORKDIR}/firefox"
 	eapply "${FILESDIR}"/musl_drop_hunspell_alloc_hooks.patch
+	eapply "${FILESDIR}"/firefox-53-turn_of_crash_on_seccomp_fail.patch
 
 	# Enable gnomebreakpad
 	if use debug ; then


             reply	other threads:[~2017-05-12 21:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12 21:11 Ian Stakenvicius [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-12-17 10:56 [gentoo-commits] proj/mozilla:master commit in: www-client/firefox/files/, www-client/firefox/ Joonas Niilola
2020-04-08  2:01 Jory Pratt
2020-02-14  2:34 Jory Pratt
2019-09-14 20:35 Jory Pratt
2018-11-04 14:59 Thomas Deutschmann
2018-03-31 14:11 Lars Wendler
2017-06-06  4:39 Jory Pratt
2017-01-17 17:30 Jory Pratt
2017-01-13 16:38 Jory Pratt
2016-09-22 14:39 Ian Stakenvicius
2016-09-02 13:55 Ian Stakenvicius
2016-08-03 20:48 Ian Stakenvicius
2016-04-05 20:29 Ian Stakenvicius
2016-03-12 19:30 Ian Stakenvicius
2016-02-04 16:39 Ian Stakenvicius
2016-01-15  2:30 Jory Pratt
2015-12-23 21:30 [gentoo-commits] proj/mozilla:crossdev commit in: www-client/firefox/, www-client/firefox/files/ Ian Stakenvicius
2015-12-23 21:06 ` [gentoo-commits] proj/mozilla:master commit in: www-client/firefox/files/, www-client/firefox/ Ian Stakenvicius
2015-10-21 20:41 Ian Stakenvicius
2015-03-01 18:41 Ian Stakenvicius
2014-12-04 21:15 Ian Stakenvicius
2014-10-16 21:18 Ian Stakenvicius

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1494623465.3a64b6cc7293f9e7150d52ad2fef7775167c4524.axs@gentoo \
    --to=axs@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox