Don't grant unnecessary handle privileges in OpenProcessHandle.
This patch makes it harder for process handles with more privileges to leak to untrusted places. Review URL: http://codereview.chromium.org/125260 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18802 0039d316-1c4b-4281-b951-d872f2087c98
Esse commit está contido em:
@@ -34,11 +34,10 @@ ProcessHandle GetCurrentProcessHandle() {
|
||||
}
|
||||
|
||||
bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle) {
|
||||
// TODO(phajdan.jr): Take even more permissions out of this list.
|
||||
ProcessHandle result = OpenProcess(PROCESS_DUP_HANDLE |
|
||||
PROCESS_TERMINATE |
|
||||
PROCESS_QUERY_INFORMATION |
|
||||
SYNCHRONIZE,
|
||||
// We try to limit privileges granted to the handle. If you need this
|
||||
// for test code, consider using OpenPrivilegedProcessHandle instead of
|
||||
// adding more privileges here.
|
||||
ProcessHandle result = OpenProcess(PROCESS_DUP_HANDLE | PROCESS_TERMINATE,
|
||||
FALSE, pid);
|
||||
|
||||
if (result == INVALID_HANDLE_VALUE)
|
||||
|
||||
@@ -29,7 +29,7 @@ void TerminateAllChromeProcesses(const FilePath& data_dir) {
|
||||
base::ProcessHandle handle;
|
||||
// Ignore processes for which we can't open the handle. We don't guarantee
|
||||
// that all processes will terminate, only try to do so.
|
||||
if (base::OpenProcessHandle(*it, &handle))
|
||||
if (base::OpenPrivilegedProcessHandle(*it, &handle))
|
||||
handles.push_back(handle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ class MemoryTest : public UITest {
|
||||
scoped_ptr<base::ProcessMetrics> process_metrics;
|
||||
IoCounters io_counters;
|
||||
base::ProcessHandle process_handle;
|
||||
if (!base::OpenProcessHandle(*it, &process_handle)) {
|
||||
if (!base::OpenPrivilegedProcessHandle(*it, &process_handle)) {
|
||||
NOTREACHED();
|
||||
}
|
||||
process_metrics.reset(
|
||||
|
||||
@@ -233,7 +233,7 @@ class PageCyclerTest : public UITest {
|
||||
ChromeProcessList::const_iterator it;
|
||||
for (it = chrome_processes.begin(); it != chrome_processes.end(); ++it) {
|
||||
base::ProcessHandle process_handle;
|
||||
if (!base::OpenProcessHandle(*it, &process_handle)) {
|
||||
if (!base::OpenPrivilegedProcessHandle(*it, &process_handle)) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ class PageCyclerTest : public UITest {
|
||||
ChromeProcessList::const_iterator it;
|
||||
for (it = chrome_processes.begin(); it != chrome_processes.end(); ++it) {
|
||||
base::ProcessHandle process_handle;
|
||||
if (!base::OpenProcessHandle(*it, &process_handle)) {
|
||||
if (!base::OpenPrivilegedProcessHandle(*it, &process_handle)) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário