Re: [PATCH bpf-next v5 2/5] bpf: tcp: Mark bpf_load_hdr_opt() arg2 as read-write

From: Martin KaFai Lau
Date: Mon Dec 16 2024 - 13:23:37 EST


On 12/12/24 3:22 PM, Daniel Xu wrote:
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.

Acked-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx>