gramineproject / graphene

Graphene / Graphene-SGX - a library OS for Linux multi-process applications, with Intel SGX support
https://grapheneproject.io
GNU Lesser General Public License v3.0
769 stars 260 forks source link

[LibOS] Filesystem code needs to be rewritten #1803

Open mkow opened 4 years ago

mkow commented 4 years ago

Description of the problem

Our old filesystem implementation requires complete rewrite.

It's hard to implement any new feature for the filesystem without dealing with this issue first.

Related issues

dimakuv commented 4 years ago

I'd like to note that there is no shared and consistent view of the FS across Graphene processes. For example, a parent Graphene process and a child Graphene process will not see new/deleted files from the other process until they actually go and ask the host FS (recall that Graphene e.g. caches directory contents, so if parent listed the directory, then the child created a file in this directory, and parent lists the directory again, the parent won't see the new file).

However, implementing such a distributed view of the file system sounds quite complicated. I think we can get away with this by just purging all cached FS metadata in Graphene on each fork/exec.

dimakuv commented 4 years ago

One common source of confusion is our chroot semantics of Graphene: people have a hard time wrapping their heads around the concept of chroot jails and just want everything from the host FS to be visible/accessible inside Graphene.

I believe we should implement a "God-like" option in Graphene to bind a single mount point to host's / (something that GSC does already). This way everything is mirrored 1:1. We'll need a couple of exceptions to this rule:

  1. graphene/Runtime/ should take precedence to all other lib search directories.
  2. Stuff like /etc should probably also be possible to redirect.

Basically, we need a way to specify the root dir /, and then "augment" with Graphene-specific directories which take precedence.

mkow commented 4 years ago

I believe we should implement a "God-like" option in Graphene to bind a single mount point to host's /

No, I don't think we should allow this, sounds like a big footgun :) We should allow mounting all paths inside Graphene (including /), but IMO we shouldn't have an option to mount host's / to Graphene.

Ad mounting you described: IMO we should have Linux-like semantics of mounts, that you can stack them and we'll just execute the mount commands from the manifest one by one. This should allow for all possible configurations we may ever need.

dimakuv commented 3 years ago

@pwmarcz It would be good to go through the "master list of issues" again and verify which ones were already fixed/became irrelevant. After this we can close this issue.

I don't want to transfer this issue to the new Gramine repo since it's a meta-issue which is almost completely fixed at this point.