add support for user specified environment variables in minijail |
||
Issue descriptionPrograms run with minijail might need environment variables to be set on startup. For example, the HOME variable can be configured to point to the correct directory inside a pivot root. Another example would be setting LD_PRELOAD to override a C library call. This cannot be done in minijail currently because it simply passes environ to execve, meaning the set of environment variables configured before running minijail will be exactly the same as the set of environment variables visible to the program.
,
Jul 20 2016
Apologies, I obviously wasn't clear enough on the CL. Can you describe the current situation that's prompting you to need this change?
,
Jul 26 2016
We have a program that we want to run inside a container that requires write access to USB devices. Our program inside the container will be running as non-root, which means it won't have permissions to open a device with O_RDWR permissions. Our solution to this is to have a preload library that will override the open library call by introducing communication with a service that's running outside the container which can retrieve the file descriptor by forwarding the request to the existing permission broker service. So we need the LD_PRELOAD environment variable to be configured before the program executes but without affecting the parent process's environment.
,
Aug 4 2016
And this program cannot be modified? And if it cannot be modified, isn't it easier to wrap it in a script that sets the env variable rather than adding a bunch of code to Minijail? Have you guys tried that? Does it work?
,
Aug 4 2016
Any program we would need this for would be mounted read-only from a squashfs file, and we would in many cases not be the owner of the program. So we would neither be able to modify the program nor create a script that sets the environment variables.
,
Aug 4 2016
Why can't you include the script in the same squashfs filesystem? wrap_executable.sh #!/bin/bash LD_PRELOAD=/path/to/library_wrapper.so /path/to/executable If Minijail can be used to launch /path/to/executable, it can be used to launch /path/to/wrap_executable.sh. Am I missing something?
,
Aug 4 2016
To clarify, I want to avoid adding a hundred lines of code to Minijail for literally a one-off case. This code will then have to be maintained forever after. If we can't change the binary nor wrap the binary, then we can add stuff to Minijail.
,
Jun 21 2018
|
||
►
Sign in to add a comment |
||
Comment 1 by ashishgaurav@chromium.org
, Jul 18 2016