Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OpenBSD] Process.threads() fails with AccessDenied #2308

Closed
giampaolo opened this issue Oct 1, 2023 · 0 comments
Closed

[OpenBSD] Process.threads() fails with AccessDenied #2308

giampaolo opened this issue Oct 1, 2023 · 0 comments

Comments

@giampaolo
Copy link
Owner

Summary

  • OS: OpenBSD
  • Type: core

Description

...also as a root user. Apparently this is due to /dev/mem having limited permissions, see:
https://stackoverflow.com/questions/22369736/open-dev-mem-operation-not-permitted.

======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_kill (proc=psutil.Process(pid=10182, status='terminated'), name='num_threads')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/psutil/psutil/_psbsd.py", line 567, in wrapper
    return fun(self, *args, **kwargs)
  File "/vagrant/psutil/psutil/_psbsd.py", line 770, in threads
    rawlist = cext.proc_threads(self.pid)
PermissionError: [Errno 13] assume access denied (originated from (originated from kvm_openfiles(): /dev/mem: Permission denied))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/vagrant/psutil/psutil/tests/__init__.py", line 979, in assertProcessGone
    ret = fun()
  File "/vagrant/psutil/psutil/__init__.py", line 891, in num_threads
    return self._proc.num_threads()
  File "/vagrant/psutil/psutil/_psbsd.py", line 567, in wrapper
    return fun(self, *args, **kwargs)
  File "/vagrant/psutil/psutil/_psbsd.py", line 758, in num_threads
    return len(self.threads())
  File "/vagrant/psutil/psutil/_psbsd.py", line 574, in wrapper
    raise AccessDenied(self.pid, self._name)
psutil.AccessDenied: (pid=10182)

======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_kill (proc=psutil.Process(pid=10182, status='terminated'), name='threads')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/vagrant/psutil/psutil/_psbsd.py", line 567, in wrapper
    return fun(self, *args, **kwargs)
  File "/vagrant/psutil/psutil/_psbsd.py", line 770, in threads
    rawlist = cext.proc_threads(self.pid)
PermissionError: [Errno 13] assume access denied (originated from (originated from kvm_openfiles(): /dev/mem: Permission denied))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/vagrant/psutil/psutil/tests/__init__.py", line 979, in assertProcessGone
    ret = fun()
  File "/vagrant/psutil/psutil/__init__.py", line 901, in threads
    return self._proc.threads()
  File "/vagrant/psutil/psutil/_psbsd.py", line 574, in wrapper
    raise AccessDenied(self.pid, self._name)
psutil.AccessDenied: (pid=10182)
@giampaolo giampaolo added the bug label Oct 1, 2023
ddelange added a commit to ddelange/psutil that referenced this issue Oct 16, 2023
* 'master' of https://github.com/giampaolo/psutil:
  pre-release
  give CREDIT to @JeremyGrosser and @getsentry for sponsorship (thanks\!)
  fix error in test_contracts.py on win
  chore: update GHA workflows (giampaolo#2315)
  fix giampaolo#2195 / linux: no longer print exception at import time
  Add ruff Python linter, remove flake8 (giampaolo#2312)
  Add toml-sort linting tool for pyproject.toml (giampaolo#2311)
  new RTD config
  new RTD config
  new RTD config
  Fix giampaolo#2308, OpenBSD: Process.threads() always fail with AccessDenied.
  Win: fix OpenProcess not recognizing when proc is gone.
  refact assertProcessGone
  refact assertProcessGone
  Add RsT linter (giampaolo#2292)
  Make _raise_if_pid_reused() raise NSP only if pid has been reused.
  fix DEVGUIDE.rst
  PID reusage is not checked for different set methods (giampaolo#2291)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant