Add namespace contexts
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 12 Feb 2019 14:43:24 +0000 (09:43 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 18 Oct 2019 15:16:22 +0000 (11:16 -0400)
commita6cf40a4491954d6f81052f8bbce757f73727f16
treed3db575f19e721fe24f2c3d3c604a249e07bfacc
parent47491cdffd394f09524657e9be1e90d4bb644f2f
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>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@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.026258 seconds and 4 git commands to generate.