]> git.ipfire.org Git - thirdparty/lxc.git/commit
rexec: remove envp parsing in favour of environ 2852/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Feb 2019 13:48:41 +0000 (14:48 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Feb 2019 15:10:07 +0000 (16:10 +0100)
commitcee55b59cd0f7446bae25d02bcd23805ce43aaa4
tree04de37ac664245da99a400df10594e2323a631dc
parent7a80606d7b3e31516d3cb223c899be25e67cbc0d
rexec: remove envp parsing in favour of environ

My first attempt to simplify this and make it less costly focussed on
the way constructors are called. I was under the impression that the ELF
specification mandated that arg, argv, and actually even envp need to be
passed to functions located in the .init_array section (aka
"constructors"). Actually, the specifications is (cf. [2]):

SHT_INIT_ARRAY
This section contains an array of pointers to initialization functions,
as described in ``Initialization and Termination Functions'' in Chapter
5. Each pointer in the array is taken as a parameterless procedure with
a void return.

which means that this becomes a libc specific decision. Glibc passes
down those args, musl doesn't. So this approach can't work. However, we
can at least remove the environment parsing part based on POSIX since
[1] mandates that there should be an environ variable defined in
unistd.h which provides access to the environment. See also the relevant
Open Group specification [1].

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/
[2]: http://www.sco.com/developers/gabi/latest/ch4.sheader.html#init_array

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/rexec.c