OSDN Git Service

bpf: Add flags arg to bpf_dynptr_read and bpf_dynptr_write APIs
authorJoanne Koong <joannelkoong@gmail.com>
Wed, 6 Jul 2022 23:25:47 +0000 (16:25 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 8 Jul 2022 08:55:53 +0000 (10:55 +0200)
commitf8d3da4ef8faf027261e06b7864583930dd7c7b9
tree0fb8804ab06a3d8ee67e9a90223680d8e31b4981
parent0326195f523a549e0a9d7fd44c70b26fd7265090
bpf: Add flags arg to bpf_dynptr_read and bpf_dynptr_write APIs

Commit 13bbbfbea759 ("bpf: Add bpf_dynptr_read and bpf_dynptr_write")
added the bpf_dynptr_write() and bpf_dynptr_read() APIs.

However, it will be needed for some dynptr types to pass in flags as
well (e.g. when writing to a skb, the user may like to invalidate the
hash or recompute the checksum).

This patch adds a "u64 flags" arg to the bpf_dynptr_read() and
bpf_dynptr_write() APIs before their UAPI signature freezes where
we then cannot change them anymore with a 5.19.x released kernel.

Fixes: 13bbbfbea759 ("bpf: Add bpf_dynptr_read and bpf_dynptr_write")
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/20220706232547.4016651-1-joannelkoong@gmail.com
include/uapi/linux/bpf.h
kernel/bpf/helpers.c
tools/include/uapi/linux/bpf.h
tools/testing/selftests/bpf/progs/dynptr_fail.c
tools/testing/selftests/bpf/progs/dynptr_success.c