From: Jiri Olsa <olsajiri@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Hou Tao <houtao@huaweicloud.com>,
bpf@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>,
Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Hou Tao <houtao1@huawei.com>
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix d_path test
Date: Thu, 31 Aug 2023 14:25:30 +0200 [thread overview]
Message-ID: <ZPCGukUcjyih8R+d@krava> (raw)
In-Reply-To: <6c157270-52e9-774e-6641-bdd32ab69ddf@iogearbox.net>
On Thu, Aug 31, 2023 at 01:46:09PM +0200, Daniel Borkmann wrote:
> On 8/31/23 1:00 PM, Jiri Olsa wrote:
> > Recent commit [1] broken d_path test, because now filp_close is not called
> > directly from sys_close, but eventually later when the file is finally
> > released.
> >
> > As suggested by Hou Tao we don't need to re-hook the bpf program, but just
> > instead we can use sys_close_range to trigger filp_close synchronously.
> >
> > [1] 021a160abf62 ("fs: use __fput_sync in close(2)")
> > Suggested-by: Hou Tao <houtao@huaweicloud.com>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/testing/selftests/bpf/prog_tests/d_path.c | 8 +++++++-
> > 1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/d_path.c b/tools/testing/selftests/bpf/prog_tests/d_path.c
> > index 911345c526e6..81e34a4a05d1 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/d_path.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/d_path.c
> > @@ -90,7 +90,11 @@ static int trigger_fstat_events(pid_t pid)
> > fstat(indicatorfd, &fileStat);
> > out_close:
> > - /* triggers filp_close */
> > + /* sys_close no longer triggers filp_close, but we can
> > + * call sys_close_range instead which still does
> > + */
> > +#define close(fd) close_range(fd, fd, 0)
> > +
>
> The BPF CI selftest build says:
>
> [...]
> TEST-OBJ [test_progs] lookup_key.test.o
> TEST-OBJ [test_progs] migrate_reuseport.test.o
> TEST-OBJ [test_progs] user_ringbuf.test.o
> /tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/d_path.c: In function ‘trigger_fstat_events’:
> /tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/d_path.c:96:19: error: implicit declaration of function ‘close_range’ [-Werror=implicit-function-declaration]
> 96 | #define close(fd) close_range(fd, fd, 0)
> | ^~~~~~~~~~~
> /tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/d_path.c:98:2: note: in expansion of macro ‘close’
> 98 | close(pipefd[0]);
> | ^~~~~
> TEST-OBJ [test_progs] task_pt_regs.test.o
> [...]
>
> Perhaps #include <linux/close_range.h> missing ?
yes, will send v2
thanks,
jirka
>
> > close(pipefd[0]);
> > close(pipefd[1]);
> > close(sockfd);
> > @@ -98,6 +102,8 @@ static int trigger_fstat_events(pid_t pid)
> > close(devfd);
> > close(localfd);
> > close(indicatorfd);
> > +
> > +#undef close
> > return ret;
> > }
> >
>
next prev parent reply other threads:[~2023-08-31 12:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 11:00 [PATCH bpf-next] selftests/bpf: Fix d_path test Jiri Olsa
2023-08-31 11:46 ` Daniel Borkmann
2023-08-31 12:25 ` Jiri Olsa [this message]
2023-08-31 12:37 ` Hou Tao
2023-08-31 12:52 ` Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZPCGukUcjyih8R+d@krava \
--to=olsajiri@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=houtao1@huawei.com \
--cc=houtao@huaweicloud.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=sdf@google.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.