Skip to content

Enable os.memfd_create through runtime weak linking - #1164

Merged
jjhelmus merged 5 commits into
mainfrom
jjh/weak_sym_memfd_create
Jul 10, 2026
Merged

jjhelmus merged 5 commits into
mainfrom
jjh/weak_sym_memfd_create

Conversation

@jjhelmus

Copy link
Copy Markdown
Contributor

Always build CPython with os.memfd_create but remove the Python function from the namespace at runtime when glibc does not provide the an implementation.

This is accomplished using a weak memfd_create symbol which is evaluated at runtime.

This requires the modern kernel UAPI headers from #1163 to define the MFD_* constants.

@jjhelmus jjhelmus added platform:linux Specific to the Linux platform arch:all Select all architectures labels Jun 24, 2026
@zanieb

zanieb commented Jun 24, 2026

Copy link
Copy Markdown
Member

We should definitely try to upstream any weak linking implementations

@jjhelmus
jjhelmus force-pushed the jjh/weak_sym_memfd_create branch from 6f97a40 to 42a149a Compare July 9, 2026 21:08
@jjhelmus

jjhelmus commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on top of merged #1163

@jjhelmus jjhelmus added libc:gnu build:all python:all Select all Python versions labels Jul 10, 2026
@jjhelmus
jjhelmus merged commit 89de021 into main Jul 10, 2026
241 checks passed
@jjhelmus
jjhelmus deleted the jjh/weak_sym_memfd_create branch July 10, 2026 18:07
jjhelmus added a commit that referenced this pull request Jul 22, 2026
Use the pattern from #1164 to make `os.copy_file_range` available at
runtime when the host glibc version provides the function.
p-gentili added a commit to canonical/yarf that referenced this pull request Aug 13, 2026
Use the uv-managed Python environment for YARF and Mir again. The upstream python-build-standalone fix for os.memfd_create makes the system-Python workaround unnecessary: astral-sh/python-build-standalone#1164

Keep the project on Python 3.12, as required for Noble while pywayland does not provide a Python 3.14 wheel. Run the legacy docformatter hook with Python 3.12 because its untokenize dependency is not compatible with Python 3.14.

Keep the system-Python virtual environment used by simple-counter documented as a PyGObject requirement, rather than a Mir requirement.

Signed-off-by: Paolo Gentili <paolo.gentili@canonical.com>
p-gentili added a commit to canonical/yarf that referenced this pull request Aug 13, 2026
Use the uv-managed Python environment for YARF and Mir again. The upstream python-build-standalone fix for os.memfd_create makes the system-Python workaround unnecessary: astral-sh/python-build-standalone#1164

Keep the project on Python 3.12, as required for Noble while pywayland does not provide a Python 3.14 wheel. Run the legacy docformatter hook with Python 3.12 because its untokenize dependency is not compatible with Python 3.14.

Keep the system-Python virtual environment used by simple-counter documented as a PyGObject requirement, rather than a Mir requirement.

Signed-off-by: Paolo Gentili <paolo.gentili@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch:all Select all architectures build:all libc:gnu platform:linux Specific to the Linux platform python:all Select all Python versions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants