BPF Archive on lore.kernel.org
 help / color / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Stanislav Fomichev <sdf@fomichev.me>, Martin Lau <kafai@fb.com>
Cc: Stanislav Fomichev <sdf@google.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"ast@kernel.org" <ast@kernel.org>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>
Subject: Re: [PATCH bpf-next 3/3] bpftool: print the comm of the process that loaded the program
Date: Fri, 11 Oct 2019 18:11:36 -0300
Message-ID: <37176EA5-3E3E-4405-9823-5D7153998DF2@kernel.org> (raw)
In-Reply-To: <20191011203716.GI2096@mini-arch>

On October 11, 2019 5:37:16 PM GMT-03:00, Stanislav Fomichev <sdf@fomichev.me> wrote:
>On 10/11, Martin Lau wrote:
>> On Fri, Oct 11, 2019 at 09:21:24AM -0700, Stanislav Fomichev wrote:
>> > Example with loop1.o (loaded via 
>
>> What will be in "comm" for the python bcc script?
>I guess it will be "python". But at least you get a signal that it's
>not some other system daemon :-)

Perhaps bcc could use prctl to change its comm before calling sys_bpf and set the script name?

- Arnaldo

Sent from smartphone

>
>> > 
>> > Signed-off-by: Stanislav Fomichev <sdf@google.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
>> > 


  reply index

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 16:21 [PATCH bpf-next 1/3] bpf: preserve command " Stanislav Fomichev
2019-10-11 16:21 ` [PATCH bpf-next 2/3] tools/bpf: sync bpf.h Stanislav Fomichev
2019-10-11 16:21 ` [PATCH bpf-next 3/3] bpftool: print the comm of the process that loaded the program Stanislav Fomichev
2019-10-11 20:19   ` Martin Lau
2019-10-11 20:37     ` Stanislav Fomichev
2019-10-11 21:11       ` Arnaldo Carvalho de Melo [this message]
2019-10-11 21:30         ` Stanislav Fomichev
2019-10-12  0:10 ` [PATCH bpf-next 1/3] bpf: preserve command " Alexei Starovoitov
2019-10-12  0:38   ` Stanislav Fomichev
2019-10-15 21:21     ` debug annotations for bpf progs. Was: " Alexei Starovoitov
2019-10-15 22:14       ` Andrii Nakryiko
2019-10-15 22:24         ` Alexei Starovoitov
2019-10-15 22:33           ` Andrii Nakryiko
2019-10-15 22:48             ` Alexei Starovoitov
2019-10-15 22:26       ` Stanislav Fomichev
2019-10-16 14:01       ` Daniel Borkmann
2019-10-17 16:28         ` Stanislav Fomichev
2019-10-18  6:19           ` Alexei Starovoitov

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37176EA5-3E3E-4405-9823-5D7153998DF2@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kafai@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@fomichev.me \
    --cc=sdf@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git