diff options
author | Jordan Rome <linux@jordanrome.com> | 2024-08-23 12:51:00 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2024-08-23 15:40:01 -0700 |
commit | 65ab5ac4df012388481d0414fcac1d5ac1721fb3 (patch) | |
tree | 2f677483b768b820295a519019d1b11b3a30c7b6 /tools/include/uapi | |
parent | 5772c3458bb8d17d763e0f411e1bae1bf4eda88d (diff) |
bpf: Add bpf_copy_from_user_str kfunc
This adds a kfunc wrapper around strncpy_from_user,
which can be called from sleepable BPF programs.
This matches the non-sleepable 'bpf_probe_read_user_str'
helper except it includes an additional 'flags'
param, which allows consumers to clear the entire
destination buffer on success or failure.
Signed-off-by: Jordan Rome <linux@jordanrome.com>
Link: https://lore.kernel.org/r/20240823195101.3621028-1-linux@jordanrome.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/include/uapi')
-rw-r--r-- | tools/include/uapi/linux/bpf.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 35bcf52dbc65..f329ee44627a 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -7512,4 +7512,13 @@ struct bpf_iter_num { __u64 __opaque[1]; } __attribute__((aligned(8))); +/* + * Flags to control BPF kfunc behaviour. + * - BPF_F_PAD_ZEROS: Pad destination buffer with zeros. (See the respective + * helper documentation for details.) + */ +enum bpf_kfunc_flags { + BPF_F_PAD_ZEROS = (1ULL << 0), +}; + #endif /* _UAPI__LINUX_BPF_H__ */ |