History

bpf: Clarify data_len param in bpf_snprintf and bpf_seq_printf comments

Since the data_len in these two functions is a byte len of the preceding u64 *data array, it must always be a multiple of 8. If this isn't the case both helpers error out, so let's make the requirement explicit so users don't need to infer it.

Dave Marchevsky committed 5 years ago

Commit a42effb1 parent 76067292 files · +6 −4Browse files

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

Unified · Split

tools/include/uapi/linux/bpf.h+3−2
@@ -4046,7 +4046,7 @@ union bpf_attr { · 4045 unmodified lines
4046 * arguments. The *data* are a **u64** array and corresponding format string4046 * arguments. The *data* are a **u64** array and corresponding format string
4047 * values are stored in the array. For strings and pointers where pointees4047 * values are stored in the array. For strings and pointers where pointees
4048 * are accessed, only the pointer values are stored in the *data* array.4048 * are accessed, only the pointer values are stored in the *data* array.
4049 * The *data_len* is the size of *data* in bytes.4049 * The *data_len* is the size of *data* in bytes - must be a multiple of 8.
4050 *4050 *
4051 * Formats **%s**, **%p{i,I}{4,6}** requires to read kernel memory.4051 * Formats **%s**, **%p{i,I}{4,6}** requires to read kernel memory.
4052 * Reading kernel memory may fail due to either invalid address or4052 * Reading kernel memory may fail due to either invalid address or
@@ -4751,7 +4751,8 @@ union bpf_attr { · 698 unmodified lines
4751 * Each format specifier in **fmt** corresponds to one u64 element4751 * Each format specifier in **fmt** corresponds to one u64 element
4752 * in the **data** array. For strings and pointers where pointees4752 * in the **data** array. For strings and pointers where pointees
4753 * are accessed, only the pointer values are stored in the *data*4753 * are accessed, only the pointer values are stored in the *data*
4754 * array. The *data_len* is the size of *data* in bytes.4754 * array. The *data_len* is the size of *data* in bytes - must be
4755 * a multiple of 8.
4755 *4756 *
4756 * Formats **%s** and **%p{i,I}{4,6}** require to read kernel4757 * Formats **%s** and **%p{i,I}{4,6}** require to read kernel
4757 * memory. Reading kernel memory may fail due to either invalid4758 * memory. Reading kernel memory may fail due to either invalid