From d106d9f871c957286ccdeb79c1c2a5ed41f859a6 Mon Sep 17 00:00:00 2001 From: David Sehr Date: Tue, 16 Aug 2016 19:22:57 -0700 Subject: Save environment snapshot and use at fork/exec Some applications may inadvertently or maliciously set of environment variables such as LD_LIBRARY_PATH before spawning subprocesses. To make this more difficult, save the environment at the time the runtime starts and use the saved copy anytime Exec is called. BUG: 30160149 TEST: make test-art-{host,target} Change-Id: I887b78bdb21ab20855636a96da14a74c767bbfef --- runtime/utils.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/utils.h') diff --git a/runtime/utils.h b/runtime/utils.h index 693e0b87ee..843349277d 100644 --- a/runtime/utils.h +++ b/runtime/utils.h @@ -269,6 +269,9 @@ bool GetDalvikCacheFilename(const char* file_location, const char* cache_locatio std::string GetSystemImageFilename(const char* location, InstructionSet isa); // Wrapper on fork/execv to run a command in a subprocess. +// Both of these spawn child processes using the environment as it was set when the single instance +// of the runtime (Runtime::Current()) was started. If no instance of the runtime was started, it +// will use the current environment settings. bool Exec(std::vector& arg_vector, std::string* error_msg); int ExecAndReturnCode(std::vector& arg_vector, std::string* error_msg); -- cgit v1.2.3-59-g8ed1b