Comments (8)
Do you mean mounting the host proc file system to /proc in the library OS? I will strongly suggest not to do so. The proc file system is a pseudo file system which should reflect the OS states. The library OS has its own OS states so should only run its own proc file system.
from graphene.
But how to read the proc files of the library OS? There are no proc files in libOS if I don't mount th proc files of host system.
from graphene.
There is a simple proc file system in Graphene.
Graphene/LibOS/shim/test/native$ ./pal ls.manifest /proc
1
cpuinfo
meminfo
self
If you need a specific file in proc but Graphene hasn't implement it yet, you can try to mount only that file into graphene. Like this:
fs.mount.bin.type = chroot
fs.mount.bin.path = /proc/stat
fs.mount.bin.uri = file:/proc/stat
from graphene.
I tried this:
fs.mount.stat.type = chroot
fs.mount.stat.path = /proc/stat
fs.mount.stat.uri = file:/proc/stat
and my python code like this:
import sys
import os
#print sys.modules['psutil']
for filename in os.listdir(r'/proc'):
print filename
and the output:
meminfo
self
1
cpuinfo
It still cannot find the 'stat'
And I tried to read the /proc/stat directly , like this:
f=open('/proc/stat', 'rb')
values = f.readline()
print values
It should read the info of CPU time but the output is a blank line
So I think the /proc/stat in LibOS is empty. It's confusing.
from graphene.
Graphene currently does not implement /proc/stat within the libOS. I am curious why you need it? If there is an application that requires this information, it would not be hard to add (although some fields would either need to be bogus, or would need a host ABI to expose correctly). In general, we have added /proc files "on demand", or when we hit an application that we want to support that requires a given interface.
What you are doing with this manifest entry is creating a passthrough to the host /proc/stat, which might be ok, but it doesn't sound like what you want.
from graphene.
Hi, sorry to intrude on this but I have a question. You said that
fs.mount.stat.type = chroot
fs.mount.stat.path = /proc/stat
fs.mount.stat.uri = file:/proc/stat
creates a pass-through to the host's /proc/stat file. But that does not seem to be the case when I
try the same. It gives me an empty file. Is that expected behavior?
For clarification, I am trying to do something of the sort:
int fd = open("/proc/stat", O_RDONLY);
if (fd < 0) {
printf("File could not be opened\n");
return -1;
}
printf("File opened successfully\n");
char buf[1024];
int ret = read(fd, buf, 10);
if (ret == 0) {
printf("Buffer size is zero (0)\n");
return -1;
}
from graphene.
I suspect the issue is that /proc/stat reports its size as zero bytes, and graphene is checking this size before trying to read more bytes.
On my system:
$ ls -l /proc/stat -r--r--r-- 1 root root 0 Jun 19 22:17 /proc/stat
If there is a good reason to add /proc/stat, we can put this on the feature list, either for graphene-internal emulation or as a host pass-through.
from graphene.
Already fixed on master. Host passthrough of procfs is wrong and unsupported, but we now have a proper emulation for procfs inside Graphene.
from graphene.
Related Issues (20)
- Data transmission error with Python gRPC running in graphene HOT 9
- Huge performance drop when running pytorch training with graphene-sgx HOT 26
- Graphene-SGX: Syscalls wakes up early/prematurely on Server Machines HOT 12
- untrusted PAL sent PAL event HOT 10
- BUG() triggered during vfork and clone HOT 15
- With Go program, inside a docker container, bind fails with permission denied error, invalid handle error. HOT 7
- Workloads (Redis, Curl, R) failing with Out of memory PAL error after new manifest syntax to define lists of SGX trusted files. HOT 7
- Unable to Sign the graphenized Docker image using gsc sign-image: HOT 5
- RFC: Trusted files metadata sideloading
- [Error:38]Function not implemented. multiprocessing in graphene HOT 7
- How to transmit variables between SGX and untrusted environments HOT 4
- Function not implemented (src/ip.cpp:563) in testing GSC container HOT 2
- [Examples] Python Example Stuck Without Any Error Message HOT 1
- ModuleNotFoundError: No module named 'graphenelibos' HOT 5
- web server use golang, QPS(queries per second) is very low HOT 4
- File Listener Based on INOTIFY Throws Error HOT 1
- Issue with libprotobuf version. HOT 1
- Issue in Cloud Deployment to AKS HOT 3
- Decimal type prone to float rounding error. HOT 1
- pytorch sample config for better performance HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphene.