Conversation
dfs cannot follow a symlink whose value is absolute (EINVAL since DAOS-19630), nor one whose relative value climbs more than one level with ".." (ENOTSUP): the first needs the process root, the second the ancestry of the link. In a non-leaf position the error came out of the parent walk in query_path() with no parent record, so the application saw EINVAL or ENOTSUP where the kernel resolves the path correctly through dfuse. Treat both errors from the parent walk, in query_path() and in resolve_dot_dot(), as "not handled by pil4dfs" so the libc function runs, and extend the leaf probe in need_kernel_to_resolve() to ENOTSUP. Drop root_symlink_escapes(): with the uniform EINVAL from dfs the root-level case is covered by the existing leaf probe. Add tests for an absolute directory link in a subdirectory and in the container root, each shadowed by an in-container copy of the target path, and for "..", "../../x" and "../../d/x" values as leaf and non-leaf components, inside and out of the container. Features: pil4dfs Signed-off-by: Mohamad Chaarawi <mohamad.chaarawi@hpe.com>
|
Ticket title is 'pil4dfs: an absolute symlink in a non-leaf position of a path fails with EINVAL instead of being handed to the kernel' |
wangshilong
reviewed
Sep 20, 2026
| * that a chain such as python3 -> python -> /usr/bin/python3.x is caught as well. | ||
| */ | ||
| static bool | ||
| root_symlink_escapes(struct dfs_mt *dfs_mt, struct dcache_rec *parent, const char *item_name, |
Contributor
There was a problem hiding this comment.
This seems to miss the O_NOFOLLOW case.
For a root symlink such as:
python -> /usr/bin/python3
open("python", O_RDONLY | O_NOFOLLOW) must fail with ELOOP . after removing root_symlink_escapes() , dfs_lookup_rel(..., O_NOFOLLOW, ...) may successfully return the symlink itself, so the error-based kernel fallback is not triggered.
Could we preserve the kernel fallback for this flag combination, and add a regression test that verifies O_NOFOLLOW returns ELOOP ?
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.
dfs cannot follow a symlink whose value is absolute (EINVAL since DAOS-19630), nor one whose relative value climbs more than one level with ".." (ENOTSUP): the first needs the process root, the second the ancestry of the link. In a non-leaf position the error came out of the parent walk in query_path() with no parent record, so the application saw EINVAL or ENOTSUP where the kernel resolves the path correctly through dfuse.
Treat both errors from the parent walk, in query_path() and in resolve_dot_dot(), as "not handled by pil4dfs" so the libc function runs, and extend the leaf probe in need_kernel_to_resolve() to ENOTSUP. Drop root_symlink_escapes(): with the uniform EINVAL from dfs the root-level case is covered by the existing leaf probe.
Add tests for an absolute directory link in a subdirectory and in the container root, each shadowed by an in-container copy of the target path, and for "..", "../../x" and "../../d/x" values as leaf and non-leaf components, inside and out of the container.
Features: pil4dfs
Steps for the author:
After all prior steps are complete: