summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHao Luo <haoluo@google.com>2021-12-16 16:31:48 -0800
committerAlexei Starovoitov <ast@kernel.org>2021-12-18 13:27:41 -0800
commit20b2aff4bc15bda809f994761d5719827d66c0b4 (patch)
tree56ef53fccf3a9be91909c3dc2cd36068043acc68 /net
parentc25b2ae136039ffa820c26138ed4a5e5f3ab3841 (diff)
downloadlinux-20b2aff4bc15bda809f994761d5719827d66c0b4.tar.gz
linux-20b2aff4bc15bda809f994761d5719827d66c0b4.tar.bz2
linux-20b2aff4bc15bda809f994761d5719827d66c0b4.zip
bpf: Introduce MEM_RDONLY flag
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@google.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20211217003152.48334-6-haoluo@google.com
Diffstat (limited to 'net')
-rw-r--r--net/core/bpf_sk_storage.c2
-rw-r--r--net/core/sock_map.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c
index 4cb5ef8eddbc..ea61dfe19c86 100644
--- a/net/core/bpf_sk_storage.c
+++ b/net/core/bpf_sk_storage.c
@@ -929,7 +929,7 @@ static struct bpf_iter_reg bpf_sk_storage_map_reg_info = {
{ offsetof(struct bpf_iter__bpf_sk_storage_map, sk),
PTR_TO_BTF_ID_OR_NULL },
{ offsetof(struct bpf_iter__bpf_sk_storage_map, value),
- PTR_TO_RDWR_BUF | PTR_MAYBE_NULL },
+ PTR_TO_BUF | PTR_MAYBE_NULL },
},
.seq_info = &iter_seq_info,
};
diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index 96d4ea7e6918..9618ab6d7cc9 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -1564,7 +1564,7 @@ static struct bpf_iter_reg sock_map_iter_reg = {
.ctx_arg_info_size = 2,
.ctx_arg_info = {
{ offsetof(struct bpf_iter__sockmap, key),
- PTR_TO_RDONLY_BUF | PTR_MAYBE_NULL },
+ PTR_TO_BUF | PTR_MAYBE_NULL | MEM_RDONLY },
{ offsetof(struct bpf_iter__sockmap, sk),
PTR_TO_BTF_ID_OR_NULL },
},