This is the mail archive of the
cygwin-cvs@cygwin.com
mailing list for the Cygwin project.
[newlib-cygwin] Open process with PROCESS_QUERY_INFORMATION to fetch maps
- From: Corinna Vinschen <corinna at sourceware dot org>
- To: cygwin-cvs at sourceware dot org
- Date: 1 Aug 2016 09:52:39 -0000
- Subject: [newlib-cygwin] Open process with PROCESS_QUERY_INFORMATION to fetch maps
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=11dcf9cb5cf4f7f15799dedc9cdeab3cae0de64e
commit 11dcf9cb5cf4f7f15799dedc9cdeab3cae0de64e
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Mon Aug 1 11:52:30 2016 +0200
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>
Diff:
---
winsup/cygwin/fhandler_process.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index eb2bf8a..02f7ca0 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -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. */