Message ID | 20230313235845.61029-2-alexei.starovoitov@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | c9267aa8b794c2188d49c7d7bd2990e98b2d6b84 |
Delegated to: | BPF |
Headers | show |
Series | bpf: Allow helpers access ptr_to_btf_id. | expand |
On Mon, Mar 13, 2023 at 04:58:43PM -0700, Alexei Starovoitov wrote: > From: Alexei Starovoitov <ast@kernel.org> > > bpf_strncmp() doesn't write into its first argument. > Make sure that the verifier knows about it. > > Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: David Vernet <void@manifault.com> > --- > kernel/bpf/helpers.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c > index 77d64b6951b9..f753676ef652 100644 > --- a/kernel/bpf/helpers.c > +++ b/kernel/bpf/helpers.c > @@ -571,7 +571,7 @@ static const struct bpf_func_proto bpf_strncmp_proto = { > .func = bpf_strncmp, > .gpl_only = false, > .ret_type = RET_INTEGER, > - .arg1_type = ARG_PTR_TO_MEM, > + .arg1_type = ARG_PTR_TO_MEM | MEM_RDONLY, > .arg2_type = ARG_CONST_SIZE, > .arg3_type = ARG_PTR_TO_CONST_STR, > }; > -- > 2.34.1 >
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 77d64b6951b9..f753676ef652 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -571,7 +571,7 @@ static const struct bpf_func_proto bpf_strncmp_proto = { .func = bpf_strncmp, .gpl_only = false, .ret_type = RET_INTEGER, - .arg1_type = ARG_PTR_TO_MEM, + .arg1_type = ARG_PTR_TO_MEM | MEM_RDONLY, .arg2_type = ARG_CONST_SIZE, .arg3_type = ARG_PTR_TO_CONST_STR, };