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
374374 struct { /* anonymous struct used by BPF_PROG_TEST_RUN command */
375375 __u32 prog_fd;
376376 __u32 retval;
377− __u32 data_size_in;
378− __u32 data_size_out;
377+ __u32 data_size_in; /* input: len of data_in */
378+ __u32 data_size_out; /* input/output: len of data_out
379+ * returns ENOSPC if data_out
380+ * is too small.
381+ */
379382 __aligned_u64 data_in;
380383 __aligned_u64 data_out;
381384 __u32 repeat;