GeezerVison is showing github.com — Fix accepting Linux AF_ALG sockets by youknowdot · Pull Request #9637 · RustPython/RustPython
Conversation
youknowdot
commented
Nov 3, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary
Linux AF_ALG rejects accept when a peer-address buffer is supplied. Use accept4 without an address for this family, return None as the peer address, and atomically set close-on-exec on the accepted descriptor, following CPython 3.15's AF_ALG path. Other families keep the existing accept_raw path. The normal socket operation wrapper still handles timeout, signal, and interrupted-call behavior.
This is scoped to accepting AF_ALG sockets. It does not change sendmsg_afalg, complete AF_ALG address parsing, or repair existing concurrent close/reinitialization races. Unlike CPython, this Linux-only path does not fall back to accept if accept4 returns ENOSYS.
Validation
- Independent source review against CPython 3.15 and socket2's accept implementation; reviewed descriptor ownership and CLOEXEC, platform guards, and the socket operation wrapper.
rustfmt, git diff --check, and repository hooks passed.
- No local RustPython build or runtime tests were run. Hosted CI must validate compilation and behavior.
- Existing
test_socket.LinuxKernelCryptoAPI.test_sha256 and test_hmac_sha1 reach this path where AF_ALG and the algorithms are available, but neither directly asserts the None address, CLOEXEC, or signal/concurrency behavior. Their existing expected-failure markers are intentionally unchanged until exact hosted results establish whether they pass. This can produce an unexpected pass in CI. AES tests also exercise sendmsg_afalg, whose behavior is outside this change.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Assisted-by: OpenAI Codex:model version not exposed
coderabbitai
Bot
commented
Nov 3, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 40 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used all 10 included reviews currently available.
Learn how review limits work.
Review configuration:
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 18fc82b and a5acdf3.
Files ignored due to path filters: 1
-
Lib/test/test_socket.py is excluded by !Lib/**
Files selected for processing: 1
-
crates/stdlib/src/socket.rs
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 3, 2026
The five LinuxKernelCryptoAPI tests passed twice in the hosted Ubuntu job for the AF_ALG accept fix. Remove their obsolete markers through update_lib, preserving all test bodies and platform guards.
Assisted-by: OpenAI Codex:model version not exposed
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-11-04T01:27:34.829323Z |
a5acdf3 |
Draft marked ready |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5acdf3886
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
# bpo-31705: On kernel older than 4.5, sendto() failed with ENOKEY,
|
|
|
# at least on ppc64le architecture
|
|
|
@unittest.expectedFailure # TODO: RUSTPYTHON; - AF_ALG not fully implemented
|
|
|
@support.requires_linux_version(4, 5)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retain expected failures on the unfixed Android target
On Android builds where AF_ALG socket creation is permitted, _have_socket_alg() enables this class, but AF_ALG address parsing remains gated to target_os = "linux" in crates/stdlib/src/socket.rs:1765–1766. Consequently, create_alg() still fails at bind() with OSError: bind(): bad family, and removing these decorators converts expected failures into test errors without fixing Android's implementation. Preserve conditional expected failures for that target; AGENTS.md permits removing these annotations only when the tests actually pass.
AGENTS.md reference: AGENTS.md:L280-L281
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
📦 Library Dependencies
The following Lib/ modules were modified. Here are their dependencies:
[x] lib: cpython/Lib/socket.py
[x] test: cpython/Lib/test/test_socket.py
dependencies:
dependent tests: (116 tests)
- socket: test_asyncio test_epoll test_exception_hierarchy test_external_inspection test_ftplib test_httplib test_httpservers test_imaplib test_io test_kqueue test_logging test_mailbox test_mmap test_os test_pathlib test_poplib test_pty test_remote_pdb test_selectors test_signal test_smtplib test_smtpnet test_socket test_socketserver test_ssl test_stat test_subprocess test_support test_sys test_timeout test_urllib test_urllib2 test_urllib2net test_urllib_response test_urllibnet test_xmlrpc
- asyncio: test_asyncio test_concurrent_futures test_inspect test_pdb test_unittest
- email.utils: test_email
- http.server: test_robotparser test_urllib2_localnet
- logging.handlers: test_concurrent_futures test_pkgutil
- urllib.request: test_http_cookiejar test_pydoc test_sax test_site
- http.client: test_docxmlrpc test_hashlib test_ucn test_unicodedata test_wsgiref
- http.server:
- mailbox: test_genericalias
- multiprocessing: test_compileall test_concurrent_futures test_fcntl test_importlib test_memoryview test_multiprocessing_forkserver test_multiprocessing_main_handling test_profiling test_re
- concurrent.futures.process: test_concurrent_futures
- platform: test__locale test__osx_support test_android test_baseexception test_builtin test_calendar test_cmath test_ctypes test_math test_mimetypes test_os test_platform test_regrtest test_shutil test_startfile test_strptime test_sysconfig test_time test_tkinter test_winreg
- profiling.sampling.gecko_collector: test_profiling
- profiling.sampling.heatmap_collector: test_profiling
- uuid: test_free_threading test_os
- profiling.sampling.cli: test_profiling
- ssl: test_venv
- urllib.request:
- pathlib: test_ast test_dbm_sqlite3 test_ensurepip test_importlib test_json test_launcher test_netrc test_pathlib test_peg_generator test_pyrepl test_runpy test_tarfile test_tempfile test_tomllib test_tools test_traceback test_unparse test_winapi test_zipapp test_zipfile test_zoneinfo test_zstd
- uuid:
Legend:
[+] path exists in CPython
[x] up-to-date, [ ] outdated
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|