Add namespace contexts
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 12 Feb 2019 14:43:24 +0000 (09:43 -0500)
committerMichael Jeanson <mjeanson@efficios.com>
Wed, 10 Apr 2019 21:25:28 +0000 (17:25 -0400)
commit45b27d781ac59386fbb88ad92fb57de115327af6
tree0ec2038903d91f1fa4561bba77d93bda6569a535
parent1b7b9c650ebb94358365512199559b0ece3e657c
Add namespace contexts

Add a context for each available kernel namespace which currently are :
cgroup, ipc, mnt, net, pid, user and uts. The id chosen to identify the
namespaces is the inode number of the file representing each one of them
in the proc filesystem. This was instroduced in v3.8.0 in this commit :

  commit 98f842e675f96ffac96e6c50315790912b2812be
  Author: Eric W. Biederman <ebiederm@xmission.com>
  Date:   Wed Jun 15 10:21:48 2011 -0700

    proc: Usable inode numbers for the namespace file descriptors.

    Assign a unique proc inode to each namespace, and use that
    inode number to ensure we only allocate at most one proc
    inode for every namespace in proc.

    A single proc inode per namespace allows userspace to test
    to see if two processes are in the same namespace.

    ...

Prior to this there is no unique identifier for a namespace that is
available to both the kernel and userspace. Enabling any of these
contexts on a kernel that is too old or doesn't have the proper features
enabled will fail and return -ENOSYS.

Per namespace particularities :

  - Cgroup
    - Introduced in 4.6.0
    - CONFIG_CGROUPS

  - IPC
    - Introduced in 2.6.25
    - CONFIG_IPC_NS

  - MNT
    - Introduced in 2.6.20
    - The mnt_namespace struct is defined in a private header

  - NET
    - Introduced in 2.6.24
    - CONFIG_NET_NS

  - PID
    - Introduced in 2.6.20
    - CONFIG_PID_NS

  - User
    - Introduced in 2.6.23
    - CONFIG_USER_NS

  - UTS
    - Introduced in 2.6.19
    - CONFIG_UTS_NS

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
15 files changed:
Kbuild.common
Makefile
instrumentation/events/lttng-module/sched.h
lttng-abi.c
lttng-abi.h
lttng-context-cgroup-ns.c [new file with mode: 0644]
lttng-context-ipc-ns.c [new file with mode: 0644]
lttng-context-mnt-ns.c [new file with mode: 0644]
lttng-context-net-ns.c [new file with mode: 0644]
lttng-context-pid-ns.c [new file with mode: 0644]
lttng-context-user-ns.c [new file with mode: 0644]
lttng-context-uts-ns.c [new file with mode: 0644]
lttng-context.c
lttng-events.h
wrapper/namespace.h [new file with mode: 0644]
This page took 0.027161 seconds and 5 git commands to generate.