diff options
Diffstat (limited to 'chrome/test/security_tests/sandbox_browsertest_linux.cc')
-rw-r--r-- | chrome/test/security_tests/sandbox_browsertest_linux.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/chrome/test/security_tests/sandbox_browsertest_linux.cc b/chrome/test/security_tests/sandbox_browsertest_linux.cc new file mode 100644 index 0000000..f9c26599 --- /dev/null +++ b/chrome/test/security_tests/sandbox_browsertest_linux.cc @@ -0,0 +1,34 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/test/base/in_process_browser_test.h" +#include "content/public/browser/zygote_host_linux.h" +#include "content/public/common/sandbox_linux.h" + +typedef InProcessBrowserTest SandboxLinuxTest; + +// Both the SUID sandbox (http://crbug.com/137653) and the Seccomp-BPF sandbox +// are currently incompatible with ASan. +#if defined(OS_LINUX) && !defined(ADDRESS_SANITIZER) +#define MAYBE_SandboxStatus \ + SandboxStatus +#else +#define MAYBE_SandboxStatus \ + DISABLED_SandboxStatus +#endif + +IN_PROC_BROWSER_TEST_F(SandboxLinuxTest, MAYBE_SandboxStatus) { + // Get expected sandboxing status of renderers. + const int status = content::ZygoteHost::GetInstance()->GetSandboxStatus(); + + // The setuid sandbox is required as our first-layer sandbox. + bool good_layer1 = status & content::kSandboxLinuxSUID && + status & content::kSandboxLinuxPIDNS && + status & content::kSandboxLinuxNetNS; + // A second-layer sandbox is also required to be adequately sandboxed. + bool good_layer2 = status & content::kSandboxLinuxSeccompBpf; + + EXPECT_TRUE(good_layer1); + EXPECT_TRUE(good_layer2); +} |