-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Proper emulation of magic symlinks (e.g. in procfs) #1872
Comments
In particular, this code does it: gramine/libos/src/fs/proc/thread.c Lines 273 to 293 in b7ffa83
However, there is no inode information, just a hard-coded
I am afraid we'll have to introduce proper dentry objects for these (well, without any real path, but still pointing to a valid inode). Otherwise this will become full of special cases. At the same time, this will probably a big change, and I'd say it's not worth it unless we have a real app (that cannot circumvent this limitation). |
I take my words back. We already have such an application, and it is Bash: #1267 So maybe implementing it should be a higher priority. |
Description of the problem
Some symlinks on Linux FS are not really symlinks, and we have to emulate that properly.
Example: a pipe in
/proc/self/fd/XX
pretends to be a symlink (file type isS_IFLNK
), but readlink returns a string in form ofpipe:[29335264]
. Despite this, it's still possible to open this file on Linux, but following it as a symlink is impossible.Currently in Gramine we return those weird strings via
readlink()
, but when trying to open them our path resolver tries to follow them, thus failing to open the file.We probably need a new type of dentry for these fake links, or some special flag which would prevent the path resolver from following them.
// This is a split-out from #1267.
Steps to reproduce
Run
cat some_file | cat /proc/self/fd/0
in Bash under Gramine.Expected results
<some_file contents>
Actual results
cat: /proc/self/fd/0: No such file or directory
printed to stderr.Gramine commit hash
64cd864
The text was updated successfully, but these errors were encountered: