feat(libkernel): follow FreeBSD for SO_ACCEPTFILTER on a listening socket #14756
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14756"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by kallmek3nny on 2026-11-01T17:43:57Z.
What
On a listening socket,
setsockoptandgetsockoptofSO_ACCEPTFILTER(0x1000) threwNotImplemented_nid_no_patch. They now follow FreeBSD 11.4 (8c639945a4, the revision the libkernel debt entries already cite) in every case that does not depend on which accept filters the kernel registers:setsockoptwith a NULL value returns 0, asdo_setopt_accept_filterdoes on a listener when it removes the filter. No filter can be attached here, so there is nothing to detach.setsockoptwith a value shorter than the 256-bytestruct accept_filter_argfails withEINVAL, assooptcopyindoes whensopt_valsizeis below its minimum length.getsockoptfails withEINVALand leaves the buffer and its length unchanged, asdo_getopt_accept_filterdoes whenSO_ACCEPTFILTERis not set; a filter is never installed here.setsockoptthat names a filter still throws: the filters a PS5 kernel registers are not known, so whether it attaches one or returnsENOENTis open.The
EINVALresults on a socket that is not listening are unchanged (measured on a PS5, firmware 13.60). The listener cases above are not measured on a PS5. Thegetsockopt, setsockoptentry indocs/dev/debt/libkernel.mdis cut to what stays open.AcceptFilterFollowsFreeBsdincore/libs/tests/GuestSocketOptions.cppchecks each case above and a NULL-value set on a socket that is not listening.Overlap: no open PR implements
SO_ACCEPTFILTER.tools/pr_overlap.pylists #14183 because it rewrites the neighbouring debt entry (socket error numbers, line 281); the two changes don't depend on each other, but whichever merges second needs a rebase of that debt line. It could not compare 40 PRs that conflict withmain; each of their diffs (for #5021, which is over GitHub's 300-file diff limit, its per-file patches) was searched foracceptfilter/accept_filter, and none changes it. #14212 only adds blank lines around this entry. #12688, #12700 and #12965 changeSocketOptions.cpponly in one hunk ofSetSocketLevelOptionat line 214, away from the accept-filter branch.Tested
Windows 11 Home 10.0.26300.9711, Git Bash, WinLibs gcc/g++, Ninja, Release. No title or homebrew; the guest socket-option tests only.
e450145140, before the branch was cut:git submodule update --init --recursive --jobs 8,cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_TESTING=ON -DPython3_EXECUTABLE=C:/Python314/python.exe,cmake --build build --parallel 4: exit 0.f2d874c1fd):cmake --build build --target guest_socket_options_tests --parallel 4rebuiltSocketOptions.cppandGuestSocketOptions.cppand relinkedlibkernel.prxandguest_socket_options_tests.exe: exit 0.ctest --test-dir build -R guest_socket_options --output-on-failure: 2/2 passed (guest_socket_options,guest_socket_options_multicast). Rerun after the last amend, which only shortened the debt entry: ninja had no work to do, 2/2 passed (0.77 s and 0.08 s).python tools/check_conventions.py --base origin/main: All conventions checks passed.python tools/pr_overlap.py --branch feat/libkernel-accept-filter: exit 2, as it fails closed when it cannot compare every PR; the manual comparison is under What.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T19:49:51Z.
Review: COMMENTED
Reviewed — no blocking findings
SO_ACCEPTFILTERon a non-listening socket, on a listener with a NULL value, and on a short argument now return the errors the new test expects, and a failed get leaves the caller's buffer unchanged. Approval is not given because the Linux and relinker jobs were skipped by the workflow.What I ran
8f54a85c1cdd9810bc64d8cc765c603f97c94aa4; basef2d874c1fd(merge base is the same commit). 3 files, +25/-3:libkernel/Socket/src/SocketOptions.cpp(4/2),core/libs/tests/GuestSocketOptions.cpp(20/0), anddocs/dev/debt/libkernel.md(1/1). I read the whole diff.SetSocketLevelOptionreturnsErrorInvalidfor a socket that is not listening before it looks at the value (lines 175-185); on a listener a NULL value returns 0, and a value shorter than the 256-byteaccept_filter_argreturnsErrorInvalid.GetSocketLevelOptionnow returnsErrorInvalidon a listener before writing anything (lines 291-296), so the buffer and its length stay unchanged.do_setopt_accept_filteranddo_getopt_accept_filter), and that a set naming a filter still throws.Results
Commands and unedited precheck output
Commands:
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14756 --output-dir <scratch>/precheck/14756(report.md in that directory).git fetch https://github.com/boykopovar/AnyPS5.git pull/14756/head.gh api repos/boykopovar/AnyPS5/commits/8f54a85c1cdd9810bc64d8cc765c603f97c94aa4/check-runs.Precheck table (unedited):
The precheck deliberately does not configure, build, or compile AnyPS5.git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...8f54a85c1cdd9810bc64d8cc765c603f97c94aa4/marc/Conlyse-VIEJO/.venv/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 8f54a85c1cdd9810bc64d8cc765c603f97c94aa4 --title feat(libkernel): follow FreeBSD for SO_ACCEPTFILTER on a listening socket --body /dev/shm/reviewer-run/precheck/14756/pr-body.md/marc/Conlyse-VIEJO/.venv/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 8f54a85c1cdd9810bc64d8cc765c603f97c94aa4 --jsonNo changed Python implementation files.No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.No changed test_*.py files./marc/Conlyse-VIEJO/.venv/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14756 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14756/stackNot run: C++ tests need exact-head binaries, which require a build; the precheck does not build./marc/Conlyse-VIEJO/.venv/bin/python3 /dev/shm/reviewer-run/precheck/14756/head-8f54a85c1cdd-eb14481b/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14756/head-8f54a85c1cdd-eb14481b --json core/libs/prx/libkernel/Socket/src/SocketOptions.cpp core/libs/tests/GuestSocketOptions.cpp docs/dev/debt/libkernel.mdNo changed Python test module in tools/ can be run as a no-build base-source control.Negative control
Not run here. The socket tests need a build.
Findings
Blocking
None.
Non-blocking
Sources
github.com/boykopovar/AnyPS5@8f54a85c1c/core/libs/prx/libkernel/Socket/src/SocketOptions.cpp (L175-L185)and #L291-L296github.com/boykopovar/AnyPS5@8f54a85c1c/core/libs/tests/GuestSocketOptions.cppgithub.com/boykopovar/AnyPS5@8f54a85c1c/docs/dev/debt/libkernel.mdNot verified
To get this to a good state