diff options
author | Andrey Ignatov <rdna@fb.com> | 2019-03-08 05:38:43 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-04-12 23:54:58 +0300 |
commit | 4e63acdff864654cee0ac5aaeda3913798ee78f6 (patch) | |
tree | 85e2cff7f791e8e98dfcca646211ccc1278de61e /include/linux/filter.h | |
parent | 1d11b3016cec4ed9770b98e82a61708c8f4926e7 (diff) | |
download | linux-4e63acdff864654cee0ac5aaeda3913798ee78f6.tar.xz |
bpf: Introduce bpf_sysctl_{get,set}_new_value helpers
Add helpers to work with new value being written to sysctl by user
space.
bpf_sysctl_get_new_value() copies value being written to sysctl into
provided buffer.
bpf_sysctl_set_new_value() overrides new value being written by user
space with a one from provided buffer. Buffer should contain string
representation of the value, similar to what can be seen in /proc/sys/.
Both helpers can be used only on sysctl write.
File position matters and can be managed by an interface that will be
introduced separately. E.g. if user space calls sys_write to a file in
/proc/sys/ at file position = X, where X > 0, then the value set by
bpf_sysctl_set_new_value() will be written starting from X. If program
wants to override whole value with specified buffer, file position has
to be set to zero.
Documentation for the new helpers is provided in bpf.h UAPI.
Signed-off-by: Andrey Ignatov <rdna@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux/filter.h')
-rw-r--r-- | include/linux/filter.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index f254ff92819f..a23653f9460c 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -1184,6 +1184,9 @@ struct bpf_sysctl_kern { struct ctl_table *table; void *cur_val; size_t cur_len; + void *new_val; + size_t new_len; + int new_updated; int write; }; |