Repository navigation
Conversation
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #541 (the
AF_ALGitem). This is the fourth PR of the item, after #699, #703 and #709. LTP af_alg07 failed after #703, and this PR fixes it.What this does
new_filein net/rk-net/src/lib.rs takes the owner.socket,socketpair,acceptand the other callers give the file system user and group IDs of the caller, assock_allocof Linux. The mode is 0777.fstatgives the owner, the group and the mode of the inode.rk_net::SockInodeis the inode of a socket file for a change of its attributes. It holds a weak reference, so it does not keep the socket open.set_attrchanges the mode, the owner and the group, assockfs_setattrof Linux.ENOENT, as Linux after CVE-2019-8912. A change of the mode has no effect.fchmod,fchownandfchownatorutimensatwithAT_EMPTY_PATHon a socket go toset_attr_sockin core/rk-syscall/src/fs.rs. It does the checks ofnotify_change(setattr_prepareand the kill of the set-ID bits on a change of the owner) and then callsset_attr.AT_EMPTY_PATH, the path lookup of Linux holds the inode and not the file. So the file reference goes before the checks. If another thread closes the last descriptor in the meantime, the socket closes and the change of the owner givesENOENT. LTP af_alg07 makes this race withdup2and wantsENOENTor success, never a use after free.Tests
cargo fmt --all --check, andcargo clippy --all-targetsfor rk-net, rk-syscall and xtask: no errors. The warnings are in files that this PR does not change.cargo testfor rk-net (130 tests), rk-syscall and xtask: ok, with a time limit of 900 s.socket_inode_attributesof net/rk-net/src/tests.rs: the owner and the mode of a new socket file, a change of the owner and the mode, andENOENTfor a change of the owner after the file goes.cryptoon x86_64 (server1, load 0.2) and arm64 (server2, load 15 to 18), with a kernel that had the change of this PR on AF_ALG: the skcipher sockets #709:crypto.af_alg_restrict.NETLINK_CRYPTOis not there. The x86_64 LTP build does not have them.Load averages on server2 during the build and the tests: 14 to 22.
The full gate did not run.