Re: [RFC v3 8/9] kmsg: add predefined _PID, _TID, _COMM keywords to kmsg* log dict

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 19, 2015 at 5:58 AM, Paul Osmialowski
<p.osmialowsk@xxxxxxxxxxx> wrote:
> From: Marcin Niesluchowski <m.niesluchow@xxxxxxxxxxx>
>
> kmsg* devices write operation wrote no dict along with message
> Due to usage of kmsg devices in userspace dict has been added
> identifying pid, tid and comm of writing process.

Does this affect even the normal /dev/kmsg?

> -static int kmsg_sys_write(int minor, int level, const char *fmt, ...)
> +static size_t set_kmsg_dict(char *buf)
> +{
> +       size_t len;
> +
> +       len = sprintf(buf, "_PID=%d", task_tgid_nr(current)) + 1;
> +       len += sprintf(buf + len, "_TID=%d", task_pid_nr(current)) + 1;
> +       memcpy(buf + len, "_COMM=", 6);
> +       len += 6;
> +       get_task_comm(buf + len, current);
> +       while (buf[len] != '\0')
> +               len++;

len += strlen(buf); ?

Is it obvious for some reason that this doesn't overflow buf?

Why is task_pid_nr acceptable here?  Isn't this intended for use in namespaces?

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux