bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: Fix open call in trigger_fstat_events
@ 2020-08-26 10:18 Jiri Olsa
  2020-08-26 14:25 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Olsa @ 2020-08-26 10:18 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann
  Cc: netdev, bpf, Martin KaFai Lau, Song Liu, Yonghong Song,
	Andrii Nakryiko, John Fastabend, KP Singh,
	Jesper Dangaard Brouer

Alexei reported compile breakage on newer systems with
following error:

  In file included from /usr/include/fcntl.h:290:0,
  4814                 from ./test_progs.h:29,
  4815                 from
  .../bpf-next/tools/testing/selftests/bpf/prog_tests/d_path.c:3:
  4816In function ‘open’,
  4817    inlined from ‘trigger_fstat_events’ at
  .../bpf-next/tools/testing/selftests/bpf/prog_tests/d_path.c:50:10,
  4818    inlined from ‘test_d_path’ at
  .../bpf-next/tools/testing/selftests/bpf/prog_tests/d_path.c:119:6:
  4819/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:4: error: call to
  ‘__open_missing_mode’ declared with attribute error: open with O_CREAT
  or O_TMPFILE in second argument needs 3 arguments
  4820    __open_missing_mode ();
  4821    ^~~~~~~~~~~~~~~~~~~~~~

We're missing permission bits as 3rd argument
for open call with O_CREAT flag specified.

Reported-by: Alexei Starovoitov <ast@kernel.org>
Fixes: e4d1af4b16f8 ("selftests/bpf: Add test for d_path helper")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/d_path.c | 2 +-
 1 file changed, 1 insertion(+), 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 058765da17e6..43ffbeacd680 100644
--- a/tools/testing/selftests/bpf/prog_tests/d_path.c
+++ b/tools/testing/selftests/bpf/prog_tests/d_path.c
@@ -47,7 +47,7 @@ static int trigger_fstat_events(pid_t pid)
 	devfd = open("/dev/urandom", O_RDONLY);
 	if (CHECK(devfd < 0, "trigger", "open /dev/urandom failed\n"))
 		goto out_close;
-	localfd = open("/tmp/d_path_loadgen.txt", O_CREAT | O_RDONLY);
+	localfd = open("/tmp/d_path_loadgen.txt", O_CREAT | O_RDONLY, 0644);
 	if (CHECK(localfd < 0, "trigger", "open /tmp/d_path_loadgen.txt failed\n"))
 		goto out_close;
 	/* bpf_d_path will return path with (deleted) */
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf-next] selftests/bpf: Fix open call in trigger_fstat_events
  2020-08-26 10:18 [PATCH bpf-next] selftests/bpf: Fix open call in trigger_fstat_events Jiri Olsa
@ 2020-08-26 14:25 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2020-08-26 14:25 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Alexei Starovoitov, Daniel Borkmann, Network Development, bpf,
	Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko,
	John Fastabend, KP Singh, Jesper Dangaard Brouer

On Wed, Aug 26, 2020 at 3:19 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> Alexei reported compile breakage on newer systems with
> following error:
>
>   In file included from /usr/include/fcntl.h:290:0,
>   4814                 from ./test_progs.h:29,
>   4815                 from
>   .../bpf-next/tools/testing/selftests/bpf/prog_tests/d_path.c:3:
>   4816In function ‘open’,
>   4817    inlined from ‘trigger_fstat_events’ at
>   .../bpf-next/tools/testing/selftests/bpf/prog_tests/d_path.c:50:10,
>   4818    inlined from ‘test_d_path’ at
>   .../bpf-next/tools/testing/selftests/bpf/prog_tests/d_path.c:119:6:
>   4819/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:4: error: call to
>   ‘__open_missing_mode’ declared with attribute error: open with O_CREAT
>   or O_TMPFILE in second argument needs 3 arguments
>   4820    __open_missing_mode ();
>   4821    ^~~~~~~~~~~~~~~~~~~~~~
>
> We're missing permission bits as 3rd argument
> for open call with O_CREAT flag specified.
>
> Reported-by: Alexei Starovoitov <ast@kernel.org>
> Fixes: e4d1af4b16f8 ("selftests/bpf: Add test for d_path helper")
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>

Applied. Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-26 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 10:18 [PATCH bpf-next] selftests/bpf: Fix open call in trigger_fstat_events Jiri Olsa
2020-08-26 14:25 ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).