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: <CAPhsuW7vkmr_SMgzOwhgVCW4GOzJR3thuCQhZFOT5_17jy74_Q@mail.gmail.com>
Date: Fri, 9 May 2025 11:50:00 -0700
From: Song Liu <song@...nel.org>
To: "T.J. Mercier" <tjmercier@...gle.com>
Cc: sumit.semwal@...aro.org, christian.koenig@....com, ast@...nel.org, 
	daniel@...earbox.net, andrii@...nel.org, martin.lau@...ux.dev, 
	skhan@...uxfoundation.org, alexei.starovoitov@...il.com, 
	linux-kernel@...r.kernel.org, linux-media@...r.kernel.org, 
	dri-devel@...ts.freedesktop.org, linaro-mm-sig@...ts.linaro.org, 
	bpf@...r.kernel.org, linux-kselftest@...r.kernel.org, android-mm@...gle.com, 
	simona@...ll.ch, eddyz87@...il.com, yonghong.song@...ux.dev, 
	john.fastabend@...il.com, kpsingh@...nel.org, sdf@...ichev.me, 
	jolsa@...nel.org, mykolal@...com, shuah@...nel.org
Subject: Re: [PATCH bpf-next v4 4/5] selftests/bpf: Add test for dmabuf_iter

On Thu, May 8, 2025 at 11:20 AM T.J. Mercier <tjmercier@...gle.com> wrote:
[...]

> +
> +void test_dmabuf_iter(void)
> +{
> +       struct dmabuf_iter *skel = NULL;
> +       char buf[256];
> +       int iter_fd;
> +
> +       skel = dmabuf_iter__open_and_load();
> +       if (!ASSERT_OK_PTR(skel, "dmabuf_iter__open_and_load"))
> +               return;
> +
> +       if (!ASSERT_OK(create_test_buffers(), "create_buffers"))
> +               goto destroy;
> +
> +       if (!ASSERT_OK(dmabuf_iter__attach(skel), "skel_attach"))
> +               goto destroy;

>From here...

> +       iter_fd = bpf_iter_create(bpf_link__fd(skel->links.dmabuf_collector));
> +       if (!ASSERT_OK_FD(iter_fd, "iter_create"))
> +               goto destroy;
> +
> +       while (read(iter_fd, buf, sizeof(buf)) > 0)
> +               ; /* Read out all contents */
> +
> +       /* Next reads should return 0 */
> +       ASSERT_EQ(read(iter_fd, buf, sizeof(buf)), 0, "read");

to here, can be a separate subtest. Then iter_fd can be moved to
that subtest.

> +
> +       if (test__start_subtest("default_iter"))
> +               subtest_dmabuf_iter_check_default_iter(skel);
> +
> +       close(iter_fd);
> +
> +destroy:
> +       destroy_test_buffers();
> +       dmabuf_iter__destroy(skel);
[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ