[lxc/lxc] 96294e: execute: don't exec init, call it

0 views
Skip to first unread message

Christian Brauner

unread,
Jun 29, 2021, 10:08:33 AMJun 29
to lxc-...@lists.linuxcontainers.org
Branch: refs/heads/master
Home: https://github.com/lxc/lxc
Commit: 96294efb352d8ac695ce000eb32c6f65a005ea76
https://github.com/lxc/lxc/commit/96294efb352d8ac695ce000eb32c6f65a005ea76
Author: Tycho Andersen <ty...@tycho.pizza>
Date: 2021-06-29 (Tue, 29 Jun 2021)

Changed paths:
M src/lxc/cmd/lxc_init.c
M src/lxc/conf.c
M src/lxc/execute.c
M src/lxc/initutils.c
M src/lxc/initutils.h
M src/lxc/start.h

Log Message:
-----------
execute: don't exec init, call it

Instead of having a statically linked init that we put on the host fs
somewhere via packaging, have to either bind mount in or detect fexecve()
functionality, let's just call it as a library function. This way we don't
have to do any of that.

This also fixes up a bunch of conditions from:

if (quiet)
fprintf(stderr, "log message");

to

if (!quiet)
fprintf(stderr, "log message");

:)

and it drops all the code for fexecve() detection and bind mounting our
init in, since we no longer need any of that.

A couple other thoughts:

* I left the lxc-init binary in since we ship it, so someone could be using
it outside of the internal uses.
* There are lots of unused arguments to lxc-init (including presumably
--quiet, since nobody noticed the above); those may be part of the API
though and so we don't want to drop them.

Signed-off-by: Tycho Andersen <ty...@tycho.pizza>


Commit: d65e5e492f740bbb50e3005f97420c3ddae3d595
https://github.com/lxc/lxc/commit/d65e5e492f740bbb50e3005f97420c3ddae3d595
Author: Christian Brauner <christia...@ubuntu.com>
Date: 2021-06-29 (Tue, 29 Jun 2021)

Changed paths:
M src/lxc/initutils.c

Log Message:
-----------
initutils: use vfork() in lxc_container_init()

We can let the child finish calling exec before continuing in the
parent.

Signed-off-by: Christian Brauner <christia...@ubuntu.com>


Commit: a1150aa174c9b352548fd5273805a680ea6e511a
https://github.com/lxc/lxc/commit/a1150aa174c9b352548fd5273805a680ea6e511a
Author: Christian Brauner <christia...@ubuntu.com>
Date: 2021-06-29 (Tue, 29 Jun 2021)

Changed paths:
M src/lxc/network.c

Log Message:
-----------
network: log network devices while sending

Signed-off-by: Christian Brauner <christia...@ubuntu.com>


Commit: 734a677ed22e8adfbcbc66b30763f9da9279cc39
https://github.com/lxc/lxc/commit/734a677ed22e8adfbcbc66b30763f9da9279cc39
Author: Christian Brauner <christia...@ubuntu.com>
Date: 2021-06-29 (Tue, 29 Jun 2021)

Changed paths:
M src/lxc/conf.h
M src/lxc/initutils.c

Log Message:
-----------
execute: ensure parent is notified about child exec and close all unneeded fds

lxc_container_init() creates the container payload process as it's child
so lxc_container_init() itself never really exits and thus the parent
isn't notified about the child exec'ing since the sync file descriptor
is never closed. Make sure it's closed to notify the parent about the
child's exec.

In addition we're currently leaking all file descriptors associated with
the handler into the stub init. Make sure that all file descriptors
other than stderr are closed.

Signed-off-by: Christian Brauner <christia...@ubuntu.com>


Commit: 804f3e2a1259659fd4e8474a65e6ff0d9828782a
https://github.com/lxc/lxc/commit/804f3e2a1259659fd4e8474a65e6ff0d9828782a
Author: Christian Brauner <christia...@ubuntu.com>
Date: 2021-06-29 (Tue, 29 Jun 2021)

Changed paths:
M src/lxc/cmd/lxc_init.c
M src/lxc/conf.c
M src/lxc/conf.h
M src/lxc/execute.c
M src/lxc/initutils.c
M src/lxc/initutils.h
M src/lxc/network.c
M src/lxc/start.h

Log Message:
-----------
Merge pull request #3885 from tych0/dont-exec-execute

execute: don't exec init, call it


Compare: https://github.com/lxc/lxc/compare/f1c64634c40a...804f3e2a1259
Reply all
Reply to author
Forward
0 new messages