Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resolve_path infinite loop #76

Merged

Conversation

fischerling
Copy link
Contributor

As mentioned in #75, this reverts the change in vfs_open and fixed the recursive vfs_open call in resolve_path.

Afterwards both

$ cat README
$ cat /home/user/README

work fine.

Revert vfs_open change of "In vfs_open, if the given path is an absolute
one, do not try to resolve it, or we end up in an infinite loop of calls."
In 0c398e3 I changed the path
resolution to not open all encountered path components, because
directories do not need to be readable by the process to traverse them.

Out of simplicity I erroneously changed the reading of the links from
using the already opened path component to sys_readlink, which internally
calls vfs_open causing an infinite loop.

This is fixed by opening the link to read using vfs_open_abspath
before calling vfs_readlink instead of sys_readlink to replace the
current path component.

Fixes: 0c398e3
@Galfurian Galfurian merged commit 9d6764c into mentos-team:develop Apr 5, 2024
18 checks passed
@Galfurian
Copy link
Member

Thank you very much, this is surely a cleaner solution.

@Galfurian Galfurian added the bug Something isn't working label Apr 5, 2024
Galfurian added a commit that referenced this pull request Apr 5, 2024
Include pull request #76.
@fischerling fischerling deleted the fix-resolve-infinite-loop branch July 20, 2024 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants