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]
Date: Sun, 17 Mar 2024 20:15:31 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Ratheesh Kannoth <rkannoth@...vell.com>
Cc: Jose Fernandez <josef@...flix.com>, Alexei Starovoitov <ast@...nel.org>, 
	Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>, 
	Martin KaFai Lau <martin.lau@...ux.dev>, Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>, 
	Yonghong Song <yonghong.song@...ux.dev>, John Fastabend <john.fastabend@...il.com>, 
	KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...gle.com>, Hao Luo <haoluo@...gle.com>, 
	Jiri Olsa <jolsa@...nel.org>, bpf <bpf@...r.kernel.org>, 
	LKML <linux-kernel@...r.kernel.org>, 
	"open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>, Tycho Andersen <tycho@...ho.pizza>
Subject: Re: [PATCH V2 bpf-next 2/2] selftests/bpf: add selftest for bpf_task_get_cgroup

On Sun, Mar 17, 2024 at 8:10 PM Ratheesh Kannoth <rkannoth@...vell.com> wrote:
>
> On 2024-03-16 at 21:52:41, Jose Fernandez (josef@...flix.com) wrote:
> > This patch adds a selftest for the `bpf_task_get_cgroup` kfunc. The test
> > focuses on the use case of obtaining the cgroup ID of the previous task
> > in a `sched_switch` tracepoint.
> >
> > The selftest involves creating a test cgroup, attaching a BPF program
> > that utilizes the `bpf_task_get_cgroup` during a `sched_switch`
> > tracepoint, and validating that the obtained cgroup ID for the previous
> > task matches the expected cgroup ID.
> >
> > Signed-off-by: Jose Fernandez <josef@...flix.com>
> > Reviewed-by: Tycho Andersen <tycho@...ho.pizza>
> > ---
> > V1 -> V2: Refactor test to work with a cgroup pointer instead of the ID
> >
> >  .../bpf/prog_tests/task_get_cgroup.c          | 58 +++++++++++++++++++
> >  .../bpf/progs/test_task_get_cgroup.c          | 37 ++++++++++++
> >  2 files changed, 95 insertions(+)
> >  create mode 100644 tools/testing/selftests/bpf/prog_tests/task_get_cgroup.c
> >  create mode 100644 tools/testing/selftests/bpf/progs/test_task_get_cgroup.c
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/task_get_cgroup.c b/tools/testing/selftests/bpf/prog_tests/task_get_cgroup.c
> > new file mode 100644
> > index 000000000000..67ed65d0c461
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/prog_tests/task_get_cgroup.c
> > @@ -0,0 +1,58 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +// Copyright 2024 Netflix, Inc.
> > +
> > +#include <test_progs.h>
> > +#include <cgroup_helpers.h>
> > +#include "test_task_get_cgroup.skel.h"
> > +#include <unistd.h>
> > +
> > +#define TEST_CGROUP "/test-task-get-cgroup/"
> > +
> > +void test_task_get_cgroup(void)
> > +{
> > +     struct test_task_get_cgroup *skel;
> > +     int err, fd;
> > +     pid_t pid;
> > +     __u64 cgroup_id, expected_cgroup_id;
> > +     const struct timespec req = {
> > +             .tv_sec = 1,
> > +             .tv_nsec = 0,
> > +     };
> Reverse Xmas tree.

NO. We don't do it in bpf trees.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ