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: <ZwVwBiT8XASa7Jy_@krava>
Date: Tue, 8 Oct 2024 19:46:46 +0200
From: Jiri Olsa <olsajiri@...il.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
	Daniel Borkmann <daniel@...earbox.net>,
	John Fastabend <john.fastabend@...il.com>,
	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>,
	KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>,
	Hao Luo <haoluo@...gle.com>,
	Kumar Kartikeya Dwivedi <memxor@...il.com>,
	Simon Sundberg <simon.sundberg@....se>, bpf@...r.kernel.org,
	netdev@...r.kernel.org
Subject: Re: [PATCH bpf 4/4] selftests/bpf: Add test for kfunc module order

On Tue, Oct 08, 2024 at 12:35:19PM +0200, Toke Høiland-Jørgensen wrote:

SNIP

> +static int test_run_prog(const struct bpf_program *prog,
> +			 struct bpf_test_run_opts *opts, int expect_val)
> +{
> +	int err;
> +
> +	err = bpf_prog_test_run_opts(bpf_program__fd(prog), opts);
> +	if (!ASSERT_OK(err, "bpf_prog_test_run_opts"))
> +		return err;
> +
> +	if (!ASSERT_EQ((int)opts->retval, expect_val, bpf_program__name(prog)))
> +		return -EINVAL;
> +
> +	return 0;
> +}
> +
> +void test_kfunc_module_order(void)
> +{
> +	struct kfunc_module_order *skel;
> +	char pkt_data[64] = {};
> +	int err = 0;
> +
> +	DECLARE_LIBBPF_OPTS(bpf_test_run_opts, test_opts, .data_in = pkt_data,
> +			    .data_size_in = sizeof(pkt_data));
> +
> +	err = load_module("bpf_test_modorder_x.ko",
> +			  env_verbosity > VERBOSE_NONE);
> +	if (!ASSERT_OK(err, "load bpf_test_modorder_x.ko"))
> +		return;
> +
> +	err = load_module("bpf_test_modorder_y.ko",
> +			  env_verbosity > VERBOSE_NONE);
> +	if (!ASSERT_OK(err, "load bpf_test_modorder_y.ko"))
> +		goto exit_modx;
> +
> +	skel = kfunc_module_order__open_and_load();
> +	if (!ASSERT_OK_PTR(skel, "kfunc_module_order__open_and_load()")) {
> +		err = -EINVAL;
> +		goto exit_mods;
> +	}
> +
> +	test_run_prog(skel->progs.call_kfunc_xy, &test_opts, 0);
> +	test_run_prog(skel->progs.call_kfunc_yx, &test_opts, 0);

nit, no need to pass expect_val, it's always 0

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ