Drop 'linux/user_namespace.h' wrapper
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 18 Nov 2022 20:59:56 +0000 (15:59 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 23 Nov 2022 20:02:47 +0000 (15:02 -0500)
Change-Id: I38bb6ff741126e18a4a1deb59471adb68dacdcb0
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
15 files changed:
include/instrumentation/events/lttng-statedump.h
include/lttng/tracepoint-event-impl.h
include/wrapper/user_namespace.h [deleted file]
src/lttng-context-egid.c
src/lttng-context-euid.c
src/lttng-context-gid.c
src/lttng-context-sgid.c
src/lttng-context-suid.c
src/lttng-context-uid.c
src/lttng-context-vegid.c
src/lttng-context-veuid.c
src/lttng-context-vgid.c
src/lttng-context-vsgid.c
src/lttng-context-vsuid.c
src/lttng-context-vuid.c

index e88fec575aa2cf38e97058c7d8b254c635148bc9..7bf79a796801e2b9bf1c3717bbee721aaf8ac5cb 100644 (file)
 #include <linux/user_namespace.h>
 #include <linux/utsname.h>
 #include <linux/types.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/kernel-version.h>
-#include <wrapper/user_namespace.h>
+
 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0) || \
        LTTNG_RHEL_KERNEL_RANGE(4,18,0,305,0,0, 4,19,0,0,0,0))
 #include <linux/time_namespace.h>
@@ -158,8 +160,8 @@ LTTNG_TRACEPOINT_EVENT(lttng_statedump_process_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)
+               ctf_integer(uid_t, vuid, user_ns ? from_kuid_munged(user_ns, task_cred_xxx(p, uid)) : 0)
+               ctf_integer(gid_t, vgid, user_ns ? from_kgid_munged(user_ns, task_cred_xxx(p, gid)) : 0)
 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,11,0))
                ctf_integer(int, ns_level, user_ns ? user_ns->level : 0)
 #endif
index 8e55255666e12672d7a9ff01876ba4af72596cf4..88a2bccccb21b4f6fab9d06a86184503a3fe1b5d 100644 (file)
 #include <linux/rculist.h>
 #include <asm/byteorder.h>
 #include <linux/swab.h>
+#include <linux/user_namespace.h>
 
 #include <wrapper/vmalloc.h>   /* for wrapper_vmalloc_sync_mappings() */
 #include <ringbuffer/frontend_types.h>
 #include <ringbuffer/backend.h>
 #include <wrapper/rcu.h>
-#include <wrapper/user_namespace.h>
 #include <lttng/types.h>
 #include <lttng/probe-user.h>
 #include <lttng/events.h>
@@ -1102,19 +1102,19 @@ static void __event_probe__##_name(_data_proto)                                         \
                        return;                                                         \
                __lf = lttng_rcu_dereference(__session->uid_tracker.p);                 \
                if (__lf && likely(!lttng_id_tracker_lookup(__lf,                       \
-                               lttng_current_uid())))                                  \
+                               from_kuid_munged(&init_user_ns, current_uid()))))       \
                        return;                                                         \
                __lf = lttng_rcu_dereference(__session->vuid_tracker.p);                \
                if (__lf && likely(!lttng_id_tracker_lookup(__lf,                       \
-                               lttng_current_vuid())))                                 \
+                               from_kuid_munged(current_user_ns(), current_uid()))))   \
                        return;                                                         \
                __lf = lttng_rcu_dereference(__session->gid_tracker.p);                 \
                if (__lf && likely(!lttng_id_tracker_lookup(__lf,                       \
-                               lttng_current_gid())))                                  \
+                               from_kgid_munged(&init_user_ns, current_gid()))))       \
                        return;                                                         \
                __lf = lttng_rcu_dereference(__session->vgid_tracker.p);                \
                if (__lf && likely(!lttng_id_tracker_lookup(__lf,                       \
-                               lttng_current_vgid())))                                 \
+                               from_kgid_munged(current_user_ns(), current_gid()))))   \
                        return;                                                         \
                break;                                                                  \
        }                                                                               \
diff --git a/include/wrapper/user_namespace.h b/include/wrapper/user_namespace.h
deleted file mode 100644 (file)
index 26d15c5..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
- *
- * wrapper/user_namespace.h
- *
- * Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
- *
- */
-
-#ifndef _LTTNG_WRAPPER_USER_NAMESPACE_H
-#define _LTTNG_WRAPPER_USER_NAMESPACE_H
-
-#include <lttng/kernel-version.h>
-#include <linux/user_namespace.h>
-
-
-#if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3, 5, 0)
-
-#define lttng_current_xxuid(xxx)                               \
-       (from_kuid_munged(&init_user_ns, current_##xxx()))
-
-#define lttng_current_vxxuid(xxx)                              \
-       (from_kuid_munged(current_user_ns(), current_##xxx()))
-
-#define lttng_current_xxgid(xxx)                               \
-       (from_kgid_munged(&init_user_ns, current_##xxx()))
-
-#define lttng_current_vxxgid(xxx)                              \
-       (from_kgid_munged(current_user_ns(), current_##xxx()))
-
-static inline
-uid_t lttng_task_vuid(struct task_struct *p, struct user_namespace *ns)
-{
-       uid_t uid;
-       kuid_t kuid;
-
-       kuid = task_cred_xxx(p, uid);
-       uid = from_kuid_munged(ns, kuid);
-
-       return uid;
-}
-
-static inline
-gid_t lttng_task_vgid(struct task_struct *p, struct user_namespace *ns)
-{
-       gid_t gid;
-       kgid_t kgid;
-
-       kgid = task_cred_xxx(p, gid);
-       gid = from_kgid_munged(ns, kgid);
-
-       return gid;
-}
-
-#else
-
-#define lttng_current_xxuid(xxx)       (current_##xxx())
-
-#define lttng_current_vxxuid(xxx)                                      \
-       (user_ns_map_uid(current_user_ns(), current_cred(), current_##xxx()))
-
-#define lttng_current_xxgid(xxx)       (current_##xxx())
-
-#define lttng_current_vxxgid(xxx)                                      \
-       (user_ns_map_gid(current_user_ns(), current_cred(), current_##xxx()))
-
-static inline
-uid_t lttng_task_vuid(struct task_struct *p, struct user_namespace *ns)
-{
-       uid_t uid;
-
-       /*
-        * __task_cred requires the RCU readlock be held
-        */
-       rcu_read_lock();
-       uid = user_ns_map_uid(ns, __task_cred(p), __task_cred(p)->uid);
-       rcu_read_unlock();
-
-       return uid;
-}
-
-static inline
-gid_t lttng_task_vgid(struct task_struct *p, struct user_namespace *ns)
-{
-       gid_t gid;
-
-       /*
-        * __task_cred requires the RCU readlock be held
-        */
-       rcu_read_lock();
-       gid = user_ns_map_gid(ns, __task_cred(p), __task_cred(p)->gid);
-       rcu_read_unlock();
-
-       return gid;
-}
-
-#endif
-
-#define lttng_current_uid()    (lttng_current_xxuid(uid))
-#define lttng_current_euid()   (lttng_current_xxuid(euid))
-#define lttng_current_suid()   (lttng_current_xxuid(suid))
-#define lttng_current_fsuid()  (lttng_current_xxuid(fsuid))
-#define lttng_current_gid()    (lttng_current_xxgid(gid))
-#define lttng_current_egid()   (lttng_current_xxgid(egid))
-#define lttng_current_sgid()   (lttng_current_xxgid(sgid))
-#define lttng_current_fsgid()  (lttng_current_xxgid(fsgid))
-
-#define lttng_current_vuid()   (lttng_current_vxxuid(uid))
-#define lttng_current_veuid()  (lttng_current_vxxuid(euid))
-#define lttng_current_vsuid()  (lttng_current_vxxuid(suid))
-#define lttng_current_vfsuid() (lttng_current_vxxuid(fsuid))
-#define lttng_current_vgid()   (lttng_current_vxxgid(gid))
-#define lttng_current_vegid()  (lttng_current_vxxgid(egid))
-#define lttng_current_vsgid()  (lttng_current_vxxgid(sgid))
-#define lttng_current_vfsgid() (lttng_current_vxxgid(fsgid))
-
-#endif /* _LTTNG_WRAPPER_USER_NAMESPACE_H */
index 2b6d3ef9662984a13fd5bf3e400908bbbcc96aa7..d38fb11e4a6b0b4444f5260b4a3e86e23fa76546 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t egid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void egid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        gid_t egid;
 
-       egid = lttng_current_egid();
+       egid = from_kgid_munged(&init_user_ns, current_egid());
        chan->ops->event_write(ctx, &egid, sizeof(egid), lttng_alignof(egid));
 }
 
@@ -44,7 +45,7 @@ void egid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_egid();
+       value->u.s64 = from_kgid_munged(&init_user_ns, current_egid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
index ace9f8008533ad99cfd29a6c26ae7f912b7ef120..92c2868172015308fa5a9899cd03af51b74441a9 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t euid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void euid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        uid_t euid;
 
-       euid = lttng_current_euid();
+       euid = from_kuid_munged(&init_user_ns, current_euid());
        chan->ops->event_write(ctx, &euid, sizeof(euid), lttng_alignof(euid));
 }
 
@@ -44,7 +45,7 @@ void euid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_euid();
+       value->u.s64 = from_kuid_munged(&init_user_ns, current_euid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
index 142061c10fb1916c4203f57233964ac6a1525894..24692aace159500788138df7b3e09b18a98621fd 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t gid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void gid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        gid_t gid;
 
-       gid = lttng_current_gid();
+       gid = from_kgid_munged(&init_user_ns, current_gid());
        chan->ops->event_write(ctx, &gid, sizeof(gid), lttng_alignof(gid));
 }
 
@@ -44,7 +45,7 @@ void gid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_gid();
+       value->u.s64 = from_kgid_munged(&init_user_ns, current_gid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
index c9d4211a0d739a20b4d3855cdd10beda6e0c8ba4..82c905077047ec4ff00f05e1fa8c485df955fb94 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t sgid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void sgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        gid_t sgid;
 
-       sgid = lttng_current_sgid();
+       sgid = from_kgid_munged(&init_user_ns, current_sgid());
        chan->ops->event_write(ctx, &sgid, sizeof(sgid), lttng_alignof(sgid));
 }
 
@@ -44,7 +45,7 @@ void sgid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_sgid();
+       value->u.s64 = from_kgid_munged(&init_user_ns, current_sgid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
index bd1f02466e19ed1e965ba28e296c09f0bf310777..a478b7bf78e7d6fd878b2cace6ea2d597ae675ed 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t suid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void suid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        uid_t suid;
 
-       suid = lttng_current_suid();
+       suid = from_kuid_munged(&init_user_ns, current_suid());
        chan->ops->event_write(ctx, &suid, sizeof(suid), lttng_alignof(suid));
 }
 
@@ -44,7 +45,7 @@ void suid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_suid();
+       value->u.s64 = from_kuid_munged(&init_user_ns, current_suid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
index 6121beef831a9805ebedb7c05f6003d68d0a7656..da8fb301b9a1da4b9bf618096cdeb9329474cb1c 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t uid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void uid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        uid_t uid;
 
-       uid = lttng_current_uid();
+       uid = from_kuid_munged(&init_user_ns, current_uid());
        chan->ops->event_write(ctx, &uid, sizeof(uid), lttng_alignof(uid));
 }
 
@@ -44,7 +45,7 @@ void uid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_uid();
+       value->u.s64 = from_kuid_munged(&init_user_ns, current_uid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
index aa40c40fd1f929443fc614c5dfb46d54e4d6fbb8..c723411ea00e1b93fccd4c8589f7fad9dc8ecf8a 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t vegid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void vegid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        gid_t vegid;
 
-       vegid = lttng_current_vegid();
+       vegid = from_kgid_munged(current_user_ns(), current_egid());
        chan->ops->event_write(ctx, &vegid, sizeof(vegid), lttng_alignof(vegid));
 }
 
@@ -44,7 +45,7 @@ void vegid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_vegid();
+       value->u.s64 = from_kgid_munged(current_user_ns(), current_egid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
index b941967b1eb60935fe0551836a5f40ef876616db..8fc593e56980573f2816c6561230830bdbd12f0f 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t veuid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void veuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        uid_t veuid;
 
-       veuid = lttng_current_veuid();
+       veuid = from_kuid_munged(current_user_ns(), current_euid());
        chan->ops->event_write(ctx, &veuid, sizeof(veuid), lttng_alignof(veuid));
 }
 
@@ -44,7 +45,7 @@ void veuid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_veuid();
+       value->u.s64 = from_kuid_munged(current_user_ns(), current_euid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
index cd3091e8ed15aec43add9507dd14e8f68b74d878..a5a51bfb26477c224e51fa167c932a7936dd2de4 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t vgid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void vgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        gid_t vgid;
 
-       vgid = lttng_current_vgid();
+       vgid = from_kgid_munged(current_user_ns(), current_gid());
        chan->ops->event_write(ctx, &vgid, sizeof(vgid), lttng_alignof(vgid));
 }
 
@@ -44,7 +45,7 @@ void vgid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_vgid();
+       value->u.s64 = from_kgid_munged(current_user_ns(), current_gid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
index e9b18b670319b618ec8d9da8de557325aa7f099d..f54288652f9cf520947a745a43157a85a415a305 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t vsgid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void vsgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        gid_t vsgid;
 
-       vsgid = lttng_current_vsgid();
+       vsgid = from_kgid_munged(current_user_ns(), current_sgid());
        chan->ops->event_write(ctx, &vsgid, sizeof(vsgid), lttng_alignof(vsgid));
 }
 
@@ -44,7 +45,7 @@ void vsgid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_vsgid();
+       value->u.s64 = from_kgid_munged(current_user_ns(), current_sgid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
index f7d5226bf42ffd57d1fe76784682cc4fa3c36353..e48654c8ebb93343f04a120f51a8955e16a58463 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t vsuid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void vsuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        uid_t vsuid;
 
-       vsuid = lttng_current_vsuid();
+       vsuid = from_kuid_munged(current_user_ns(), current_suid());
        chan->ops->event_write(ctx, &vsuid, sizeof(vsuid), lttng_alignof(vsuid));
 }
 
@@ -44,7 +45,7 @@ void vsuid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_vsuid();
+       value->u.s64 = from_kuid_munged(current_user_ns(), current_suid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
index c76115f406536a61cac8f1f4558ccb0efbf9cd22..3fbee8aac783ea2ff02a2cc3ae06f9b622f200cf 100644 (file)
 
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/user_namespace.h>
+
 #include <lttng/events.h>
 #include <lttng/events-internal.h>
 #include <lttng/tracer.h>
 #include <ringbuffer/frontend_types.h>
 #include <wrapper/vmalloc.h>
-#include <wrapper/user_namespace.h>
 
 static
 size_t vuid_get_size(void *priv, struct lttng_kernel_probe_ctx *probe_ctx, size_t offset)
@@ -35,7 +36,7 @@ void vuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
 {
        uid_t vuid;
 
-       vuid = lttng_current_vuid();
+       vuid = from_kuid_munged(current_user_ns(), current_uid());
        chan->ops->event_write(ctx, &vuid, sizeof(vuid), lttng_alignof(vuid));
 }
 
@@ -44,7 +45,7 @@ void vuid_get_value(void *priv,
                struct lttng_kernel_probe_ctx *lttng_probe_ctx,
                struct lttng_ctx_value *value)
 {
-       value->u.s64 = lttng_current_vuid();
+       value->u.s64 = from_kuid_munged(current_user_ns(), current_uid());
 }
 
 static const struct lttng_kernel_ctx_field *ctx_field = lttng_kernel_static_ctx_field(
This page took 0.037073 seconds and 4 git commands to generate.