-
Notifications
You must be signed in to change notification settings - Fork 202
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
Env ulimit/prlimit not inherited by Gramine process #1576
Comments
The fact that Gramine just uses some built-in default is definitely a bug. However, I'm not sure that Gramine must get the limits from the untrusted environment. I think a better solution would be to introduce new manifest options, which the app/manifest developer can set to known-to-be-good values, or use a I think we even discussed this with @mkow at some point. The proposed manifest syntax may look like this:
For example, in @thomasknauth case, the manifest will specify:
This is the same to how Gramine specifies environment variables. References:
|
What do you mean? Env variables? That's not how it works on Linux?
We could do that, but why is this needed? Also, the original issue here mixes two independent problems:
|
The limits are inherited between in-Gramine processes, notice the gramine/libos/src/sys/libos_getrlimit.c Line 37 in a60dcf7
Also, I don't think this was an original question.
I think this was the original question.
No, I meant "env" = "the host environment". In case of rlimits, the host information should be queried via the
Sometimes you need to adjust your rlimits on your system, for example, for web servers that have a large number of clients (i.e., large number of opened FDs). On a normal system, you won't rely on the application to do that, instead you as a sysadmin increase the rlimit via e.g. Now run this application under Gramine. It will fail because Gramine will refuse to open an FD, since the in-Gramine rlimit is reached. And the application doesn't know/understand that it needs to increase this limit itself, because typically the apps just rely on the sysadmin to do the job. In Gramine case, we currently don't have this "sysadmin will do this job" (i.e., via |
Even setting the limit from within the application is not guaranteed to work. By the time the app's main() function is reached and a new limit may be set, the app may have already cloned/forked a bunch of processes/threads which will still have the default hard-coded Gramine limit. |
@thomasknauth I can't understand how this flow is possible. Why would the app clone/fork before the |
Pretty much. In our case, it is Rust code using the tokio async runtime. |
For other rlimits, see these issues:
We should also move |
Since it came up again recently, a work around is to set limits and then |
Description of the problem
Gramine has some support for
get/setrlimit()
. Usually, the limits are inherited by a child process. Changing the limit, e.g., a common one is increasing the maximum allowed open files, in a shell session and subsequently invoking Gramine will not have the desired effect.Steps to reproduce
Using the
bash
example fromCI-Examples
, invokeulimit -n 4096 ; gramine-direct ./bash -c 'ulimit -n'
.Expected results
Gramine should pick up the limits from the env. In the above example, it should report 4096.
Actual results
This will report 900 (DEFAULT_MAX_FDS).
Gramine commit hash
gramine/jammy,now 1.5 amd64
The text was updated successfully, but these errors were encountered: