gramineproject / gramine

A library OS for Linux multi-process applications, with Intel SGX support
GNU Lesser General Public License v3.0
587 stars 193 forks source link

[LibOS] Fix `ENOENT` error in `fchown` on unlinked file #1875

Closed dimakuv closed 3 months ago

dimakuv commented 4 months ago

Description of the changes

This is conceptually similar to the commit "[LibOS] Fix ENOENT error in fchmod on unlinked file".

This PR was created while reviewing #1874.

How to test this PR?

Added a sub-test to the rename_unlink LibOS regression test.

If you want to run this sub-test on vanilla Linux, change UID and GID in fchown() to some reasonable IDs available on your system.


This change is Reviewable

g2flyer commented 4 months ago

This fails when run natively, could you change this test somehow so that it also works natively? It would make it easier to verify whether everything in Gramine works exactly as on Linux.

In my original version from that did run natively as long as you run it as root (i actually had also a corresponding comment) and i think that is somewhat unavoidable. I've used different ids but i think it still works with 123, the ids do not necessarily have to exist in /etc/passwd et al for it to work.

g2flyer commented 4 months ago

In the future we'd like to run these tests in CI also natively, and that requirement would prevent this. It should be possible to change it, maybe chown() to the current user? (no-op, but should still trigger all the logic).

We don't run CI containerized? Otherwise running as "root" is not really a problem? Using your own id (and essentially not changing the ids) wouldn't really work, e.g., in test_rename_fchown_fchmod to detect all potential issues? In particular, i don't think you would have detected the original bug?

dimakuv commented 3 months ago

Jenkins, retest Jenkins-SGX-22.04 please

dimakuv commented 3 months ago

Jenkins, retest Jenkins-SGX-24.04 please