History

bpf: respect size hint to BPF_PROG_TEST_RUN if present

Use data_size_out as a size hint when copying test output to user space. ENOSPC is returned if the output buffer is too small. Callers which so far did not set data_size_out are not affected.

Lorenz Bauer committed 7 years ago

Commit b5a36b11 parent d59dd692 files · +18 −4Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/bpf.h+5−2
@@ -374,8 +374,11 @@ union bpf_attr { · 373 unmodified lines
374 struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */374 struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */
375 __u32 prog_fd;375 __u32 prog_fd;
376 __u32 retval;376 __u32 retval;
377 __u32 data_size_in;377 __u32 data_size_in; /* input: len of data_in */
378 __u32 data_size_out;378 __u32 data_size_out; /* input/output: len of data_out
379 * returns ENOSPC if data_out
380 * is too small.
381 */
379 __aligned_u64 data_in;382 __aligned_u64 data_in;
380 __aligned_u64 data_out;383 __aligned_u64 data_out;
381 __u32 repeat;384 __u32 repeat;