Repository navigation
fix(inode): bound symlink target reads - #5262
singh4jitendra wants to merge 1 commit into
Conversation
Limit standard target reads to the platform pathname boundary and reject oversized standard or legacy targets without retaining unusable content. Cover the exact boundary, stale size metadata, bounded consumption and reader cleanup.
There was a problem hiding this comment.
Code Review
This pull request introduces size limits on symlink targets to ensure they fit within the platform's pathname limit (4095 bytes on Linux), returning ENAMETOOLONG for longer targets. It bounds standard symlink target reads using io.LimitReader and validates legacy symlink target lengths. Additionally, it updates the documentation and adds comprehensive unit tests to verify these boundaries. I have no feedback to provide as the implementation is clean and well-tested.
|
Hi @kislaykishore, could you help get CI running for this symlink-target limit fix and take a look when you have a chance? Let me know if there's anything you'd like changed. Thanks! |
|
Hi @kislaykishore, could you help approve CI and review the symlink-target bounds when you have a moment? Happy to address any feedback. Thanks! |
|
Hi @kislaykishore, could you take a look at the symlink-target limit fix when you have time? Thanks! |
Description
A standard symlink target is stored in object contents. We currently read all of it even though the kernel cannot use a target longer than its pathname limit.
This bounds the read, rejects oversized standard and legacy targets with
ENAMETOOLONG, and keeps the valid boundary working. The tests use small fake objects, including a response larger than the reported metadata size. This complements the symlink opt-out in #5254.Link to the issue in case of a bug fix.
Fixes #5260
Testing details
Go 1.27.4 on Ubuntu 24.04 under WSL.
make build- passed with0lint issues.go test -mod=readonly -p 1 -count=1 -timeout=90s -run '^TestSymlinkTarget(ReadIsBounded|LengthBoundaries)$' ./internal/fs/inode- failed as expected before the fix.go test -mod=readonly -p 1 -count=1 -race -timeout=3m ./internal/fs/inode ./internal/fs/wrappers- passed on native Linux storage.PATH_MAXbytes to be consumed.Any backward incompatible change? If so, please explain.
Targets at or above
PATH_MAXnow returnENAMETOOLONG; these exceed the platform's supported target length. Normal standard/legacy targets, including the valid boundary, keep working.