Commit 13bbbfbea759 ("bpf: Add bpf_dynptr_read and bpf_dynptr_write") added the bpf_dynptr_write() and bpf_dynptr_read() APIs. However, it will be needed for some dynptr types to pass in flags as well (e.g. when writing to a skb, the user may like to invalidate the hash or recompute the checksum). This patch adds a "u64 flags" arg to the bpf_dynptr_read() and bpf_dynptr_write() APIs before their UAPI signature freezes where we then cannot change them anymore with a 5.19.x released kernel.
Showing the changes to tools/include/uapi/linux (1 of 5 files). Show all
Unified · Split
| @@ -5222,22 +5222,25 @@ union bpf_attr { · 5221 unmodified lines | ||
| 5222 | 5222 | * Return |
| 5223 | 5223 | * Nothing. Always succeeds. |
| 5224 | 5224 | * |
| 5225 | − * long bpf_dynptr_read(void *dst, u32 len, struct bpf_dynptr *src, u32 offset) | |
| 5225 | + * long bpf_dynptr_read(void *dst, u32 len, struct bpf_dynptr *src, u32 offset, u64 flags) | |
| 5226 | 5226 | * Description |
| 5227 | 5227 | * Read *len* bytes from *src* into *dst*, starting from *offset* |
| 5228 | 5228 | * into *src*. |
| 5229 | + * *flags* is currently unused. | |
| 5229 | 5230 | * Return |
| 5230 | 5231 | * 0 on success, -E2BIG if *offset* + *len* exceeds the length |
| 5231 | − * of *src*'s data, -EINVAL if *src* is an invalid dynptr. | |
| 5232 | + * of *src*'s data, -EINVAL if *src* is an invalid dynptr or if | |
| 5233 | + * *flags* is not 0. | |
| 5232 | 5234 | * |
| 5233 | − * long bpf_dynptr_write(struct bpf_dynptr *dst, u32 offset, void *src, u32 len) | |
| 5235 | + * long bpf_dynptr_write(struct bpf_dynptr *dst, u32 offset, void *src, u32 len, u64 flags) | |
| 5234 | 5236 | * Description |
| 5235 | 5237 | * Write *len* bytes from *src* into *dst*, starting from *offset* |
| 5236 | 5238 | * into *dst*. |
| 5239 | + * *flags* is currently unused. | |
| 5237 | 5240 | * Return |
| 5238 | 5241 | * 0 on success, -E2BIG if *offset* + *len* exceeds the length |
| 5239 | 5242 | * of *dst*'s data, -EINVAL if *dst* is an invalid dynptr or if *dst* |
| 5240 | − * is a read-only dynptr. | |
| 5243 | + * is a read-only dynptr or if *flags* is not 0. | |
| 5241 | 5244 | * |
| 5242 | 5245 | * void *bpf_dynptr_data(struct bpf_dynptr *ptr, u32 offset, u32 len) |
| 5243 | 5246 | * Description |