diff options
author | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-18 12:37:03 +0000 |
---|---|---|
committer | robertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-18 12:37:03 +0000 |
commit | ff2cd6177c0a16648e2a3fa7c6151af140f30a82 (patch) | |
tree | 9cb93870a3a21ee866b329d55242d1a509c0eb51 /chrome_elf/blacklist/blacklist.h | |
parent | f6b257352113d093138f129ba4c80cfae6bc6ea0 (diff) | |
download | chromium_src-ff2cd6177c0a16648e2a3fa7c6151af140f30a82.zip chromium_src-ff2cd6177c0a16648e2a3fa7c6151af140f30a82.tar.gz chromium_src-ff2cd6177c0a16648e2a3fa7c6151af140f30a82.tar.bz2 |
Chrome browser process DLL blacklist.
This patch allows for blocking of module loading in the browser process.
It does not actually prevent any modules from loading.
BUG=329023
TEST=chrome_elf_unittests
Review URL: https://codereview.chromium.org/107663008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241548 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_elf/blacklist/blacklist.h')
-rw-r--r-- | chrome_elf/blacklist/blacklist.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/chrome_elf/blacklist/blacklist.h b/chrome_elf/blacklist/blacklist.h new file mode 100644 index 0000000..5787ddd --- /dev/null +++ b/chrome_elf/blacklist/blacklist.h @@ -0,0 +1,52 @@ +// 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. + +#ifndef CHROME_ELF_BLACKLIST_BLACKLIST_H_ +#define CHROME_ELF_BLACKLIST_BLACKLIST_H_ + +namespace blacklist { + +// Max size of the DLL blacklist. +const int kTroublesomeDllsMaxCount = 64; + +// The DLL blacklist. +extern const wchar_t* g_troublesome_dlls[kTroublesomeDllsMaxCount]; + +// Cursor to the current last element in the blacklist. +extern int g_troublesome_dlls_cur_index; + +// The registry path of the blacklist beacon. Exposed here for testing. +extern const wchar_t kRegistryBeaconPath[]; + +// Attempts to create a beacon in the current user's registry hive. +// If the beacon already exists or any other error occurs when creating the +// beacon, returns false. Otherwise returns true. +// The intent of the beacon is to act as an extra failure mode protection +// whereby if Chrome for some reason fails to start during blacklist setup, +// it will skip blacklisting on the subsequent run. +bool CreateBeacon(); + +// Looks for the beacon that CreateBeacon() creates and attempts to delete it. +// Returns true if the beacon was found and deleted. +bool ClearBeacon(); + +// Adds the given dll name to the blacklist. Returns true if the dll name is in +// the blacklist when this returns, false on error. Note that this will copy +// |dll_name| and will leak it on exit if the string is not subsequently removed +// using RemoveDllFromBlacklist. +extern "C" bool AddDllToBlacklist(const wchar_t* dll_name); + +// Removes the given dll name from the blacklist. Returns true if it was +// removed, false on error. +extern "C" bool RemoveDllFromBlacklist(const wchar_t* dll_name); + +// 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 +// initialization will take place even if a beacon is present. This is useful +// for tests. +bool Initialize(bool force); + +} // namespace blacklist + +#endif // CHROME_ELF_BLACKLIST_BLACKLIST_H_ |