Skip to content

Commit 07472fa

Browse files
committed
Merge: bpf: tcp: Mark bpf_load_hdr_opt() arg2 as read-write
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/346 JIRA: https://issues.redhat.com/browse/RHEL-78209 commit 8ac412a Author: Daniel Xu <dxu@dxuuu.xyz> Date: Tue Jan 14 13:28:43 2025 -0700 bpf: tcp: Mark bpf_load_hdr_opt() arg2 as read-write MEM_WRITE attribute is defined as: "Non-presence of MEM_WRITE means that MEM is only being read". bpf_load_hdr_opt() both reads and writes from its arg2 - void *search_res. This matters a lot for the next commit where we more precisely track stack accesses. Without this annotation, the verifier will make false assumptions about the contents of memory written to by helpers and possibly prune valid branches. Fixes: 6fad274 ("bpf: Add MEM_WRITE attribute") Acked-by: Martin KaFai Lau <martin.lau@kernel.org> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> Link: https://lore.kernel.org/r/730e45f8c39be2a5f3d8c4406cceca9d574cbf14.1736886479.git.dxu@dxuuu.xyz Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Viktor Malik <vmalik@redhat.com> Approved-by: Tomas Glozar <tglozar@redhat.com> Approved-by: Jerome Marchand <jmarchan@redhat.com> Approved-by: Toke Høiland-Jørgensen <toke@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Jan Stancek <jstancek@redhat.com>
2 parents 0c34fa4 + 43f94cf commit 07472fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/core/filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7639,7 +7639,7 @@ static const struct bpf_func_proto bpf_sock_ops_load_hdr_opt_proto = {
76397639
.gpl_only = false,
76407640
.ret_type = RET_INTEGER,
76417641
.arg1_type = ARG_PTR_TO_CTX,
7642-
.arg2_type = ARG_PTR_TO_MEM,
7642+
.arg2_type = ARG_PTR_TO_MEM | MEM_WRITE,
76437643
.arg3_type = ARG_CONST_SIZE,
76447644
.arg4_type = ARG_ANYTHING,
76457645
};

0 commit comments

Comments
 (0)