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

Document behavior when updating a tracee's cwd #31

Open
oxr463 opened this issue Jun 30, 2021 · 1 comment
Open

Document behavior when updating a tracee's cwd #31

oxr463 opened this issue Jun 30, 2021 · 1 comment
Assignees

Comments

@oxr463
Copy link
Contributor

oxr463 commented Jun 30, 2021

It's worth mentioning that, in the process of translating rename(), I found that the original proot also changed tracee's cwd.
https://github.com/proot-me/proot/blob/7ac33878f95237401b9759db853a6b8c37899675/src/syscall/exit.c#L296
Specifically, if the path being rename() is the same as current tracee's cwd, then it will update the current tracee's cwd filed to the new path.

I think this is something similar to "what happens when you move an open file". The handling in orignal proot is a very hack method (that is, updating the cwd after rename() syscall ), so I'm not implementing it in proot-rs at the moment, just leaving a TODO marker here.

It tries to emulate a phenomenon in the Linux filesystem. But I think it's hacky for several reasons.

  1. it may conflict with the --bind function of proot-rs in some cases. For example, if /foo is bound to /bar and tracee's cwd is "/bar", it won't sense rename("/foo", "/foo2") because "/foo" is not a cwd prefix. So this hack will be bypassed.
  2. In addition, in the original proot only the cwd of the tracee calling rename() is checked. However, it is possible that one tracee's rename() modifies the prefix of another tracee's cwd, but is not sensed by proot.

Yes, but I haven't actually found a document that defines this behavior so far, not in lwn, and seemingly not in POSIX. So I think we can let it go for now.

@oxr463 oxr463 added this to the v0.0.1 milestone Jun 30, 2021
@oxr463
Copy link
Contributor Author

oxr463 commented Jun 30, 2021

See also: proot-me/proot#211

@oxr463 oxr463 removed this from the v0.0.1 milestone Aug 10, 2021
@imlk0 imlk0 added this to the v0.0.1 milestone Aug 11, 2021
@oxr463 oxr463 removed this from the v0.1.0 milestone Aug 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants