RFC: Add namespace contexts
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 RFC: 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 fd representing each of them in the proc filesystem. This was instroduced in v3.8.0 in this commit :
commit 98f842e675f96ffac96e6c50315790912b2812be
Author: Eric W. Biederman <[email protected]>
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.
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
--- Kbuild.common | 5 ++ Makefile | 26 +++++++ instrumentation/events/lttng-module/sched.h | 11 +-- lttng-abi.c | 14 ++++ lttng-abi.h | 7 ++ lttng-context-cgroup-ns.c | 113 ++++++++++++++++++++++++++++ lttng-context-ipc-ns.c | 110 +++++++++++++++++++++++++++ lttng-context-mnt-ns.c | 111 +++++++++++++++++++++++++++ lttng-context-net-ns.c | 110 +++++++++++++++++++++++++++ lttng-context-pid-ns.c | 106 ++++++++++++++++++++++++++ lttng-context-user-ns.c | 98 ++++++++++++++++++++++++ lttng-context-uts-ns.c | 110 +++++++++++++++++++++++++++ lttng-context.c | 28 +++++++ lttng-events.h | 79 +++++++++++++++++++ wrapper/namespace.h | 33 ++++++++ 15 files changed, 953 insertions(+), 8 deletions(-) create mode 100644 lttng-context-cgroup-ns.c create mode 100644 lttng-context-ipc-ns.c create mode 100644 lttng-context-mnt-ns.c create mode 100644 lttng-context-net-ns.c create mode 100644 lttng-context-pid-ns.c create mode 100644 lttng-context-user-ns.c create mode 100644 lttng-context-uts-ns.c create mode 100644 wrapper/namespace.h
Kbuild.common +5 -0
@@ -55,4 +55,9 @@ ifneq ($(CONFIG_DYNAMIC_FTRACE),) endif endif +mnt_ns_dep = $(srctree)/fs/mount.h +ifeq ($(wildcard $(mnt_ns_dep)),) + ccflags-y += -DLTTNG_MNT_NS_MISSING_HEADER +endif + # vim:syntax=make
Makefile +26 -0
@@ -87,6 +87,32 @@ ifneq ($(KERNELRELEASE),) -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 15 \) ] ; then \ echo "lttng-tracepoint.o" ; fi;) + lttng-tracer-objs += lttng-context-cgroup-ns.o + + ifneq ($(CONFIG_IPC_NS),) + lttng-tracer-objs += lttng-context-ipc-ns.o + endif + + ifneq ($(wildcard $(mnt_ns_dep)),) + lttng-tracer-objs += lttng-context-mnt-ns.o + endif + + ifneq ($(CONFIG_NET_NS),) + lttng-tracer-objs += lttng-context-net-ns.o + endif + + ifneq ($(CONFIG_PID_NS),) + lttng-tracer-objs += lttng-context-pid-ns.o + endif + + ifneq ($(CONFIG_USER_NS),) + lttng-tracer-objs += lttng-context-user-ns.o + endif + + ifneq ($(CONFIG_UTS_NS),) + lttng-tracer-objs += lttng-context-uts-ns.o + endif + obj-$(CONFIG_LTTNG) += lttng-statedump.o lttng-statedump-objs := lttng-statedump-impl.o wrapper/irqdesc.o \ wrapper/fdtable.o
instrumentation/events/lttng-module/sched.h +3 -8
@@ -12,12 +12,7 @@#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,9 ,0 ))#include <linux/sched/rt.h> #endif - -#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,19 ,0 )) -#define lttng_proc_inum ns.inum -#else -#define lttng_proc_inum proc_inum -#endif +#include <wrapper/namespace.h> #define LTTNG_MAX_PID_NS_LEVEL 32
@@ -414,7 +409,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(sched_process_fork, pid_ns =task_active_pid_ns (parent);if (pid_ns) parent_ns_inum = - pid_ns->lttng_proc_inum; + pid_ns->lttng_ns_inum; } parent_ns_inum; }))
@@ -434,7 +429,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(sched_process_fork, pid_ns =task_active_pid_ns (child);if (pid_ns) child_ns_inum = - pid_ns->lttng_proc_inum; + pid_ns->lttng_ns_inum; } child_ns_inum; }))
lttng-abi.c +14 -0
@@ -247,6 +247,20 @@ long lttng_abi_add_context(struct file *file,return lttng_add_preemptible_to_ctx (ctx);case LTTNG_KERNEL_CONTEXT_MIGRATABLE :return lttng_add_migratable_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_CGROUP_NS : +return lttng_add_cgroup_ns_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_IPC_NS : +return lttng_add_ipc_ns_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_MNT_NS : +return lttng_add_mnt_ns_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_NET_NS : +return lttng_add_net_ns_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_PID_NS : +return lttng_add_pid_ns_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_USER_NS : +return lttng_add_user_ns_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_UTS_NS : +return lttng_add_uts_ns_to_ctx (ctx);default :return -EINVAL ; }
lttng-abi.h +7 -0
@@ -146,6 +146,13 @@ enum lttng_kernel_context_type {LTTNG_KERNEL_CONTEXT_PREEMPTIBLE =13 ,LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE =14 ,LTTNG_KERNEL_CONTEXT_MIGRATABLE =15 , +LTTNG_KERNEL_CONTEXT_CGROUP_NS =16 , +LTTNG_KERNEL_CONTEXT_IPC_NS =17 , +LTTNG_KERNEL_CONTEXT_MNT_NS =18 , +LTTNG_KERNEL_CONTEXT_NET_NS =19 , +LTTNG_KERNEL_CONTEXT_PID_NS =20 , +LTTNG_KERNEL_CONTEXT_USER_NS =21 , + LTTNG_KERNEL_CONTEXT_UTS_NS = 22, }; struct lttng_kernel_perf_counter_ctx {
lttng-context-cgroup-ns.c new file +113 -0
113 lines not on this page · raw message
lttng-context-ipc-ns.c new file +110 -0
110 lines not on this page · raw message
lttng-context-mnt-ns.c new file +111 -0
111 lines not on this page · raw message
lttng-context-net-ns.c new file +110 -0
110 lines not on this page · raw message
lttng-context-pid-ns.c new file +106 -0
106 lines not on this page · raw message
lttng-context-user-ns.c new file +98 -0
98 lines not on this page · raw message
lttng-context-uts-ns.c new file +110 -0
110 lines not on this page · raw message
lttng-context.c +28 -0
@@ -308,6 +308,34 @@ int lttng_context_init(void)if (ret && ret != -ENOSYS ) {printk (KERN_WARNING "Cannot add context lttng_add_migratable_to_ctx" ); } + ret =lttng_add_cgroup_ns_to_ctx (<tng_static_ctx); +if (ret && ret != -ENOSYS ) { +printk (KERN_WARNING "Cannot add context lttng_add_cgroup_ns_to_ctx" ); + } + ret =lttng_add_ipc_ns_to_ctx (<tng_static_ctx); +if (ret && ret != -ENOSYS ) { +printk (KERN_WARNING "Cannot add context lttng_add_ipc_ns_to_ctx" ); + } + ret =lttng_add_mnt_ns_to_ctx (<tng_static_ctx); +if (ret && ret != -ENOSYS ) { +printk (KERN_WARNING "Cannot add context lttng_add_mnt_ns_to_ctx" ); + } + ret =lttng_add_net_ns_to_ctx (<tng_static_ctx); +if (ret && ret != -ENOSYS ) { +printk (KERN_WARNING "Cannot add context lttng_add_net_ns_to_ctx" ); + } + ret =lttng_add_pid_ns_to_ctx (<tng_static_ctx); +if (ret && ret != -ENOSYS ) { +printk (KERN_WARNING "Cannot add context lttng_add_pid_ns_to_ctx" ); + } + ret =lttng_add_user_ns_to_ctx (<tng_static_ctx); +if (ret && ret != -ENOSYS ) { +printk (KERN_WARNING "Cannot add context lttng_add_user_ns_to_ctx" ); + } + ret =lttng_add_uts_ns_to_ctx (<tng_static_ctx); +if (ret && ret != -ENOSYS ) { +printk (KERN_WARNING "Cannot add context lttng_add_uts_ns_to_ctx" ); + }/* TODO: perf counters for filtering */ return 0 ; }
lttng-events.h +79 -0
85 lines not on this page · raw message
wrapper/namespace.h new file +33 -0
@@ -0,0 +1,33 @@ +#ifndef _LTTNG_WRAPPER_NAMESPACE_H +#define _LTTNG_WRAPPER_NAMESPACE_H + +/* +* wrapper/namespace.h +* +* Copyright (C) 2011-2012 Mathieu Desnoyers <[email protected]> +* 2018 Michael Jeanson <[email protected]> +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; only +* version 2.1 of the License. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include <linux/version.h> + +#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,19 ,0 )) +#define lttng_ns_inum ns.inum +#else +#define lttng_ns_inum proc_inum +#endif + +#endif /* _LTTNG_WRAPPER_NAMESPACE_H */
Signature · 6 lines
2.7.4 _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
PATCH 2/3 RFC: Add uid/gid contexts
In reply to a message not in the archiveAdd a context for each available kernel user and group IDs
* uid : real user ID
* euid : effective user ID
* suid : saved set-user ID
* fsuid : filesystem ID
These are the IDs as seen in the initial user namespace, see credentials(7) for details on each type.
Also add a "virtual" version of each type with the "v" prefix that are the IDs as seen in the current user namespace.
--- Makefile | 16 +++++++++ lttng-abi.c | 32 +++++++++++++++++ lttng-abi.h | 16 +++++++++ lttng-context-egid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-euid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-fsgid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-fsuid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-gid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-sgid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-suid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-uid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-vegid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-veuid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-vfsgid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-vfsuid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-vgid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-vsgid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-vsuid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-context-vuid.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ lttng-events.h | 17 +++++++++ wrapper/user_namespace.h | 73 ++++++++++++++++++++++++++++++++++++++ 21 files changed, 1610 insertions(+) create mode 100644 lttng-context-egid.c create mode 100644 lttng-context-euid.c create mode 100644 lttng-context-fsgid.c create mode 100644 lttng-context-fsuid.c create mode 100644 lttng-context-gid.c create mode 100644 lttng-context-sgid.c create mode 100644 lttng-context-suid.c create mode 100644 lttng-context-uid.c create mode 100644 lttng-context-vegid.c create mode 100644 lttng-context-veuid.c create mode 100644 lttng-context-vfsgid.c create mode 100644 lttng-context-vfsuid.c create mode 100644 lttng-context-vgid.c create mode 100644 lttng-context-vsgid.c create mode 100644 lttng-context-vsuid.c create mode 100644 lttng-context-vuid.c create mode 100644 wrapper/user_namespace.h
Makefile +16 -0
@@ -50,6 +50,22 @@ ifneq ($(KERNELRELEASE),) lttng-context-vpid.o lttng-context-tid.o \ lttng-context-vtid.o lttng-context-ppid.o \ lttng-context-vppid.o lttng-context-cpu-id.o \ + lttng-context-uid.o \ + lttng-context-euid.o \ + lttng-context-suid.o \ + lttng-context-fsuid.o \ + lttng-context-gid.o \ + lttng-context-egid.o \ + lttng-context-sgid.o \ + lttng-context-fsgid.o \ + lttng-context-vuid.o \ + lttng-context-veuid.o \ + lttng-context-vsuid.o \ + lttng-context-vfsuid.o \ + lttng-context-vgid.o \ + lttng-context-vegid.o \ + lttng-context-vsgid.o \ + lttng-context-vfsgid.o \ lttng-context-interruptible.o \ lttng-context-need-reschedule.o lttng-calibrate.o \ lttng-context-hostname.o wrapper/random.o \
lttng-abi.c +32 -0
@@ -261,6 +261,38 @@ long lttng_abi_add_context(struct file *file,return lttng_add_user_ns_to_ctx (ctx);case LTTNG_KERNEL_CONTEXT_UTS_NS :return lttng_add_uts_ns_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_UID : +return lttng_add_uid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_EUID : +return lttng_add_euid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_SUID : +return lttng_add_suid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_FSUID : +return lttng_add_fsuid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_GID : +return lttng_add_gid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_EGID : +return lttng_add_egid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_SGID : +return lttng_add_sgid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_FSGID : +return lttng_add_fsgid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_VUID : +return lttng_add_vuid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_VEUID : +return lttng_add_veuid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_VSUID : +return lttng_add_vsuid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_VFSUID : +return lttng_add_vfsuid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_VGID : +return lttng_add_vgid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_VEGID : +return lttng_add_vegid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_VSGID : +return lttng_add_vsgid_to_ctx (ctx); +case LTTNG_KERNEL_CONTEXT_VFSGID : +return lttng_add_vfsgid_to_ctx (ctx);default :return -EINVAL ; }
lttng-abi.h +16 -0
@@ -153,6 +153,22 @@ enum lttng_kernel_context_type {LTTNG_KERNEL_CONTEXT_PID_NS =20 ,LTTNG_KERNEL_CONTEXT_USER_NS =21 ,LTTNG_KERNEL_CONTEXT_UTS_NS =22 , +LTTNG_KERNEL_CONTEXT_UID =23 , +LTTNG_KERNEL_CONTEXT_EUID =24 , +LTTNG_KERNEL_CONTEXT_SUID =25 , +LTTNG_KERNEL_CONTEXT_FSUID =26 , +LTTNG_KERNEL_CONTEXT_GID =27 , +LTTNG_KERNEL_CONTEXT_EGID =28 , +LTTNG_KERNEL_CONTEXT_SGID =29 , +LTTNG_KERNEL_CONTEXT_FSGID =30 , +LTTNG_KERNEL_CONTEXT_VUID =31 , +LTTNG_KERNEL_CONTEXT_VEUID =32 , +LTTNG_KERNEL_CONTEXT_VSUID =33 , +LTTNG_KERNEL_CONTEXT_VFSUID =34 , +LTTNG_KERNEL_CONTEXT_VGID =35 , +LTTNG_KERNEL_CONTEXT_VEGID =36 , +LTTNG_KERNEL_CONTEXT_VSGID =37 , + LTTNG_KERNEL_CONTEXT_VFSGID = 38, }; struct lttng_kernel_perf_counter_ctx {
lttng-context-egid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-euid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-fsgid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-fsuid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-gid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-sgid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-suid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-uid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-vegid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-veuid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-vfsgid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-vfsuid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-vgid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-vsgid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-vsuid.c new file +91 -0
91 lines not on this page · raw message
lttng-context-vuid.c new file +91 -0
91 lines not on this page · raw message
lttng-events.h +17 -0
@@ -781,6 +781,23 @@ int lttng_add_uts_ns_to_ctx(struct lttng_ctx **ctx) }#endif +int lttng_add_uid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_euid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_suid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_fsuid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_gid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_egid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_sgid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_fsgid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_vuid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_veuid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_vsuid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_vfsuid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_vgid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_vegid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_vsgid_to_ctx (struct lttng_ctx **ctx); +int lttng_add_vfsgid_to_ctx (struct lttng_ctx **ctx); +#if defined(CONFIG_PERF_EVENTS ) && (LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,33 )) int lttng_add_perf_counter_to_ctx(uint32_t type, uint64_t config,
wrapper/user_namespace.h new file +73 -0
73 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
PATCH 3/3 RFC: Add namespaces statedump
In reply to a message not in the archiveAdd a statedump event for each type of namespace.
The pid ns was already implemented as part of the lttng_statedump_process_state event, move the "vtid" and "vpid" fields to the new lttng_statedump_process_pid_ns event.
--- .../events/lttng-module/lttng-statedump.h | 137 ++++++++++++++++++--- lttng-statedump-impl.c | 72 ++++++++++- wrapper/namespace.h | 6 + wrapper/user_namespace.h | 55 +++++++++ 4 files changed, 250 insertions(+), 20 deletions(-)
instrumentation/events/lttng-module/lttng-statedump.h +119 -18
@@ -6,15 +6,22 @@#include <probes/lttng-tracepoint-event.h> #include <linux/nsproxy.h> +#include <linux/cgroup.h> +#include <linux/ipc_namespace.h> +#include <net/net_namespace.h> #include <linux/pid_namespace.h> +#include <linux/user_namespace.h> +#include <linux/utsname.h> #include <linux/types.h> #include <linux/version.h> - - -#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,19 ,0 )) -#define lttng_proc_inum ns.inum -#else -#define lttng_proc_inum proc_inum +#include <wrapper/namespace.h> +#include <wrapper/user_namespace.h> + +#ifndef LTTNG_MNT_NS_MISSING_HEADER +# ifndef ONCE_LTTNG_FS_MOUNT_H +# define ONCE_LTTNG_FS_MOUNT_H +# include <../fs/mount.h> +# endif #endif LTTNG_TRACEPOINT_EVENT(lttng_statedump_start,
@@ -32,14 +39,11 @@ LTTNG_TRACEPOINT_EVENT(lttng_statedump_end, LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_state, TP_PROTO(struct lttng_session *session, struct task_struct *p, - int type, int mode, int submode, int status, - struct pid_namespace *pid_ns), - TP_ARGS(session, p, type, mode, submode, status, pid_ns), + int type, int mode, int submode, int status), + TP_ARGS(session, p, type, mode, submode, status), TP_FIELDS( ctf_integer(pid_t, tid, p->pid) - ctf_integer(pid_t, vtid, pid_ns ? task_pid_nr_ns(p, pid_ns) : 0) ctf_integer(pid_t, pid, p->tgid) - ctf_integer(pid_t, vpid, pid_ns ? task_tgid_nr_ns(p, pid_ns) : 0) ctf_integer(pid_t, ppid, ({ pid_t ret;
@@ -49,6 +53,78 @@ LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_state,rcu_read_unlock (); ret; })) + ctf_array_text(char, name, p->comm, TASK_COMM_LEN) + ctf_integer(int, type, type) + ctf_integer(int, mode, mode) + ctf_integer(int, submode, submode) + ctf_integer(int, status, status) + ctf_integer(unsigned int, cpu, task_cpu(p)) + ) +) + +#if (LINUX_VERSION_CODE >=KERNEL_VERSION (4 ,6 ,0 )) +LTTNG_TRACEPOINT_EVENT (lttng_statedump_process_cgroup_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct cgroup_namespace *cgroup_ns), +TP_ARGS (session, p, cgroup_ns), +TP_FIELDS ( + ctf_integer(pid_t, tid, p->pid) + ctf_integer(unsigned int, ns_inum, cgroup_ns ? cgroup_ns->lttng_ns_inum : 0) + ) +) +#endif + +LTTNG_TRACEPOINT_EVENT (lttng_statedump_process_ipc_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct ipc_namespace *ipc_ns), +TP_ARGS (session, p, ipc_ns), +TP_FIELDS ( + ctf_integer(pid_t, tid, p->pid) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) + ctf_integer(unsigned int, ns_inum, ipc_ns ? ipc_ns->lttng_ns_inum : 0) +#endif + ) +) + +#if !defined(LTTNG_MNT_NS_MISSING_HEADER ) +LTTNG_TRACEPOINT_EVENT (lttng_statedump_process_mnt_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct mnt_namespace *mnt_ns), +TP_ARGS (session, p, mnt_ns), +TP_FIELDS ( + ctf_integer(pid_t, tid, p->pid) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) + ctf_integer(unsigned int, ns_inum, mnt_ns ? mnt_ns->lttng_ns_inum : 0) +#endif + ) +) +#endif + +LTTNG_TRACEPOINT_EVENT (lttng_statedump_process_net_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct net *net_ns), +TP_ARGS (session, p, net_ns), +TP_FIELDS ( + ctf_integer(pid_t, tid, p->pid) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) + ctf_integer(unsigned int, ns_inum, net_ns ? net_ns->lttng_ns_inum : 0) +#endif + ) +) + +LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_pid_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct pid_namespace *pid_ns), + TP_ARGS(session, p, pid_ns), + TP_FIELDS( + ctf_integer(pid_t, tid, p->pid) + ctf_integer(pid_t, vtid, pid_ns ? task_pid_nr_ns(p, pid_ns) : 0) + ctf_integer(pid_t, vpid, pid_ns ? task_tgid_nr_ns(p, pid_ns) : 0) ctf_integer(pid_t, vppid, ({ struct task_struct *parent;
@@ -62,16 +138,41 @@ LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_state, } ret; })) - ctf_array_text(char, name, p->comm, TASK_COMM_LEN) - ctf_integer(int, type, type) - ctf_integer(int, mode, mode) - ctf_integer(int, submode, submode) - ctf_integer(int, status, status) ctf_integer(int, ns_level, pid_ns ? pid_ns->level : 0)#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,8 ,0 )) - ctf_integer(unsigned int, ns_inum, pid_ns ? pid_ns->lttng_proc_inum : 0) + ctf_integer(unsigned int, ns_inum, pid_ns ? pid_ns->lttng_ns_inum : 0) +#endif + ) +) + +LTTNG_TRACEPOINT_EVENT (lttng_statedump_process_user_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct user_namespace *user_ns), +TP_ARGS (session, p, user_ns), +TP_FIELDS ( + ctf_integer(pid_t, tid, p->pid) + ctf_integer(uid_t, vuid, user_ns ? lttng_task_vuid(p, user_ns) : 0) + ctf_integer(gid_t, vgid, user_ns ? lttng_task_vgid(p, user_ns) : 0) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)) + ctf_integer(int, ns_level, user_ns ? user_ns->level : 0) +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) + ctf_integer(unsigned int, ns_inum, user_ns ? user_ns->lttng_ns_inum : 0) +#endif + ) +) + +LTTNG_TRACEPOINT_EVENT (lttng_statedump_process_uts_ns, + TP_PROTO(struct lttng_session *session, + struct task_struct *p, + struct uts_namespace *uts_ns), +TP_ARGS (session, p, uts_ns), +TP_FIELDS ( + ctf_integer(pid_t, tid, p->pid) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) + ctf_integer(unsigned int, ns_inum, uts_ns ? uts_ns->lttng_ns_inum : 0) #endif - ctf_integer(unsigned int, cpu, task_cpu(p)) ) )
lttng-statedump-impl.c +70 -2
108 lines not on this page · raw message
wrapper/namespace.h +6 -0
@@ -30,4 +30,10 @@#define lttng_ns_inum proc_inum#endif +#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,5 ,0 )) +#define lttng_user_ns_parent parent +#else +#define lttng_user_ns_parent creator->user_ns +#endif +#endif /* _LTTNG_WRAPPER_NAMESPACE_H */
wrapper/user_namespace.h +55 -0
67 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev