[lxc-devel] [lxc/lxc] 8ab932: namespace: add lxc_raw_clone()

GitHub noreply at github.com
Thu Dec 14 22:29:05 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 8ab93249a05499eb06ed326bc6f4fd4a0e800cbc
      https://github.com/lxc/lxc/commit/8ab93249a05499eb06ed326bc6f4fd4a0e800cbc
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-12-14 (Thu, 14 Dec 2017)

  Changed paths:
    M src/lxc/namespace.c
    M src/lxc/namespace.h
    M src/tests/Makefile.am
    A src/tests/lxc_raw_clone.c

  Log Message:
  -----------
  namespace: add lxc_raw_clone()

This is based on raw_clone in systemd but adapted to our needs. The main reason
is that we need an implementation of fork()/clone() that does guarantee us that
no pthread_atfork() handlers are run. While clone() in glibc currently doesn't
run pthread_atfork() handlers we should be fine but there's no guarantee that
this won't be the case in the future. So let's do the syscall directly - or as
direct as we can. An additional nice feature is that we get fork() behavior,
i.e. lxc_raw_clone() returns 0 in the child and the child pid in the parent.

Our implementation tries to make sure that we cover all cases according to
kernel sources. Note that we are not interested in any arguments that could be
passed after the stack.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: 2d728b2fd66fee867a9c85a183c6db138d8108f0
      https://github.com/lxc/lxc/commit/2d728b2fd66fee867a9c85a183c6db138d8108f0
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2017-12-14 (Thu, 14 Dec 2017)

  Changed paths:
    M src/lxc/utils.c

  Log Message:
  -----------
  utils: use lxc_raw_clone() in run_command()

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>


  Commit: f76d0ecb4732dd62cf216348652cb38beaba8fbc
      https://github.com/lxc/lxc/commit/f76d0ecb4732dd62cf216348652cb38beaba8fbc
  Author: Serge Hallyn <serge at hallyn.com>
  Date:   2017-12-14 (Thu, 14 Dec 2017)

  Changed paths:
    M src/lxc/namespace.c
    M src/lxc/namespace.h
    M src/lxc/utils.c
    M src/tests/Makefile.am
    A src/tests/lxc_raw_clone.c

  Log Message:
  -----------
  Merge pull request #2034 from brauner/2017-12-14/use_clone_in_run_command

utils: use lxc_raw_clone() in run_command()


Compare: https://github.com/lxc/lxc/compare/389c46753ba4...f76d0ecb4732


More information about the lxc-devel mailing list