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] [day] [month] [year] [list]
Message-ID: <CAM9d7chtq2DV28GU=_eb+MSUTPFg8oGX8NDeeLdnf=Vr+7E1Yg@mail.gmail.com>
Date:   Mon, 14 Mar 2022 10:28:56 -0700
From:   Namhyung Kim <namhyung@...nel.org>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Eugene Loh <eugene.loh@...cle.com>, Hao Luo <haoluo@...gle.com>
Subject: Re: [PATCH 2/2] bpf/selftests: Test skipping stacktrace

Hello,

On Fri, Mar 11, 2022 at 2:23 PM Andrii Nakryiko
<andrii.nakryiko@...il.com> wrote:
>
> On Thu, Mar 10, 2022 at 12:22 AM Namhyung Kim <namhyung@...nel.org> wrote:
> > +SEC("tracepoint/sched/sched_switch")
> > +int oncpu(struct sched_switch_args *ctx)
> > +{
> > +       __u32 max_len = TEST_STACK_DEPTH * sizeof(__u64);
> > +       __u32 key = 0, val = 0, *value_p;
> > +       __u64 *stack_p;
> > +
>
> please also add filtering by PID to avoid interference from other
> selftests when run in parallel mode

Will do!

Thanks,
Namhyung

>
> > +       value_p = bpf_map_lookup_elem(&control_map, &key);
> > +       if (value_p && *value_p)
> > +               return 0; /* skip if non-zero *value_p */
> > +
> > +       /* it should allow skipping whole buffer size entries */
> > +       key = bpf_get_stackid(ctx, &stackmap, TEST_STACK_DEPTH);
> > +       if ((int)key >= 0) {
> > +               /* The size of stackmap and stack_amap should be the same */
> > +               bpf_map_update_elem(&stackid_hmap, &key, &val, 0);
> > +               stack_p = bpf_map_lookup_elem(&stack_amap, &key);
> > +               if (stack_p) {
> > +                       bpf_get_stack(ctx, stack_p, max_len, TEST_STACK_DEPTH);
> > +                       /* it wrongly skipped all the entries and filled zero */
> > +                       if (stack_p[0] == 0)
> > +                               failed = 1;
> > +               }
> > +       } else if ((int)key == -14/*EFAULT*/) {
> > +               /* old kernel doesn't support skipping that many entries */
> > +               failed = 2;
> > +       }
> > +
> > +       return 0;
> > +}
> > +
> > +char _license[] SEC("license") = "GPL";
> > --
> > 2.35.1.723.g4982287a31-goog
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ