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 include/uapi (1 of 5 files). Show all
Unified · Split
| @@ -5222,22 +5222,25 @@ union bpf_attr { · 5221 unmodified lines | |||
| 5222 | * Return | 5222 | * Return |
| 5223 | * Nothing. Always succeeds. | 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 | * Description | 5226 | * Description |
| 5227 | * Read *len* bytes from *src* into *dst*, starting from *offset* | 5227 | * Read *len* bytes from *src* into *dst*, starting from *offset* |
| 5228 | * into *src*. | 5228 | * into *src*. |
| 5229 | * *flags* is currently unused. | ||
| 5229 | * Return | 5230 | * Return |
| 5230 | * 0 on success, -E2BIG if *offset* + *len* exceeds the length | 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 | * Description | 5236 | * Description |
| 5235 | * Write *len* bytes from *src* into *dst*, starting from *offset* | 5237 | * Write *len* bytes from *src* into *dst*, starting from *offset* |
| 5236 | * into *dst*. | 5238 | * into *dst*. |
| 5239 | * *flags* is currently unused. | ||
| 5237 | * Return | 5240 | * Return |
| 5238 | * 0 on success, -E2BIG if *offset* + *len* exceeds the length | 5241 | * 0 on success, -E2BIG if *offset* + *len* exceeds the length |
| 5239 | * of *dst*'s data, -EINVAL if *dst* is an invalid dynptr or if *dst* | 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 | * void *bpf_dynptr_data(struct bpf_dynptr *ptr, u32 offset, u32 len) | 5245 | * void *bpf_dynptr_data(struct bpf_dynptr *ptr, u32 offset, u32 len) |
| 5243 | * Description | 5246 | * Description |