From: Alexei Starovoitov Date: Mon, 13 Mar 2023 23:58:43 +0000 (-0700) Subject: bpf: Fix bpf_strncmp proto. X-Git-Tag: v6.6.7~2736^2~129^2~89^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9267aa8b794c2188d49c7d7bd2990e98b2d6b84;p=platform%2Fkernel%2Flinux-starfive.git bpf: Fix bpf_strncmp proto. bpf_strncmp() doesn't write into its first argument. Make sure that the verifier knows about it. Signed-off-by: Alexei Starovoitov Acked-by: David Vernet Link: https://lore.kernel.org/r/20230313235845.61029-2-alexei.starovoitov@gmail.com Signed-off-by: Martin KaFai Lau --- diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 77d64b6..f753676 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, };