diff options
| author | Paul Chaignon <paul.chaignon@gmail.com> | 2023-10-02 12:25:14 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2023-10-16 15:57:22 +0000 |
| commit | 93789af44b9ab48817ad60d9e8657bc46eea6202 (patch) | |
| tree | 790b66270ccb748b631c680ef9435062fa2d6612 /sys/linux/dev_input.txt.const | |
| parent | f207cf3a9909835b51338b0ba481725a72becdbc (diff) | |
sys/linux: describe map holding constant string
This goal of this commit is to prepare a map whose value will be of type
ARG_PTR_TO_CONST_STR when seen by the BPF verifier [1]. To that end, the
map must be read-only, of a type that allows direct map value access
(only array maps), and frozen. In addition, it must contains a
zero-terminated string as its value.
This commit therefore defines a new bpf$MAP_CREATE_CONST_STR syscall
description to create a read-only array map of fixed size. A new
bpf$MAP_UPDATE_CONST_STR syscall description then updates the map with
a zero-terminated string. Finally, bpf$BPF_MAP_CONST_STR_FREEZE freezes
the map to prevent any other updates from the syscall side (BPF side
updates are already prevented since the map is read-only).
As a result, we want to end up with an fd to a map that has been
created, updated, and frozen. To guarantee that all operations have been
carried out (in the correct order) on the map, we change the map fd
after each operation with the following example syntax:
map_bpf_const_str {
in fd_bpf_const_str_map
out fd_bpf_const_str (out_overlay)
}
The 'in' fd is passed on entry to bpf$MAP_UPDATE_CONST_STR and the 'out'
fd is returned. In practice, the fd value will not be changed, but this
description allows us to reference the fd_bpf_const_str type in
subsequent operations, thus ensuring we're using an fd to an updated
map.
1 - https://github.com/torvalds/linux/blob/8a749fd1a8720d4619c91c8b6e7528c0a355c0aa/kernel/bpf/verifier.c#L8334
Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
Diffstat (limited to 'sys/linux/dev_input.txt.const')
0 files changed, 0 insertions, 0 deletions
