diff --git a/HISTORY.rst b/HISTORY.rst index d19007621..bd732bfe1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -14,6 +14,7 @@ Bug tracker at https://github.com/giampaolo/psutil/issues **Bug fixes** +- #514: [OSX] possibly fix Process.memory_maps() segfault (critical!). - #783: [OSX] Process.status() may erroneously return "running" for zombie processes. - #798: [Windows] Process.open_files() returns and empty list on Windows 10. @@ -30,7 +31,7 @@ Bug tracker at https://github.com/giampaolo/psutil/issues - #908: [OSX, BSD] different process methods could errounesuly mask the real error for high-privileged PIDs and raise NoSuchProcess and AccessDenied instead of OSError and RuntimeError. -- #XXX: [OSX] Process open_files() and connections() methods may raise +- #909: [OSX] Process open_files() and connections() methods may raise OSError with no exception set if process is gone. diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_osx.c index ecf1803c0..976b84a77 100644 --- a/psutil/_psutil_osx.c +++ b/psutil/_psutil_osx.c @@ -346,6 +346,11 @@ psutil_proc_memory_maps(PyObject *self, PyObject *args) { (info.max_protection & VM_PROT_EXECUTE) ? 'x' : '-'); err = proc_regionfilename(pid, address, buf, sizeof(buf)); + if (err == 0) { + psutil_raise_for_pid( + pid, "proc_regionfilename() syscall failed"); + goto error; + } if (info.share_mode == SM_COW && info.ref_count == 1) { // Treat single reference SM_COW as SM_PRIVATE