[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191011201910.ynztujumh7dlluez@kafai-mbp.dhcp.thefacebook.com>
Date: Fri, 11 Oct 2019 20:19:13 +0000
From: Martin Lau <kafai@...com>
To: Stanislav Fomichev <sdf@...gle.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>
Subject: Re: [PATCH bpf-next 3/3] bpftool: print the comm of the process that
loaded the program
On Fri, Oct 11, 2019 at 09:21:24AM -0700, Stanislav Fomichev wrote:
> Print recently added created_by_comm along the existing created_by_uid.
>
> Example with loop1.o (loaded via bpftool):
> 4: raw_tracepoint name nested_loops tag b9472b3ff5753ef2 gpl
> loaded_at 2019-10-10T13:38:18-0700 uid 0 comm bpftool
> xlated 264B jited 152B memlock 4096B
> btf_id 3
Hopefully CAP_BPF may avoid uid 0 in the future.
What will be in "comm" for the python bcc script?
>
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> ---
> tools/bpf/bpftool/prog.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
> index 27da96a797ab..400771a942d7 100644
> --- a/tools/bpf/bpftool/prog.c
> +++ b/tools/bpf/bpftool/prog.c
> @@ -296,7 +296,9 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd)
> print_boot_time(info->load_time, buf, sizeof(buf));
>
> /* Piggy back on load_time, since 0 uid is a valid one */
> - printf("\tloaded_at %s uid %u\n", buf, info->created_by_uid);
> + printf("\tloaded_at %s uid %u comm %s\n", buf,
> + info->created_by_uid,
> + info->created_by_comm);
> }
>
> printf("\txlated %uB", info->xlated_prog_len);
> --
> 2.23.0.700.g56cf767bdb-goog
>
Powered by blists - more mailing lists