proot icon indicating copy to clipboard operation
proot copied to clipboard

setting empty string environment variable cause trouble when parsing /proc/self/environ

Open mickael-guene opened this issue 9 years ago • 0 comments

When the following condition are met :

  • we launch a foreign binary and so we use qemu or umeq
  • LD_LIBRARY_PATH is export in guest environment

Then ldso_env_passthru() empty original LD_LIBRARY_PATH env definition by writing an empty string (write_xpointee(envp, i, "");) and add -E LD_LIBRARY_PATH=... in qemu/umeq argument list.

Unfortunatly this define an environment variable which is equal to empty string. So program that parse /proc/self/environ will detect this empty string as the end of environment variable list. So such program will miss some environment variable which may lead to malfunction.

Typical example is libsanitizer. See GetEnv() function in sanitizer_linux.cc.

mickael-guene avatar May 12 '15 06:05 mickael-guene