Skip to content

Add regression tests for MemoryDenyWriteExecute=true#1071

Open
geofft wants to merge 1 commit intomainfrom
geofft/validate-noexecstack-threads
Open

Add regression tests for MemoryDenyWriteExecute=true#1071
geofft wants to merge 1 commit intomainfrom
geofft/validate-noexecstack-threads

Conversation

@geofft
Copy link
Copy Markdown
Collaborator

@geofft geofft commented Mar 30, 2026

As reported in #956, executable stacks cause thread creation to fail under MemoryDenyWriteExecute=true. In kernel 6.3+ (which the GitHub Actions runners should have) this is implemented using prctl(PR_SET_MDWE). In older versions systemd uses a more complicated seccomp filter.

As reported in #956, executable stacks cause thread creation to fail
under MemoryDenyWriteExecute=true. In kernel 6.3+ (which the GitHub
Actions runners should have) this is implemented using
prctl(PR_SET_MDWE). In older versions systemd uses a more complicated
seccomp filter.
@geofft
Copy link
Copy Markdown
Collaborator Author

geofft commented Mar 30, 2026

Fails locally on an existing release, although unfortunately Python's error message is not great:

$ BUILD_OPTIONS= TARGET_TRIPLE=x86_64-linux-gnu uvx python3 -m unittest pythonbuild.disttests 
......E..Es.
======================================================================
ERROR: test_nx_thread_creation (pythonbuild.disttests.TestPythonInterpreter.test_nx_thread_creation)
Test that thread creation works under e.g. systemd's MemoryDenyWriteExecute.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ubuntu/python-build-standalone/pythonbuild/disttests/__init__.py", line 350, in test_nx_thread_creation
    t.start()
    ~~~~~~~^^
  File "/home/ubuntu/.local/share/uv/python/cpython-3.14.3-linux-x86_64-gnu/lib/python3.14/threading.py", line 1005, in start
    _start_joinable_thread(self._bootstrap, handle=self._os_thread_handle,
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                           daemon=self.daemon)
                           ^^^^^^^^^^^^^^^^^^^
RuntimeError: can't start new thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants