summaryrefslogtreecommitdiff
path: root/chromium/chrome_elf
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-06-18 14:10:49 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-06-18 13:53:24 +0000
commit813fbf95af77a531c57a8c497345ad2c61d475b3 (patch)
tree821b2c8de8365f21b6c9ba17a236fb3006a1d506 /chromium/chrome_elf
parentaf6588f8d723931a298c995fa97259bb7f7deb55 (diff)
downloadqtwebengine-chromium-813fbf95af77a531c57a8c497345ad2c61d475b3.tar.gz
BASELINE: Update chromium to 44.0.2403.47
Change-Id: Ie056fedba95cf5e5c76b30c4b2c80fca4764aa2f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'chromium/chrome_elf')
-rw-r--r--chromium/chrome_elf/BUILD.gn202
-rw-r--r--chromium/chrome_elf/blacklist.gypi6
-rw-r--r--chromium/chrome_elf/blacklist/blacklist.cc12
-rw-r--r--chromium/chrome_elf/blacklist/blacklist.h4
-rw-r--r--chromium/chrome_elf/blacklist/blacklist_interceptions.cc4
-rw-r--r--chromium/chrome_elf/chrome_elf.gyp12
-rw-r--r--chromium/chrome_elf/chrome_elf_main.cc2
-rw-r--r--chromium/chrome_elf/chrome_elf_util.cc26
-rw-r--r--chromium/chrome_elf/chrome_elf_util.h13
-rw-r--r--chromium/chrome_elf/chrome_elf_util_unittest.cc8
-rw-r--r--chromium/chrome_elf/create_file/chrome_create_file_unittest.cc2
-rw-r--r--chromium/chrome_elf/elf_imports_unittest.cc5
-rw-r--r--chromium/chrome_elf/ntdll_cache_unittest.cc2
-rw-r--r--chromium/chrome_elf/thunk_getter.cc3
14 files changed, 276 insertions, 25 deletions
diff --git a/chromium/chrome_elf/BUILD.gn b/chromium/chrome_elf/BUILD.gn
new file mode 100644
index 00000000000..ee00fa8d631
--- /dev/null
+++ b/chromium/chrome_elf/BUILD.gn
@@ -0,0 +1,202 @@
+# Copyright 2015 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.
+
+import("//chrome/version.gni")
+import("//testing/test.gni")
+
+process_version("chrome_elf_resources") {
+ sources = [
+ "chrome_elf.ver",
+ ]
+ output = "$target_gen_dir/chrome_elf_version.rc"
+}
+
+shared_library("chrome_elf") {
+ sources = [
+ "chrome_elf_main.cc",
+ "chrome_elf_main.h",
+ ]
+ deps = [
+ ":blacklist",
+ ":breakpad",
+ ":lib",
+ ":chrome_elf_resources",
+ ]
+ configs += [ "//build/config/win:windowed" ]
+ configs -= [ "//build/config/win:console" ]
+ ldflags = [
+ "/NODEFAULTLIB:user32.lib",
+ "/DEF:" + rebase_path("chrome_elf.def"),
+ ]
+ if (current_cpu == "x86") {
+ # Don"t set an x64 base address (to avoid breaking HE-ASLR).
+ ldflags += [ "/BASE:0x01c20000" ]
+ }
+}
+
+source_set("lib") {
+ sources = [
+ "create_file/chrome_create_file.cc",
+ "create_file/chrome_create_file.h",
+ "ntdll_cache.cc",
+ "ntdll_cache.h",
+ ]
+ deps = [
+ ":common",
+ "//base:base_static",
+ "//sandbox",
+ ]
+}
+
+source_set("constants") {
+ sources = [
+ "chrome_elf_constants.cc",
+ "chrome_elf_constants.h",
+ ]
+}
+
+source_set("common") {
+ deps = [
+ ":constants",
+ ]
+ sources = [
+ "chrome_elf_types.h",
+ "chrome_elf_util.cc",
+ "chrome_elf_util.h",
+ "thunk_getter.cc",
+ "thunk_getter.h",
+ ]
+}
+
+source_set("breakpad") {
+ include_dirs = [ "$target_gen_dir" ]
+ sources = [
+ "breakpad.cc",
+ "breakpad.h",
+ ]
+ deps = [
+ ":common",
+ "//breakpad:breakpad_handler",
+ "//chrome:version_header",
+ ]
+}
+
+if (is_component_build) {
+ shared_library("chrome_redirects") {
+ sources = [
+ "chrome_redirects_main.cc",
+ ]
+ deps = [
+ ":lib",
+ ]
+ configs += [ "//build/config/win:windowed" ]
+ ldflags = [ "/DEF:" + rebase_path("chrome_redirects.def") ]
+
+ if (current_cpu == "x86") {
+ # Don't set an x64 base address (to avoid breaking HE-ASLR).
+ ldflags += [ "/BASE:0x01c20000" ]
+ }
+ }
+}
+
+source_set("dll_hash") {
+ deps = [
+ "//base",
+ ]
+ sources = [
+ "dll_hash/dll_hash.cc",
+ "dll_hash/dll_hash.h",
+ ]
+}
+
+executable("dll_hash_main") {
+ deps = [
+ ":dll_hash",
+ ]
+ sources = [
+ "dll_hash/dll_hash_main.cc",
+ ]
+}
+
+static_library("blacklist") {
+ sources = [
+ "blacklist/blacklist.cc",
+ "blacklist/blacklist.h",
+ "blacklist/blacklist_interceptions.cc",
+ "blacklist/blacklist_interceptions.h",
+ ]
+ deps = [
+ # Depend on base_static, but do NOT take a dependency on base.gyp:base
+ # as that would risk pulling in base's link-time dependencies which
+ # chrome_elf cannot do.
+ ":breakpad",
+ ":constants",
+ "//base:base_static",
+ "//sandbox:sandbox",
+ ]
+}
+
+test("chrome_elf_unittests") {
+ output_name = "chrome_elf_unittests"
+ sources = [
+ "blacklist/test/blacklist_test.cc",
+ "chrome_elf_util_unittest.cc",
+ "create_file/chrome_create_file_unittest.cc",
+ "elf_imports_unittest.cc",
+ "ntdll_cache_unittest.cc",
+ ]
+ include_dirs = [ "$target_gen_dir" ]
+ deps = [
+ ":blacklist",
+ ":blacklist_test_main_dll",
+ ":lib",
+ "//base",
+ "//base/test:run_all_unittests",
+ "//base/test:test_support",
+ "//sandbox",
+ "//testing/gtest",
+ ]
+ data_deps = [
+ ":blacklist_test_dll_1",
+ ":blacklist_test_dll_2",
+ ":blacklist_test_dll_3",
+ ":chrome_elf",
+ "//chrome",
+ ]
+}
+
+shared_library("blacklist_test_main_dll") {
+ sources = [
+ "blacklist/test/blacklist_test_main_dll.cc",
+ ]
+ deps = [
+ "//base",
+ ":blacklist",
+ ]
+ ldflags =
+ [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_main_dll.def",
+ root_build_dir) ]
+}
+
+shared_library("blacklist_test_dll_1") {
+ sources = [
+ "blacklist/test/blacklist_test_dll_1.cc",
+ ]
+ ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_1.def",
+ root_build_dir) ]
+}
+
+shared_library("blacklist_test_dll_2") {
+ sources = [
+ "blacklist/test/blacklist_test_dll_2.cc",
+ ]
+ ldflags = [ "/DEF:" + rebase_path("blacklist/test/blacklist_test_dll_2.def",
+ root_build_dir) ]
+}
+
+shared_library("blacklist_test_dll_3") {
+ sources = [
+ "blacklist/test/blacklist_test_dll_3.cc",
+ ]
+}
diff --git a/chromium/chrome_elf/blacklist.gypi b/chromium/chrome_elf/blacklist.gypi
index 7ab5be1aaac..50d1a26f6c7 100644
--- a/chromium/chrome_elf/blacklist.gypi
+++ b/chromium/chrome_elf/blacklist.gypi
@@ -60,6 +60,12 @@
'sources': [
'blacklist/test/blacklist_test_dll_3.cc',
],
+ 'msvs_settings': {
+ # There's no exports in this DLL, this tells ninja not to expect an
+ # import lib so that it doesn't keep rebuilding unnecessarily due to
+ # the .lib being "missing".
+ 'NoImportLibrary': 'true',
+ },
},
],
}
diff --git a/chromium/chrome_elf/blacklist/blacklist.cc b/chromium/chrome_elf/blacklist/blacklist.cc
index f775b62d409..d778b90434e 100644
--- a/chromium/chrome_elf/blacklist/blacklist.cc
+++ b/chromium/chrome_elf/blacklist/blacklist.cc
@@ -36,9 +36,14 @@ const wchar_t* g_troublesome_dlls[kTroublesomeDllsMaxCount] = {
// See crbug.com/379218.
L"activedetect64.dll", // Lenovo One Key Theater.
L"bitguard.dll", // Unknown (suspected malware).
+ L"bsvc.dll", // Unknown (suspected adware).
L"chrmxtn.dll", // Unknown (keystroke logger).
L"cplushook.dll", // Unknown (suspected malware).
+ L"crdli.dll", // Linkury Inc.
+ L"crdli64.dll", // Linkury Inc.
L"datamngr.dll", // Unknown (suspected adware).
+ L"dpinterface32.dll", // Unknown (suspected adware).
+ L"explorerex.dll", // Unknown (suspected adware).
L"hk.dll", // Unknown (keystroke logger).
L"libapi2hook.dll", // V-Bates.
L"libinject.dll", // V-Bates.
@@ -48,13 +53,20 @@ const wchar_t* g_troublesome_dlls[kTroublesomeDllsMaxCount] = {
L"libwinhook.dll", // V-Bates.
L"lmrn.dll", // Unknown.
L"minisp.dll", // Unknown (suspected malware).
+ L"minisp32.dll", // Unknown (suspected malware).
L"safetynut.dll", // Unknown (suspected adware).
+ L"smdmf.dll", // Unknown (suspected adware).
+ L"spappsv32.dll", // Unknown (suspected adware).
L"systemk.dll", // Unknown (suspected adware).
+ L"vntsrv.dll", // Virtual New Tab by APN LLC.
L"wajam_goblin_64.dll", // Wajam Internet Technologies.
L"wajam_goblin.dll", // Wajam Internet Technologies.
L"windowsapihookdll32.dll", // Lenovo One Key Theater.
// See crbug.com/379218.
L"windowsapihookdll64.dll", // Lenovo One Key Theater.
+ L"virtualcamera.ax", // %PROGRAMFILES%\ASUS\VirtualCamera.
+ // See crbug.com/422522.
+ L"ycwebcamerasource.ax", // CyberLink Youcam, crbug.com/424159
// Keep this null pointer here to mark the end of the list.
NULL,
};
diff --git a/chromium/chrome_elf/blacklist/blacklist.h b/chromium/chrome_elf/blacklist/blacklist.h
index 8a06ef06e2b..bbcf0687ac0 100644
--- a/chromium/chrome_elf/blacklist/blacklist.h
+++ b/chromium/chrome_elf/blacklist/blacklist.h
@@ -35,7 +35,7 @@ bool LeaveSetupBeacon();
bool ResetBeacon();
// Return the size of the current blacklist.
-int BlacklistSize();
+extern "C" int BlacklistSize();
// Returns if true if the blacklist has been initialized.
extern "C" bool IsBlacklistInitialized();
@@ -69,7 +69,7 @@ extern "C" void SuccessfullyBlocked(const wchar_t** blocked_dlls, int* size);
extern "C" void AddDllsFromRegistryToBlacklist();
// Record that the dll at the given index was blocked.
-void BlockedDll(size_t blocked_index);
+extern "C" void BlockedDll(size_t blocked_index);
// Initializes the DLL blacklist in the current process. This should be called
// before any undesirable DLLs might be loaded. If |force| is set to true, then
diff --git a/chromium/chrome_elf/blacklist/blacklist_interceptions.cc b/chromium/chrome_elf/blacklist/blacklist_interceptions.cc
index 28eb692accc..07825ecc51d 100644
--- a/chromium/chrome_elf/blacklist/blacklist_interceptions.cc
+++ b/chromium/chrome_elf/blacklist/blacklist_interceptions.cc
@@ -51,7 +51,7 @@ base::string16 GetBackingModuleFilePath(PVOID address) {
DCHECK_NT(g_nt_query_virtual_memory_func);
// We'll start with something close to max_path characters for the name.
- ULONG buffer_bytes = MAX_PATH * 2;
+ SIZE_T buffer_bytes = MAX_PATH * 2;
std::vector<BYTE> buffer_data(buffer_bytes);
for (;;) {
@@ -61,7 +61,7 @@ base::string16 GetBackingModuleFilePath(PVOID address) {
if (!section_name)
break;
- ULONG returned_bytes;
+ SIZE_T returned_bytes;
NTSTATUS ret = g_nt_query_virtual_memory_func(
NtCurrentProcess, address, MemorySectionName, section_name,
buffer_bytes, &returned_bytes);
diff --git a/chromium/chrome_elf/chrome_elf.gyp b/chromium/chrome_elf/chrome_elf.gyp
index 0b612a87c6e..cbbb4b4b580 100644
--- a/chromium/chrome_elf/chrome_elf.gyp
+++ b/chromium/chrome_elf/chrome_elf.gyp
@@ -15,19 +15,9 @@
{
'target_name': 'chrome_elf_resources',
'type': 'none',
- 'conditions': [
- ['branding == "Chrome"', {
- 'variables': {
- 'branding_path': '../chrome/app/theme/google_chrome/BRANDING',
- },
- }, { # else branding!="Chrome"
- 'variables': {
- 'branding_path': '../chrome/app/theme/chromium/BRANDING',
- },
- }],
- ],
'variables': {
'output_dir': 'chrome_elf',
+ 'branding_path': '../chrome/app/theme/<(branding_path_component)/BRANDING',
'template_input_path': '../chrome/app/chrome_version.rc.version',
},
'sources': [
diff --git a/chromium/chrome_elf/chrome_elf_main.cc b/chromium/chrome_elf/chrome_elf_main.cc
index 989493a122e..52212cc91f4 100644
--- a/chromium/chrome_elf/chrome_elf_main.cc
+++ b/chromium/chrome_elf/chrome_elf_main.cc
@@ -8,6 +8,7 @@
#include "chrome_elf/blacklist/blacklist.h"
#include "chrome_elf/breakpad.h"
+#include "chrome_elf/chrome_elf_util.h"
#include "chrome_elf/ntdll_cache.h"
void SignalChromeElf() {
@@ -16,6 +17,7 @@ void SignalChromeElf() {
BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) {
if (reason == DLL_PROCESS_ATTACH) {
+ InitializeProcessType();
InitializeCrashReporting();
__try {
diff --git a/chromium/chrome_elf/chrome_elf_util.cc b/chromium/chrome_elf/chrome_elf_util.cc
index a547d0bda04..7e2e7103ce4 100644
--- a/chromium/chrome_elf/chrome_elf_util.cc
+++ b/chromium/chrome_elf/chrome_elf_util.cc
@@ -4,11 +4,14 @@
#include "chrome_elf/chrome_elf_util.h"
+#include <assert.h>
#include <windows.h>
#include "base/macros.h"
#include "base/strings/string16.h"
+ProcessType g_process_type = ProcessType::UNINITIALIZED;
+
namespace {
const wchar_t kRegPathClientState[] = L"Software\\Google\\Update\\ClientState";
@@ -192,18 +195,29 @@ bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled) {
return false;
}
-bool IsNonBrowserProcess() {
+void InitializeProcessType() {
+ assert(g_process_type == ProcessType::UNINITIALIZED);
typedef bool (*IsSandboxedProcessFunc)();
IsSandboxedProcessFunc is_sandboxed_process_func =
reinterpret_cast<IsSandboxedProcessFunc>(
GetProcAddress(GetModuleHandle(NULL), "IsSandboxedProcess"));
- bool is_sandboxed_process =
- is_sandboxed_process_func && is_sandboxed_process_func();
+ if (is_sandboxed_process_func && is_sandboxed_process_func()) {
+ g_process_type = ProcessType::NON_BROWSER_PROCESS;
+ return;
+ }
// TODO(robertshield): Drop the command line check when we drop support for
// enabling chrome_elf in unsandboxed processes.
- wchar_t* command_line = GetCommandLine();
- bool has_process_type_flag = command_line && wcsstr(command_line, L"--type");
+ const wchar_t* command_line = GetCommandLine();
+ if (command_line && wcsstr(command_line, L"--type")) {
+ g_process_type = ProcessType::NON_BROWSER_PROCESS;
+ return;
+ }
- return (has_process_type_flag || is_sandboxed_process);
+ g_process_type = ProcessType::BROWSER_PROCESS;
+}
+
+bool IsNonBrowserProcess() {
+ assert(g_process_type != ProcessType::UNINITIALIZED);
+ return g_process_type == ProcessType::NON_BROWSER_PROCESS;
}
diff --git a/chromium/chrome_elf/chrome_elf_util.h b/chromium/chrome_elf/chrome_elf_util.h
index e87dc7fab70..673943d6513 100644
--- a/chromium/chrome_elf/chrome_elf_util.h
+++ b/chromium/chrome_elf/chrome_elf_util.h
@@ -7,6 +7,12 @@
#include "base/strings/string16.h"
+enum class ProcessType {
+ UNINITIALIZED,
+ NON_BROWSER_PROCESS,
+ BROWSER_PROCESS,
+};
+
// Returns true if |exe_path| points to a Chrome installed in an SxS
// installation.
bool IsCanary(const wchar_t* exe_path);
@@ -24,8 +30,15 @@ bool AreUsageStatsEnabled(const wchar_t* exe_path);
// if stats collecting is permitted by this policy and false if not.
bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled);
+// Initializes |g_process_type| which stores whether or not the current process
+// is the main browser process.
+void InitializeProcessType();
+
// Returns true if invoked in a Chrome process other than the main browser
// process. False otherwise.
bool IsNonBrowserProcess();
+// Caches the |ProcessType| of the current process.
+extern ProcessType g_process_type;
+
#endif // CHROME_ELF_CHROME_ELF_UTIL_H_
diff --git a/chromium/chrome_elf/chrome_elf_util_unittest.cc b/chromium/chrome_elf/chrome_elf_util_unittest.cc
index 90b04ed126f..565785f95d6 100644
--- a/chromium/chrome_elf/chrome_elf_util_unittest.cc
+++ b/chromium/chrome_elf/chrome_elf_util_unittest.cc
@@ -48,6 +48,12 @@ TEST(ChromeElfUtilTest, SystemInstallTest) {
EXPECT_FALSE(IsSystemInstall(kChromeUserExePath));
}
+TEST(ChromeElfUtilTest, BrowserProcessTest) {
+ EXPECT_EQ(ProcessType::UNINITIALIZED, g_process_type);
+ InitializeProcessType();
+ EXPECT_FALSE(IsNonBrowserProcess());
+}
+
// Parameterized test with paramters:
// 1: product: "canary" or "google"
// 2: install level: "user" or "system"
@@ -57,7 +63,7 @@ class ChromeElfUtilTest :
const char*,
const char*> > {
protected:
- virtual void SetUp() override {
+ void SetUp() override {
override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE);
override_manager_.OverrideRegistry(HKEY_CURRENT_USER);
const char* app;
diff --git a/chromium/chrome_elf/create_file/chrome_create_file_unittest.cc b/chromium/chrome_elf/create_file/chrome_create_file_unittest.cc
index cd66d470688..8b0331fe88d 100644
--- a/chromium/chrome_elf/create_file/chrome_create_file_unittest.cc
+++ b/chromium/chrome_elf/create_file/chrome_create_file_unittest.cc
@@ -76,7 +76,7 @@ class ChromeCreateFileTest : public PlatformTest {
path);
}
- virtual void SetUp() override {
+ void SetUp() override {
original_thread_ = base::PlatformThread::CurrentId();
InitCache();
PlatformTest::SetUp();
diff --git a/chromium/chrome_elf/elf_imports_unittest.cc b/chromium/chrome_elf/elf_imports_unittest.cc
index 136912beac9..dda1bb122df 100644
--- a/chromium/chrome_elf/elf_imports_unittest.cc
+++ b/chromium/chrome_elf/elf_imports_unittest.cc
@@ -66,6 +66,9 @@ TEST_F(ELFImportsTest, ChromeElfSanityCheck) {
#if defined(SYZYASAN)
"syzyasan_rtl.dll",
#endif
+#if defined(ADDRESS_SANITIZER) && defined(COMPONENT_BUILD)
+ "clang_rt.asan_dynamic-i386.dll",
+#endif
"ADVAPI32.dll"
};
@@ -76,7 +79,7 @@ TEST_F(ELFImportsTest, ChromeElfSanityCheck) {
if (MatchPattern(*it, kValidFilePatterns[i]))
match = true;
}
- ASSERT_TRUE(match) << "Illegal import in chrome_elf.dll.";
+ ASSERT_TRUE(match) << "Illegal import in chrome_elf.dll: " << *it;
}
}
diff --git a/chromium/chrome_elf/ntdll_cache_unittest.cc b/chromium/chrome_elf/ntdll_cache_unittest.cc
index a96df6156ab..d3f3555ab38 100644
--- a/chromium/chrome_elf/ntdll_cache_unittest.cc
+++ b/chromium/chrome_elf/ntdll_cache_unittest.cc
@@ -13,7 +13,7 @@ namespace {
class NTDLLCacheTest : public testing::Test {
protected:
- virtual void SetUp() override {
+ void SetUp() override {
InitCache();
}
diff --git a/chromium/chrome_elf/thunk_getter.cc b/chromium/chrome_elf/thunk_getter.cc
index 8421e5eecf1..649fb0ca518 100644
--- a/chromium/chrome_elf/thunk_getter.cc
+++ b/chromium/chrome_elf/thunk_getter.cc
@@ -20,6 +20,7 @@ enum Version {
VERSION_WIN7, // Also includes Windows Server 2008 R2.
VERSION_WIN8, // Also includes Windows Server 2012.
VERSION_WIN8_1,
+ VERSION_WIN10,
VERSION_WIN_LAST, // Indicates error condition.
};
@@ -85,6 +86,8 @@ class OSInfo {
version_ = VERSION_WIN8_1;
break;
}
+ } else if (version_number_.major == 10) {
+ version_ = VERSION_WIN10;
} else if (version_number_.major > 6) {
version_ = VERSION_WIN_LAST;
} else {