Open process with PROCESS_QUERY_INFORMATION to fetch maps

Commit ba58e5f lowered permission requirements when opening threads
and processes to {PROCESS,THREAD}_QUERY_LIMITED_INFORMATION.  However,
when creating the /proc/<PID>/maps file, the call to VirtualQueryEx
requires PROCESS_QUERY_INFORMATION access

Note: It seems PROCESS_QUERY_LIMITED_INFORMATION is sufficient starting
with Windows 8.1, but this is neither documented on MSDN, nor is it a
safe bet.  It may have to do with a fixed implementation of the UAC
trust levels.  Let's better follow the docs for now.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2016-08-01 11:52:30 +02:00
parent d7586cb66c
commit 11dcf9cb5c
1 changed files with 2 additions and 2 deletions

View File

@ -796,7 +796,7 @@ static off_t
format_process_maps (void *data, char *&destbuf)
{
_pinfo *p = (_pinfo *) data;
HANDLE proc = OpenProcess (PROCESS_QUERY_LIMITED_INFORMATION
HANDLE proc = OpenProcess (PROCESS_QUERY_INFORMATION
| PROCESS_VM_READ, FALSE, p->dwProcessId);
if (!proc)
return 0;
@ -1438,7 +1438,7 @@ get_mem_values (DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss,
PMEMORY_WORKING_SET_LIST p;
SIZE_T n = 0x4000, length;
/* This appears to work despite MSDN claiming that QueryWorkingSSet requires
/* This appears to work despite MSDN claiming that QueryWorkingSet requires
PROCESS_QUERY_INFORMATION *and* PROCESS_VM_READ. Since we're trying to do
everything with least perms, we stick to PROCESS_QUERY_INFORMATION only
unless this changes in Windows for some reason. */