
MSan test failed after landing crrev.com/c/5932764 with the error message: `WARNING: MemorySanitizer: use-of-uninitialized-value`. ``` Uninitialized value was created by an allocation of 'child_process_data' in the stack frame ``` Failure CI bot link: https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20MSan%20Tests/51310/test-results?q=ExactID%3Aninja%3A%2F%2Fcomponents%3Acomponents_unittests%2FContentStabilityMetricsProviderTest.BrowserChildProcessObserverUtility+VHash%3Aa09c171ea35b3b9e The landed CL is not the root cause of the MSan test failure but just uncovered the potential `use-of-uninitialized-value` issue because `ContentStabilityMetricsProvider::BrowserChildProcessCrashed()` reads `sandbox_type` which was not set in the existing test cases. Promoted `sandbox::mojom::Sandbox sandbox_type` as std::optional since it can be invalid (or unknown) for some cases, plus the mojom Enum doesn't have any proper one for invalid cases. `sandbox_type` can be a lhs-value currently or in the future. For example, https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/webui/sandbox/sandbox_handler.cc;drc=e6fc2038d73ef96ff47deda3146d94d25530e13b;l=47 Tests: ``` autoninja -C out\Default metrics_unittests out\Default\metrics_unittests --single-process-tests --gtest_filter=ContentStabilityMetricsProviderTest.* autoninja -C out\Default sandbox_unittests out\Default\sandbox_unittests ``` Bug: b:368672525 Change-Id: I435f5a879b23f557d5b1456e3754366528ce8685 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5949437 Reviewed-by: Luc Nguyen <lucnguyen@google.com> Reviewed-by: David Schinazi <dschinazi@chromium.org> Reviewed-by: Will Harris <wfh@chromium.org> Reviewed-by: Charlie Reis <creis@chromium.org> Commit-Queue: Sangbaek Park <sangbaekpark@chromium.org> Cr-Commit-Position: refs/heads/main@{#1372950}
Sandbox Library
This directory contains platform-specific sandboxing libraries. Sandboxing is a technique that can improve the security of an application by separating untrustworthy code (or code that handles untrustworthy data) and restricting its privileges and capabilities.
Each platform relies on the operating system's process primitive to isolate code into distinct security principals, and platform-specific technologies are used to implement the privilege reduction. At a high-level:
mac/
uses the Seatbelt sandbox. See the detailed design for more.linux/
uses namespaces and Seccomp-BPF. See the detailed design for more.win/
uses a combination of restricted tokens, distinct job objects, alternate desktops, and integrity levels. See the detailed design for more.
Built on top of the low-level sandboxing library is the
//sandbox/policy
component, which provides concrete
policies and helper utilities for sandboxing specific Chromium processes and
services. The core sandbox library cannot depend on the policy component.