Re: debug annotations for bpf progs. Was: [PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-17 Thread Alexei Starovoitov
On Thu, Oct 17, 2019 at 9:28 AM Stanislav Fomichev wrote: > Tried to do the following: > > 1. Add: static volatile const char __annotate_source1[] = __FILE__; >to test_rdonly_maps.c and I think it got optimized away :-/ >At least I don't see it in the 'bpftool btf dump' output. > > 2. Add:

Re: debug annotations for bpf progs. Was: [PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-17 Thread Stanislav Fomichev
On 10/16, Daniel Borkmann wrote: > On Tue, Oct 15, 2019 at 02:21:50PM -0700, Alexei Starovoitov wrote: > > On Fri, Oct 11, 2019 at 5:38 PM Stanislav Fomichev wrote: > > > On 10/11, Alexei Starovoitov wrote: > > > > On Fri, Oct 11, 2019 at 9:21 AM Stanislav Fomichev > > > > wrote: > > > > > > > >

Re: debug annotations for bpf progs. Was: [PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-16 Thread Daniel Borkmann
On Tue, Oct 15, 2019 at 02:21:50PM -0700, Alexei Starovoitov wrote: > On Fri, Oct 11, 2019 at 5:38 PM Stanislav Fomichev wrote: > > On 10/11, Alexei Starovoitov wrote: > > > On Fri, Oct 11, 2019 at 9:21 AM Stanislav Fomichev > > > wrote: > > > > > > > > Even though we have the pointer to user_st

Re: debug annotations for bpf progs. Was: [PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-15 Thread Alexei Starovoitov
On Tue, Oct 15, 2019 at 3:34 PM Andrii Nakryiko wrote: > > On Tue, Oct 15, 2019 at 3:24 PM Alexei Starovoitov > wrote: > > > > On Tue, Oct 15, 2019 at 3:14 PM Andrii Nakryiko > > wrote: > > > > > > On Tue, Oct 15, 2019 at 2:22 PM Alexei Starovoitov > > > wrote: > > > > > > > > On Fri, Oct 11, 2

Re: debug annotations for bpf progs. Was: [PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-15 Thread Andrii Nakryiko
On Tue, Oct 15, 2019 at 3:24 PM Alexei Starovoitov wrote: > > On Tue, Oct 15, 2019 at 3:14 PM Andrii Nakryiko > wrote: > > > > On Tue, Oct 15, 2019 at 2:22 PM Alexei Starovoitov > > wrote: > > > > > > On Fri, Oct 11, 2019 at 5:38 PM Stanislav Fomichev > > > wrote: > > > > > > > > On 10/11, Ale

Re: debug annotations for bpf progs. Was: [PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-15 Thread Stanislav Fomichev
On 10/15, Alexei Starovoitov wrote: > On Fri, Oct 11, 2019 at 5:38 PM Stanislav Fomichev wrote: > > > > On 10/11, Alexei Starovoitov wrote: > > > On Fri, Oct 11, 2019 at 9:21 AM Stanislav Fomichev > > > wrote: > > > > > > > > Even though we have the pointer to user_struct and can recover > > > >

Re: debug annotations for bpf progs. Was: [PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-15 Thread Alexei Starovoitov
On Tue, Oct 15, 2019 at 3:14 PM Andrii Nakryiko wrote: > > On Tue, Oct 15, 2019 at 2:22 PM Alexei Starovoitov > wrote: > > > > On Fri, Oct 11, 2019 at 5:38 PM Stanislav Fomichev wrote: > > > > > > On 10/11, Alexei Starovoitov wrote: > > > > On Fri, Oct 11, 2019 at 9:21 AM Stanislav Fomichev >

Re: debug annotations for bpf progs. Was: [PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-15 Thread Andrii Nakryiko
On Tue, Oct 15, 2019 at 2:22 PM Alexei Starovoitov wrote: > > On Fri, Oct 11, 2019 at 5:38 PM Stanislav Fomichev wrote: > > > > On 10/11, Alexei Starovoitov wrote: > > > On Fri, Oct 11, 2019 at 9:21 AM Stanislav Fomichev > > > wrote: > > > > > > > > Even though we have the pointer to user_struc

debug annotations for bpf progs. Was: [PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-15 Thread Alexei Starovoitov
On Fri, Oct 11, 2019 at 5:38 PM Stanislav Fomichev wrote: > > On 10/11, Alexei Starovoitov wrote: > > On Fri, Oct 11, 2019 at 9:21 AM Stanislav Fomichev wrote: > > > > > > Even though we have the pointer to user_struct and can recover > > > uid of the user who has created the program, it usually

Re: [PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-11 Thread Stanislav Fomichev
On 10/11, Alexei Starovoitov wrote: > On Fri, Oct 11, 2019 at 9:21 AM Stanislav Fomichev wrote: > > > > Even though we have the pointer to user_struct and can recover > > uid of the user who has created the program, it usually contains > > 0 (root) which is not very informative. Let's store the co

Re: [PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-11 Thread Alexei Starovoitov
On Fri, Oct 11, 2019 at 9:21 AM Stanislav Fomichev wrote: > > Even though we have the pointer to user_struct and can recover > uid of the user who has created the program, it usually contains > 0 (root) which is not very informative. Let's store the comm of the > calling process and export it via

[PATCH bpf-next 1/3] bpf: preserve command of the process that loaded the program

2019-10-11 Thread Stanislav Fomichev
Even though we have the pointer to user_struct and can recover uid of the user who has created the program, it usually contains 0 (root) which is not very informative. Let's store the comm of the calling process and export it via bpf_prog_info. This should help answer the question "which process lo