lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201104164215.GH3861143@krava>
Date:   Wed, 4 Nov 2020 17:45:53 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc:     Song Liu <songliubraving@...com>,
        Alexei Starovoitov <alexei.starovoitov@...il.com>,
        Andrii Nakryiko <andrii@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Daniel Borkmann <daniel@...earbox.net>,
        John Fastabend <john.fastabend@...il.com>,
        Network Development <netdev@...r.kernel.org>,
        bpf <bpf@...r.kernel.org>, Kernel Team <Kernel-team@...com>
Subject: Re: [PATCH v2 bpf-next 3/4] selftests/bpf: Add profiler test

On Thu, Oct 15, 2020 at 06:09:14AM +0000, Song Liu wrote:
> 
> 
> > On Oct 13, 2020, at 2:56 PM, Andrii Nakryiko <andrii.nakryiko@...il.com> wrote:
> 
> [...]
> 
> > 
> > I'd go with Kconfig + bpf_core_enum_value(), as it's shorter and
> > nicer. This compiles and works with my Kconfig, but I haven't checked
> > with CONFIG_CGROUP_PIDS defined.
> 
> Tested with CONFIG_CGROUP_PIDS, it looks good. 
> 
> Tested-by: Song Liu <songliubraving@...com>

hi,
I still need to apply my workaround to compile tests,
so I wonder this fell through cracks

thanks,
jirka

> 
> > 
> > 
> > diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h
> > b/tools/testing/selftests/bpf/progs/profiler.inc.h
> > index 00578311a423..79b8d2860a5c 100644
> > --- a/tools/testing/selftests/bpf/progs/profiler.inc.h
> > +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h
> > @@ -243,7 +243,11 @@ static ino_t get_inode_from_kernfs(struct
> > kernfs_node* node)
> >        }
> > }
> > 
> > -int pids_cgrp_id = 1;
> > +extern bool CONFIG_CGROUP_PIDS __kconfig __weak;
> > +
> > +enum cgroup_subsys_id___local {
> > +       pids_cgrp_id___local = 1, /* anything but zero */
> > +};
> > 
> > static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data,
> >                                         struct task_struct* task,
> > @@ -253,7 +257,9 @@ static INLINE void* populate_cgroup_info(struct
> > cgroup_data_t* cgroup_data,
> >                BPF_CORE_READ(task, nsproxy, cgroup_ns, root_cset,
> > dfl_cgrp, kn);
> >        struct kernfs_node* proc_kernfs = BPF_CORE_READ(task, cgroups,
> > dfl_cgrp, kn);
> > 
> > -       if (ENABLE_CGROUP_V1_RESOLVER) {
> > +       if (ENABLE_CGROUP_V1_RESOLVER && CONFIG_CGROUP_PIDS) {
> > +               int cgrp_id = bpf_core_enum_value(enum
> > cgroup_subsys_id___local, pids_cgrp_id___local);
> > +
> > #ifdef UNROLL
> > #pragma unroll
> > #endif
> > @@ -262,7 +268,7 @@ static INLINE void* populate_cgroup_info(struct
> > cgroup_data_t* cgroup_data,
> >                                BPF_CORE_READ(task, cgroups, subsys[i]);
> >                        if (subsys != NULL) {
> >                                int subsys_id = BPF_CORE_READ(subsys, ss, id);
> > -                               if (subsys_id == pids_cgrp_id) {
> > +                               if (subsys_id == cgrp_id) {
> >                                        proc_kernfs =
> > BPF_CORE_READ(subsys, cgroup, kn);
> >                                        root_kernfs =
> > BPF_CORE_READ(subsys, ss, root, kf_root, kn);
> >                                        break;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ