Add kernel uid/gid contexts
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 12 Feb 2019 16:51:42 +0000 (11:51 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 23 Oct 2019 20:35:53 +0000 (16:35 -0400)
Add the following kernel tracer context fields:
  - uid
    Real user ID

  - euid
    Effective user ID

  - uid
    Real user ID

  - suid
    Saved set-user ID

  - gid
    Real group ID

  - egid
    Effective group ID

  - sgid
    Effective saved set-user group ID

  - vuid
    Virtual real user ID: real user ID as seen from the point of view of
    the current user namespace

  - veuid
    Virtual effective user ID: effective user ID as seen from the point of
    view of the current user namespace

  - vsuid
    Virtual saved set-user ID: saved set-user ID as seen from the point of
    view of the current user namespace

  - vgid
    Virtual real group ID: real group ID as seen from the point of view of
    the current user namespace

  - vegid
    Virtual effective group ID: effective group ID as seen from the point of
    view of the current user namespace

  - vsgid
    Virtual saved set-group ID: saved set-group ID as seen from the point of
    view of the current user namespace

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/lttng/event.h
src/bin/lttng-sessiond/context.c
src/bin/lttng-sessiond/save.c
src/bin/lttng/commands/add_context.c
src/common/config/config-session-abi.h
src/common/config/session-config.c
src/common/lttng-kernel.h

index 35c8d96f59486b7e22fbf36340e7f6718ca4d467..451a433517e35a6c98b915151ab29f8d1dd627ac 100644 (file)
@@ -153,6 +153,18 @@ enum lttng_event_context_type {
        LTTNG_EVENT_CONTEXT_PID_NS              = 26,
        LTTNG_EVENT_CONTEXT_USER_NS             = 27,
        LTTNG_EVENT_CONTEXT_UTS_NS              = 28,
        LTTNG_EVENT_CONTEXT_PID_NS              = 26,
        LTTNG_EVENT_CONTEXT_USER_NS             = 27,
        LTTNG_EVENT_CONTEXT_UTS_NS              = 28,
+       LTTNG_EVENT_CONTEXT_UID                 = 29,
+       LTTNG_EVENT_CONTEXT_EUID                = 30,
+       LTTNG_EVENT_CONTEXT_SUID                = 31,
+       LTTNG_EVENT_CONTEXT_GID                 = 32,
+       LTTNG_EVENT_CONTEXT_EGID                = 33,
+       LTTNG_EVENT_CONTEXT_SGID                = 34,
+       LTTNG_EVENT_CONTEXT_VUID                = 35,
+       LTTNG_EVENT_CONTEXT_VEUID               = 36,
+       LTTNG_EVENT_CONTEXT_VSUID               = 37,
+       LTTNG_EVENT_CONTEXT_VGID                = 38,
+       LTTNG_EVENT_CONTEXT_VEGID               = 39,
+       LTTNG_EVENT_CONTEXT_VSGID               = 40,
 };
 
 enum lttng_event_field_type {
 };
 
 enum lttng_event_field_type {
index 8f473cd3f39fd2ab7298f98db51e941f4879dfdd..1bb7310a6cb60c53919f907ee7667b4c2e0939a1 100644 (file)
@@ -288,6 +288,42 @@ int context_kernel_add(struct ltt_kernel_session *ksession,
        case LTTNG_EVENT_CONTEXT_UTS_NS:
                kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_UTS_NS;
                break;
        case LTTNG_EVENT_CONTEXT_UTS_NS:
                kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_UTS_NS;
                break;
+       case LTTNG_EVENT_CONTEXT_UID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_UID;
+               break;
+       case LTTNG_EVENT_CONTEXT_EUID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_EUID;
+               break;
+       case LTTNG_EVENT_CONTEXT_SUID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_SUID;
+               break;
+       case LTTNG_EVENT_CONTEXT_GID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_GID;
+               break;
+       case LTTNG_EVENT_CONTEXT_EGID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_EGID;
+               break;
+       case LTTNG_EVENT_CONTEXT_SGID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_SGID;
+               break;
+       case LTTNG_EVENT_CONTEXT_VUID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VUID;
+               break;
+       case LTTNG_EVENT_CONTEXT_VEUID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VEUID;
+               break;
+       case LTTNG_EVENT_CONTEXT_VSUID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VSUID;
+               break;
+       case LTTNG_EVENT_CONTEXT_VGID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VGID;
+               break;
+       case LTTNG_EVENT_CONTEXT_VEGID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VEGID;
+               break;
+       case LTTNG_EVENT_CONTEXT_VSGID:
+               kctx->ctx.ctx = LTTNG_KERNEL_CONTEXT_VSGID;
+               break;
        default:
                ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
                goto error;
        default:
                ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
                goto error;
index 6c7ca6757ea4cf9bbf9dd936dd2e141c91fc683e..cb8a6b06047fc6191e949a6a3616ac9034611aaf 100644 (file)
@@ -315,6 +315,42 @@ const char *get_kernel_context_type_string(
        case LTTNG_KERNEL_CONTEXT_UTS_NS:
                context_type_string = config_event_context_uts_ns;
                break;
        case LTTNG_KERNEL_CONTEXT_UTS_NS:
                context_type_string = config_event_context_uts_ns;
                break;
+       case LTTNG_KERNEL_CONTEXT_UID:
+               context_type_string = config_event_context_uid;
+               break;
+       case LTTNG_KERNEL_CONTEXT_EUID:
+               context_type_string = config_event_context_euid;
+               break;
+       case LTTNG_KERNEL_CONTEXT_SUID:
+               context_type_string = config_event_context_suid;
+               break;
+       case LTTNG_KERNEL_CONTEXT_GID:
+               context_type_string = config_event_context_gid;
+               break;
+       case LTTNG_KERNEL_CONTEXT_EGID:
+               context_type_string = config_event_context_egid;
+               break;
+       case LTTNG_KERNEL_CONTEXT_SGID:
+               context_type_string = config_event_context_sgid;
+               break;
+       case LTTNG_KERNEL_CONTEXT_VUID:
+               context_type_string = config_event_context_vuid;
+               break;
+       case LTTNG_KERNEL_CONTEXT_VEUID:
+               context_type_string = config_event_context_veuid;
+               break;
+       case LTTNG_KERNEL_CONTEXT_VSUID:
+               context_type_string = config_event_context_vsuid;
+               break;
+       case LTTNG_KERNEL_CONTEXT_VGID:
+               context_type_string = config_event_context_vgid;
+               break;
+       case LTTNG_KERNEL_CONTEXT_VEGID:
+               context_type_string = config_event_context_vegid;
+               break;
+       case LTTNG_KERNEL_CONTEXT_VSGID:
+               context_type_string = config_event_context_vsgid;
+               break;
        default:
                context_type_string = NULL;
        }
        default:
                context_type_string = NULL;
        }
index a9ef0ddade83a96b87d77eceebc2cc69e1ca764e..9fcb16d6ea0cc2898b80d0ba0624da8c2bdd7619 100644 (file)
@@ -93,6 +93,18 @@ enum context_type {
        CONTEXT_PID_NS       = 26,
        CONTEXT_USER_NS      = 27,
        CONTEXT_UTS_NS       = 28,
        CONTEXT_PID_NS       = 26,
        CONTEXT_USER_NS      = 27,
        CONTEXT_UTS_NS       = 28,
+       CONTEXT_UID          = 29,
+       CONTEXT_EUID         = 30,
+       CONTEXT_SUID         = 31,
+       CONTEXT_GID          = 32,
+       CONTEXT_EGID         = 33,
+       CONTEXT_SGID         = 34,
+       CONTEXT_VUID         = 35,
+       CONTEXT_VEUID        = 36,
+       CONTEXT_VSUID        = 37,
+       CONTEXT_VGID         = 38,
+       CONTEXT_VEGID        = 39,
+       CONTEXT_VSGID        = 40,
 };
 
 /*
 };
 
 /*
@@ -260,6 +272,18 @@ const struct ctx_opts {
        { "pid_ns", CONTEXT_PID_NS },
        { "user_ns", CONTEXT_USER_NS },
        { "uts_ns", CONTEXT_UTS_NS },
        { "pid_ns", CONTEXT_PID_NS },
        { "user_ns", CONTEXT_USER_NS },
        { "uts_ns", CONTEXT_UTS_NS },
+       { "uid", CONTEXT_UID },
+       { "euid", CONTEXT_EUID },
+       { "suid", CONTEXT_SUID },
+       { "gid", CONTEXT_GID },
+       { "egid", CONTEXT_EGID },
+       { "sgid", CONTEXT_SGID },
+       { "vuid", CONTEXT_VUID },
+       { "veuid", CONTEXT_VEUID },
+       { "vsuid", CONTEXT_VSUID },
+       { "vgid", CONTEXT_VGID },
+       { "vegid", CONTEXT_VEGID },
+       { "vsgid", CONTEXT_VSGID },
 
        /* Perf options */
 
 
        /* Perf options */
 
index ced35254d45b837b415deee138710f9bff900e4f..12dfe600c5ad35a8bd15c84d9e05498d2ef1ede5 100644 (file)
@@ -158,5 +158,17 @@ extern const char * const config_event_context_net_ns;
 extern const char * const config_event_context_pid_ns;
 extern const char * const config_event_context_user_ns;
 extern const char * const config_event_context_uts_ns;
 extern const char * const config_event_context_pid_ns;
 extern const char * const config_event_context_user_ns;
 extern const char * const config_event_context_uts_ns;
+extern const char * const config_event_context_uid;
+extern const char * const config_event_context_euid;
+extern const char * const config_event_context_suid;
+extern const char * const config_event_context_gid;
+extern const char * const config_event_context_egid;
+extern const char * const config_event_context_sgid;
+extern const char * const config_event_context_vuid;
+extern const char * const config_event_context_veuid;
+extern const char * const config_event_context_vsuid;
+extern const char * const config_event_context_vgid;
+extern const char * const config_event_context_vegid;
+extern const char * const config_event_context_vsgid;
 
 #endif /* CONFIG_SESSION_INTERNAL_H */
 
 #endif /* CONFIG_SESSION_INTERNAL_H */
index 01f39d8bec250757d3eaede00b8b27b0f83ee70c..c2ae5e1201fb0cf0b4ef51c438ee74d48fe6d86f 100644 (file)
@@ -212,6 +212,18 @@ LTTNG_HIDDEN const char * const config_event_context_net_ns = "NET_NS";
 LTTNG_HIDDEN const char * const config_event_context_pid_ns = "PID_NS";
 LTTNG_HIDDEN const char * const config_event_context_user_ns = "USER_NS";
 LTTNG_HIDDEN const char * const config_event_context_uts_ns = "UTS_NS";
 LTTNG_HIDDEN const char * const config_event_context_pid_ns = "PID_NS";
 LTTNG_HIDDEN const char * const config_event_context_user_ns = "USER_NS";
 LTTNG_HIDDEN const char * const config_event_context_uts_ns = "UTS_NS";
+LTTNG_HIDDEN const char * const config_event_context_uid = "UID";
+LTTNG_HIDDEN const char * const config_event_context_euid = "EUID";
+LTTNG_HIDDEN const char * const config_event_context_suid = "SUID";
+LTTNG_HIDDEN const char * const config_event_context_gid = "GID";
+LTTNG_HIDDEN const char * const config_event_context_egid = "EGID";
+LTTNG_HIDDEN const char * const config_event_context_sgid = "SGID";
+LTTNG_HIDDEN const char * const config_event_context_vuid = "VUID";
+LTTNG_HIDDEN const char * const config_event_context_veuid = "VEUID";
+LTTNG_HIDDEN const char * const config_event_context_vsuid = "VSUID";
+LTTNG_HIDDEN const char * const config_event_context_vgid = "VGID";
+LTTNG_HIDDEN const char * const config_event_context_vegid = "VEGID";
+LTTNG_HIDDEN const char * const config_event_context_vsgid = "VSGID";
 
 /* Deprecated symbols */
 const char * const config_element_perf;
 
 /* Deprecated symbols */
 const char * const config_element_perf;
@@ -1075,6 +1087,42 @@ int get_context_type(xmlChar *context_type)
        } else if (!strcmp((char *) context_type,
                config_event_context_uts_ns)) {
                ret = LTTNG_EVENT_CONTEXT_UTS_NS;
        } else if (!strcmp((char *) context_type,
                config_event_context_uts_ns)) {
                ret = LTTNG_EVENT_CONTEXT_UTS_NS;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_uid)) {
+               ret = LTTNG_EVENT_CONTEXT_UID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_euid)) {
+               ret = LTTNG_EVENT_CONTEXT_EUID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_suid)) {
+               ret = LTTNG_EVENT_CONTEXT_SUID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_gid)) {
+               ret = LTTNG_EVENT_CONTEXT_GID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_egid)) {
+               ret = LTTNG_EVENT_CONTEXT_EGID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_sgid)) {
+               ret = LTTNG_EVENT_CONTEXT_SGID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_vuid)) {
+               ret = LTTNG_EVENT_CONTEXT_VUID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_veuid)) {
+               ret = LTTNG_EVENT_CONTEXT_VEUID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_vsuid)) {
+               ret = LTTNG_EVENT_CONTEXT_VSUID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_vgid)) {
+               ret = LTTNG_EVENT_CONTEXT_VGID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_vegid)) {
+               ret = LTTNG_EVENT_CONTEXT_VEGID;
+       } else if (!strcmp((char *) context_type,
+               config_event_context_vsgid)) {
+               ret = LTTNG_EVENT_CONTEXT_VSGID;
        } else {
                goto error;
        }
        } else {
                goto error;
        }
index be7de5268ecef15ab76ed849f721dd5c3194d585..4008b50cf6d2999fbe987a8d81fd17d49eda95fb 100644 (file)
@@ -73,6 +73,18 @@ enum lttng_kernel_context_type {
        LTTNG_KERNEL_CONTEXT_PID_NS         = 22,
        LTTNG_KERNEL_CONTEXT_USER_NS        = 23,
        LTTNG_KERNEL_CONTEXT_UTS_NS         = 24,
        LTTNG_KERNEL_CONTEXT_PID_NS         = 22,
        LTTNG_KERNEL_CONTEXT_USER_NS        = 23,
        LTTNG_KERNEL_CONTEXT_UTS_NS         = 24,
+       LTTNG_KERNEL_CONTEXT_UID            = 25,
+       LTTNG_KERNEL_CONTEXT_EUID           = 26,
+       LTTNG_KERNEL_CONTEXT_SUID           = 27,
+       LTTNG_KERNEL_CONTEXT_GID            = 28,
+       LTTNG_KERNEL_CONTEXT_EGID           = 29,
+       LTTNG_KERNEL_CONTEXT_SGID           = 30,
+       LTTNG_KERNEL_CONTEXT_VUID           = 31,
+       LTTNG_KERNEL_CONTEXT_VEUID          = 32,
+       LTTNG_KERNEL_CONTEXT_VSUID          = 33,
+       LTTNG_KERNEL_CONTEXT_VGID           = 34,
+       LTTNG_KERNEL_CONTEXT_VEGID          = 35,
+       LTTNG_KERNEL_CONTEXT_VSGID          = 36,
 };
 
 /* Perf counter attributes */
 };
 
 /* Perf counter attributes */
This page took 0.033534 seconds and 5 git commands to generate.