Add file_pos field to bpf_sysctl context to read and write sysctl file position at which sysctl is being accessed (read or written). The field can be used to e.g. override whole sysctl value on write to sysctl even when sys_write is called by user space with file_pos > 0. Or BPF program may reject such accesses.
Showing the changes to include/uapi/linux (1 of 5 files). Show all
Unified · Split
| @@ -3391,6 +3391,9 @@ struct bpf_sysctl { · 3390 unmodified lines | |||
| 3391 | __u32 write; /* Sysctl is being read (= 0) or written (= 1). | 3391 | __u32 write; /* Sysctl is being read (= 0) or written (= 1). |
| 3392 | * Allows 1,2,4-byte read, but no write. | 3392 | * Allows 1,2,4-byte read, but no write. |
| 3393 | */ | 3393 | */ |
| 3394 | __u32 file_pos; /* Sysctl file position to read from, write to. | ||
| 3395 | * Allows 1,2,4-byte read an 4-byte write. | ||
| 3396 | */ | ||
| 3394 | }; | 3397 | }; |
| 3395 | 3398 | ||
| 3396 | #endif /* _UAPI__LINUX_BPF_H__ */ | 3399 | #endif /* _UAPI__LINUX_BPF_H__ */ |