]> granicus.if.org Git - strace/commit
bpf: add support for file mode flags
authorEugene Syromyatnikov <evgsyr@gmail.com>
Mon, 26 Feb 2018 18:40:08 +0000 (19:40 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 4 Apr 2018 16:33:19 +0000 (16:33 +0000)
commit8e439e10f02b95854585284ced4c34bcb21b2773
tree52f61644b127da1019d3d5c95aced485f2a8b9ec
parent737762cb85429c559f2ee7df702f65b3a7035df4
bpf: add support for file mode flags

These were introduced by Linux commit v4.15-rc1~84^2~384^2~4.

* bpf_attr.h (struct BPF_OBJ_PIN_struct): Add file_flags field.
(struct BPF_PROG_GET_NEXT_ID_struct, struct BPF_PROG_GET_FD_BY_ID_struct,
struct BPF_MAP_GET_FD_BY_ID_struct): Add open_flags field.
(BPF_OBJ_PIN_struct_size, expected_BPF_OBJ_PIN_struct_size,
expected_BPF_PROG_GET_NEXT_ID_struct_size,
expected_BPF_PROG_GET_FD_BY_ID_struct_size,
expected_BPF_MAP_GET_FD_BY_ID_struct_size): Update.
* bpf.c (DEF_BPF_CMD_DECODER(BPF_OBJ_PIN)): Check the length, skip
printing the rest of attributes if it is less than offset of the
end of the bpf_fd field, print file_flags field otherwise.
(DEF_BPF_CMD_DECODER(BPF_PROG_GET_NEXT_ID),
DEF_BPF_CMD_DECODER(BPF_PROG_GET_FD_BY_ID),
DEF_BPF_CMD_DECODER(BPF_MAP_GET_FD_BY_ID)): Check the length, skip
printing the rest of attributes if it is less than offset of the
end of the next_id field, print open_flags field otherwise.
* xlat/bpf_file_mode_flags.in: New file.
* tests/bpf.c (BPF_OBJ_PIN_checks, BPF_PROG_GET_NEXT_ID_checks,
BPF_PROG_GET_FD_BY_ID_checks, BPF_MAP_GET_FD_BY_ID_checks): Check it.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
bpf.c
bpf_attr.h
tests/bpf.c
xlat/bpf_file_mode_flags.in [new file with mode: 0644]