summaryrefslogtreecommitdiffstats
path: root/include/uapi/linux/bpf.h
diff options
context:
space:
mode:
authorAndrey Ignatov2019-03-08 03:50:52 +0100
committerAlexei Starovoitov2019-04-12 22:54:58 +0200
commite1550bfe0de47e30484ba91de1e50a91ec1c31f5 (patch)
tree417b3aa59134dff973b0b59f0cfdc1460284aed9 /include/uapi/linux/bpf.h
parentbpf: Introduce bpf_sysctl_{get,set}_new_value helpers (diff)
downloadkernel-qcow2-linux-e1550bfe0de47e30484ba91de1e50a91ec1c31f5.tar.gz
kernel-qcow2-linux-e1550bfe0de47e30484ba91de1e50a91ec1c31f5.tar.xz
kernel-qcow2-linux-e1550bfe0de47e30484ba91de1e50a91ec1c31f5.zip
bpf: Add file_pos field to bpf_sysctl ctx
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. Signed-off-by: Andrey Ignatov <rdna@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/uapi/linux/bpf.h')
-rw-r--r--include/uapi/linux/bpf.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 547b8258d731..89976de909af 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -3391,6 +3391,9 @@ struct bpf_sysctl {
__u32 write; /* Sysctl is being read (= 0) or written (= 1).
* Allows 1,2,4-byte read, but no write.
*/
+ __u32 file_pos; /* Sysctl file position to read from, write to.
+ * Allows 1,2,4-byte read an 4-byte write.
+ */
};
#endif /* _UAPI__LINUX_BPF_H__ */