diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-12-09 18:16:54 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-12-09 18:16:54 +0100 |
commit | 32802361561403cb6441198c82d9c499e0513863 (patch) | |
tree | 20b5f2998d56b2b7a2b801cad42fc0ca74c907c5 /src/libsystemd | |
parent | 7dcd79c295fb1f4bcdda5ead43739acf34100ef8 (diff) |
sd-bus: get rid of PID starttime concept
As kdbus no longer exports this, remove all traces from sd-bus too
Diffstat (limited to 'src/libsystemd')
-rw-r--r-- | src/libsystemd/libsystemd.sym.m4 | 1 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-control.c | 8 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-creds.c | 30 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-creds.h | 1 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-dump.c | 4 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 17 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/kdbus.h | 11 |
7 files changed, 13 insertions, 59 deletions
diff --git a/src/libsystemd/libsystemd.sym.m4 b/src/libsystemd/libsystemd.sym.m4 index baa1a6f585..de8bec3098 100644 --- a/src/libsystemd/libsystemd.sym.m4 +++ b/src/libsystemd/libsystemd.sym.m4 @@ -318,7 +318,6 @@ global: sd_bus_creds_get_uid; sd_bus_creds_get_gid; sd_bus_creds_get_pid; - sd_bus_creds_get_pid_starttime; sd_bus_creds_get_tid; sd_bus_creds_get_comm; sd_bus_creds_get_tid_comm; diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index 261cf0d044..813c97f650 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -405,11 +405,6 @@ static int bus_populate_creds_from_items( c->mask |= SD_BUS_CREDS_TID; } - if (mask & SD_BUS_CREDS_PID_STARTTIME && item->pids.starttime > 0) { - c->pid_starttime = item->pids.starttime; - c->mask |= SD_BUS_CREDS_PID_STARTTIME; - } - break; case KDBUS_ITEM_CREDS: @@ -751,8 +746,7 @@ static int bus_get_name_creds_dbus1( if ((mask & SD_BUS_CREDS_PID) || ((mask & SD_BUS_CREDS_AUGMENT) && - (mask & (SD_BUS_CREDS_PID_STARTTIME| - SD_BUS_CREDS_EUID|SD_BUS_CREDS_SUID|SD_BUS_CREDS_FSUID| + (mask & (SD_BUS_CREDS_EUID|SD_BUS_CREDS_SUID|SD_BUS_CREDS_FSUID| SD_BUS_CREDS_GID|SD_BUS_CREDS_EGID|SD_BUS_CREDS_SGID|SD_BUS_CREDS_FSGID| SD_BUS_CREDS_COMM|SD_BUS_CREDS_EXE|SD_BUS_CREDS_CMDLINE| SD_BUS_CREDS_CGROUP|SD_BUS_CREDS_UNIT|SD_BUS_CREDS_USER_UNIT|SD_BUS_CREDS_SLICE|SD_BUS_CREDS_SESSION|SD_BUS_CREDS_OWNER_UID| diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c index 886e212fbf..9978ddfa38 100644 --- a/src/libsystemd/sd-bus/bus-creds.c +++ b/src/libsystemd/sd-bus/bus-creds.c @@ -294,18 +294,6 @@ _public_ int sd_bus_creds_get_tid(sd_bus_creds *c, pid_t *tid) { return 0; } -_public_ int sd_bus_creds_get_pid_starttime(sd_bus_creds *c, uint64_t *usec) { - assert_return(c, -EINVAL); - assert_return(usec, -EINVAL); - - if (!(c->mask & SD_BUS_CREDS_PID_STARTTIME)) - return -ENODATA; - - assert(c->pid_starttime > 0); - *usec = c->pid_starttime; - return 0; -} - _public_ int sd_bus_creds_get_selinux_context(sd_bus_creds *c, const char **ret) { assert_return(c, -EINVAL); @@ -859,19 +847,6 @@ int bus_creds_add_more(sd_bus_creds *c, uint64_t mask, pid_t pid, pid_t tid) { } } - if (missing & (SD_BUS_CREDS_PID_STARTTIME)) { - unsigned long long st; - - r = get_starttime_of_pid(pid, &st); - if (r < 0) { - if (r != -EPERM && r != -EACCES) - return r; - } else { - c->pid_starttime = ((usec_t) st * USEC_PER_SEC) / (usec_t) sysconf(_SC_CLK_TCK); - c->mask |= SD_BUS_CREDS_PID_STARTTIME; - } - } - if (missing & SD_BUS_CREDS_SELINUX_CONTEXT) { const char *p; @@ -1052,11 +1027,6 @@ int bus_creds_extend_by_pid(sd_bus_creds *c, uint64_t mask, sd_bus_creds **ret) n->mask |= SD_BUS_CREDS_TID; } - if (c->mask & mask & SD_BUS_CREDS_PID_STARTTIME) { - n->pid_starttime = c->pid_starttime; - n->mask |= SD_BUS_CREDS_PID_STARTTIME; - } - if (c->mask & mask & SD_BUS_CREDS_COMM) { n->comm = strdup(c->comm); if (!n->comm) diff --git a/src/libsystemd/sd-bus/bus-creds.h b/src/libsystemd/sd-bus/bus-creds.h index 5267170ff5..48453e2afd 100644 --- a/src/libsystemd/sd-bus/bus-creds.h +++ b/src/libsystemd/sd-bus/bus-creds.h @@ -44,7 +44,6 @@ struct sd_bus_creds { unsigned n_supplementary_gids; pid_t pid; - usec_t pid_starttime; pid_t tid; char *comm; diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c index 722a65448d..9d2aaa8293 100644 --- a/src/libsystemd/sd-bus/bus-dump.c +++ b/src/libsystemd/sd-bus/bus-dump.c @@ -346,12 +346,10 @@ int bus_creds_dump(sd_bus_creds *c, FILE *f, bool terse) { if (c->mask & SD_BUS_CREDS_PID) fprintf(f, "%sPID=%s"PID_FMT"%s", prefix, color, c->pid, suffix); - if (c->mask & SD_BUS_CREDS_PID_STARTTIME) - fprintf(f, "%sPIDStartTime=%s"USEC_FMT"%s", prefix, color, c->pid_starttime, suffix); if (c->mask & SD_BUS_CREDS_TID) fprintf(f, "%sTID=%s"PID_FMT"%s", prefix, color, c->tid, suffix); - if (terse && ((c->mask & (SD_BUS_CREDS_PID|SD_BUS_CREDS_PID_STARTTIME|SD_BUS_CREDS_TID)))) + if (terse && ((c->mask & (SD_BUS_CREDS_PID|SD_BUS_CREDS_TID)))) fputs("\n", f); if (c->mask & SD_BUS_CREDS_UID) diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index 98fd4fd3ec..6cb279ea9d 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -553,22 +553,17 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { case KDBUS_ITEM_PIDS: - /* The PID starttime/TID might be missing, - * when the data is faked by some data bus - * proxy and it lacks that information about - * the real client since SO_PEERCRED is used - * for that. */ + /* The PID/TID might be missing, when the data + * is faked by some data bus proxy and it + * lacks that information about the real + * client since SO_PEERCRED is used for + * that. */ if (d->pids.pid > 0) { m->creds.pid = (pid_t) d->pids.pid; m->creds.mask |= SD_BUS_CREDS_PID & bus->creds_mask; } - if (d->pids.starttime > 0) { - m->creds.pid_starttime = d->pids.starttime / NSEC_PER_USEC; - m->creds.mask |= SD_BUS_CREDS_PID_STARTTIME & bus->creds_mask; - } - if (d->pids.tid > 0) { m->creds.tid = (pid_t) d->pids.tid; m->creds.mask |= SD_BUS_CREDS_TID & bus->creds_mask; @@ -1421,7 +1416,7 @@ uint64_t attach_flags_to_kdbus(uint64_t mask) { SD_BUS_CREDS_GID|SD_BUS_CREDS_EGID|SD_BUS_CREDS_SGID|SD_BUS_CREDS_FSGID)) m |= KDBUS_ATTACH_CREDS; - if (mask & (SD_BUS_CREDS_PID|SD_BUS_CREDS_PID_STARTTIME|SD_BUS_CREDS_TID)) + if (mask & (SD_BUS_CREDS_PID|SD_BUS_CREDS_TID)) m |= KDBUS_ATTACH_PIDS; if (mask & SD_BUS_CREDS_COMM) diff --git a/src/libsystemd/sd-bus/kdbus.h b/src/libsystemd/sd-bus/kdbus.h index 2bfd0f98e6..e2262de6ba 100644 --- a/src/libsystemd/sd-bus/kdbus.h +++ b/src/libsystemd/sd-bus/kdbus.h @@ -84,12 +84,8 @@ struct kdbus_creds { * struct kdbus_pids - process identifiers * @pid: Process ID * @tid: Thread ID - * @starttime: Starttime of the process * - * The PID, TID and starttime of a process. The start tmie is useful to detect - * PID overruns from the client side. i.e. if you use the PID to look something - * up in /proc/$PID/ you can afterwards check the starttime field of it, to - * ensure you didn't run into a PID overrun. + * The PID and TID of a process. * * Attached to: * KDBUS_ITEM_PIDS @@ -97,7 +93,6 @@ struct kdbus_creds { struct kdbus_pids { __u64 pid; __u64 tid; - __u64 starttime; }; /** @@ -773,6 +768,7 @@ enum kdbus_name_list_flags { * @offset: The returned offset in the caller's pool buffer. * The user must use KDBUS_CMD_FREE to free the * allocated memory. + * @size: Output buffer to report size of data at @offset. * * This structure is used with the KDBUS_CMD_NAME_LIST ioctl. */ @@ -780,6 +776,7 @@ struct kdbus_cmd_name_list { __u64 flags; __u64 kernel_flags; __u64 offset; + __u64 size; } __attribute__((aligned(8))); /** @@ -806,6 +803,7 @@ struct kdbus_name_list { * @offset: Returned offset in the caller's pool buffer where the * kdbus_info struct result is stored. The user must * use KDBUS_CMD_FREE to free the allocated memory. + * @info_size: Output buffer to report size of data at @offset. * @items: The optional item list, containing the * well-known name to look up as a KDBUS_ITEM_NAME. * Only needed in case @id is zero. @@ -820,6 +818,7 @@ struct kdbus_cmd_info { __u64 kernel_flags; __u64 id; __u64 offset; + __u64 info_size; struct kdbus_item items[0]; } __attribute__((aligned(8))); |