On Mon, Dec 6, 2021 at 3:22 PM Hao Luo <haoluo@xxxxxxxxxx> wrote: > > This patch introduce a flag MEM_RDONLY to tag a reg value > pointing to read-only memory. It makes the following changes: > > 1. PTR_TO_RDWR_BUF -> PTR_TO_BUF > 2. PTR_TO_RDONLY_BUF -> PTR_TO_BUF | MEM_RDONLY > > Signed-off-by: Hao Luo <haoluo@xxxxxxxxxx> > --- > include/linux/bpf.h | 8 +++-- > kernel/bpf/btf.c | 3 +- > kernel/bpf/map_iter.c | 4 +-- > kernel/bpf/verifier.c | 76 +++++++++++++++++++++++---------------- > net/core/bpf_sk_storage.c | 2 +- > net/core/sock_map.c | 2 +- > 6 files changed, 55 insertions(+), 40 deletions(-) > [...] > static bool arg_type_may_be_refcounted(enum bpf_arg_type type) > { > return type == ARG_PTR_TO_SOCK_COMMON; > @@ -541,8 +546,7 @@ static const char *reg_type_str(enum bpf_reg_type type) > [PTR_TO_BTF_ID] = "ptr_", > [PTR_TO_PERCPU_BTF_ID] = "percpu_ptr_", > [PTR_TO_MEM] = "mem", > - [PTR_TO_RDONLY_BUF] = "rdonly_buf", > - [PTR_TO_RDWR_BUF] = "rdwr_buf", > + [PTR_TO_BUF] = "rdwr_buf", super misleading if it's actually read-only... > [PTR_TO_FUNC] = "func", > [PTR_TO_MAP_KEY] = "map_key", > }; [...]