Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: content/common/sandbox_linux/bpf_gpu_policy_linux.cc

Issue 1542013005: Add a new driver bug workaround SANDBOX_START_EARLY Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and add note about a possible way to retrieve dri directory Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.cc ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_linux/bpf_gpu_policy_linux.cc
diff --git a/content/common/sandbox_linux/bpf_gpu_policy_linux.cc b/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
index d356897d9e0740668884c496307960ca5c91dddb..f57a02d0cdf3b2923db1ad3797bfa06cbb70153e 100644
--- a/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
+++ b/content/common/sandbox_linux/bpf_gpu_policy_linux.cc
@@ -22,6 +22,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
+#include "base/sys_info.h"
#include "build/build_config.h"
#include "content/common/sandbox_linux/sandbox_bpf_base_policy_linux.h"
#include "content/common/sandbox_linux/sandbox_seccomp_bpf_linux.h"
@@ -111,6 +112,16 @@ bool IsAcceleratedVideoDecodeEnabled() {
return !command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode);
}
+bool IsLLVMPipeDriver() {
+ // The only white-listed Mesa driver that starts threads is the llvmpipe
+ // driver. So only this driver will set kGpuSandboxStartEarly.
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ return command_line.HasSwitch(switches::kGpuSandboxStartEarly) &&
+ command_line.HasSwitch(switches::kGpuDriverVendor) &&
+ command_line.GetSwitchValueASCII(switches::kGpuDriverVendor) == "Mesa";
+}
+
intptr_t GpuSIGSYS_Handler(const struct arch_seccomp_data& args,
void* aux_broker_process) {
RAW_CHECK(aux_broker_process);
@@ -324,6 +335,36 @@ bool GpuProcessPolicy::PreSandboxHook() {
}
}
+ if (IsLLVMPipeDriver()) {
+ // uname is used from GpuControlList when calling
+ // gpu::ApplyGpuDriverBugWorkarounds.
+ base::SysInfo::OperatingSystemVersion();
+
+ std::vector<std::string> driver_libraries;
+
+ // TODO(j.isorce): crbug.com/264818 refactor ui/gl/gl_implementation.cc to
+ // return a list of libs to load depending on the gl implementation that is
+ // going to be used.
+ driver_libraries.push_back("libGL.so");
+ driver_libraries.push_back("libGLESv2.so.2");
+ driver_libraries.push_back("libEGL.so.1");
+
+ // FIXME(j.isorce): During gyp/gn step parse "dridriverdir" variable from
Ken Russell (switch to Gerrit) 2016/05/05 21:38:03 FIXME -> TODO
+ // pkgconfig/dri.pc to get the path to dri directory
+ // dri.pc comes from mesa-common-dev package.
+ // example: dridriverdir=/usr/lib/x86_64-linux-gnu/dri
+ // example: dridriverdir=/usr/local/lib/dri
+ // driver_libraries.push_back($dridriverdir"/swrast_dri.so");
+ // because dri is never in ld.so.conf and relative path only work from
+ // executable dir (i.e. chrome).
+ driver_libraries.push_back("/usr/lib/x86_64-linux-gnu/dri/swrast_dri.so");
+
+ for (size_t i = 0; i < driver_libraries.size(); ++i) {
+ dlopen(driver_libraries[i].c_str(),
+ RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
+ }
+ }
+
return true;
}
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.cc ('k') | gpu/config/gpu_driver_bug_list_json.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698