Skip to content

Commit

Permalink
selftests/bpf: Fix open call in trigger_fstat_events
Browse files Browse the repository at this point in the history
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.

Fixes: e4d1af4 ("selftests/bpf: Add test for d_path helper")
Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200826101845.747617-1-jolsa@kernel.org
  • Loading branch information
Jiri Olsa authored and Alexei Starovoitov committed Aug 26, 2020
1 parent cd04b04 commit d839717
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/bpf/prog_tests/d_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down

0 comments on commit d839717

Please sign in to comment.