OSDN Git Service

selftests/bpf: Fix open call in trigger_fstat_events
authorJiri Olsa <jolsa@kernel.org>
Wed, 26 Aug 2020 10:18:45 +0000 (12:18 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 26 Aug 2020 14:20:48 +0000 (07:20 -0700)
commitd83971761fa278dcffa855110f024bf043ce6e6e
tree6b7db7aedb2e89259675001473be1c458b4b5041
parentcd04b04de119a222c83936f7e9dbd46a650cb688
selftests/bpf: Fix open call in trigger_fstat_events

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: e4d1af4b16f8 ("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
tools/testing/selftests/bpf/prog_tests/d_path.c