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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zrnt-BNkIY1HSqkO@krava>
Date: Mon, 12 Aug 2024 13:11:52 +0200
From: Jiri Olsa <olsajiri@...il.com>
To: "Daniel T. Lee" <danieltimlee@...il.com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
	Alexei Starovoitov <ast@...nel.org>,
	Andrii Nakryiko <andrii.nakryiko@...il.com>,
	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@...ichev.me>,
	Hao Luo <haoluo@...gle.com>, Mykola Lysenko <mykolal@...com>,
	Shuah Khan <shuah@...nel.org>, Yipeng Zou <zouyipeng@...wei.com>,
	linux-kselftest@...r.kernel.org, bpf@...r.kernel.org,
	netdev@...r.kernel.org
Subject: Re: [bpf-next 1/3] selftests/bpf: migrate tracepoint overhead test
 to prog_tests

On Mon, Aug 12, 2024 at 12:45:01AM +0000, Daniel T. Lee wrote:
> As part of the cleanup of outdated test cases in sample/bpf, this
> commit migrates test for tracepoint overhead to selftest prog_tests.
> 
> The test_overhead in selftest/bpf focus on the 'raw_tracepoint' only,
> and do not cover tracepoint-specific tests. To support this, this
> commit utilize 'vmlinux.h', and additional test program for tracepoint
> has been added.
> 
> Signed-off-by: Daniel T. Lee <danieltimlee@...il.com>

sure, let's have it complete

Acked-by: Jiri Olsa <jolsa@...nel.org>

jirka

> ---
>  .../selftests/bpf/prog_tests/test_overhead.c       | 14 +++++++++++++-
>  tools/testing/selftests/bpf/progs/test_overhead.c  | 11 +++++++----
>  2 files changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/test_overhead.c b/tools/testing/selftests/bpf/prog_tests/test_overhead.c
> index f27013e38d03..06153602a859 100644
> --- a/tools/testing/selftests/bpf/prog_tests/test_overhead.c
> +++ b/tools/testing/selftests/bpf/prog_tests/test_overhead.c
> @@ -61,9 +61,10 @@ void test_test_overhead(void)
>  	const char *raw_tp_name = "prog3";
>  	const char *fentry_name = "prog4";
>  	const char *fexit_name = "prog5";
> +	const char *tp_name = "prog6";
>  	const char *kprobe_func = "__set_task_comm";
>  	struct bpf_program *kprobe_prog, *kretprobe_prog, *raw_tp_prog;
> -	struct bpf_program *fentry_prog, *fexit_prog;
> +	struct bpf_program *fentry_prog, *fexit_prog, *tp_prog;
>  	struct bpf_object *obj;
>  	struct bpf_link *link;
>  	int err, duration = 0;
> @@ -96,6 +97,10 @@ void test_test_overhead(void)
>  	if (CHECK(!fexit_prog, "find_probe",
>  		  "prog '%s' not found\n", fexit_name))
>  		goto cleanup;
> +	tp_prog = bpf_object__find_program_by_name(obj, tp_name);
> +	if (CHECK(!tp_prog, "find_probe",
> +		  "prog '%s' not found\n", tp_name))
> +		goto cleanup;
>  	err = bpf_object__load(obj);
>  	if (CHECK(err, "obj_load", "err %d\n", err))
>  		goto cleanup;
> @@ -142,6 +147,13 @@ void test_test_overhead(void)
>  	test_run("fexit");
>  	bpf_link__destroy(link);
>  
> +	/* attach tp */
> +	link = bpf_program__attach_tracepoint(tp_prog, "task", "task_rename");
> +	if (!ASSERT_OK_PTR(link, "attach_tp"))
> +		goto cleanup;
> +	test_run("tp");
> +	bpf_link__destroy(link);
> +
>  cleanup:
>  	prctl(PR_SET_NAME, comm, 0L, 0L, 0L);
>  	bpf_object__close(obj);
> diff --git a/tools/testing/selftests/bpf/progs/test_overhead.c b/tools/testing/selftests/bpf/progs/test_overhead.c
> index abb7344b531f..6dc1f68180e0 100644
> --- a/tools/testing/selftests/bpf/progs/test_overhead.c
> +++ b/tools/testing/selftests/bpf/progs/test_overhead.c
> @@ -1,9 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /* Copyright (c) 2019 Facebook */
> -#include <stdbool.h>
> -#include <stddef.h>
> -#include <linux/bpf.h>
> -#include <linux/ptrace.h>
> +#include "vmlinux.h"
>  #include <bpf/bpf_helpers.h>
>  #include <bpf/bpf_tracing.h>
>  
> @@ -39,4 +36,10 @@ int BPF_PROG(prog5, struct task_struct *tsk, const char *buf, bool exec)
>  	return 0;
>  }
>  
> +SEC("tracepoint/task/task_rename")
> +int prog6(struct trace_event_raw_task_rename *ctx)
> +{
> +	return 0;
> +}
> +
>  char _license[] SEC("license") = "GPL";
> -- 
> 2.43.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ