]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpf: Disable unsafe helpers in TX timestamping callbacks
authorJason Xing <kerneljasonxing@gmail.com>
Thu, 20 Feb 2025 07:29:32 +0000 (15:29 +0800)
committerMartin KaFai Lau <martin.lau@kernel.org>
Thu, 20 Feb 2025 22:29:10 +0000 (14:29 -0800)
commit2958624b25305142e24203165ff65409ba9dd9d7
tree5d1bb28eae490c7f297b47f3c7f7056a47b2871f
parentfd93eaffb3f977b23bc0a48d4c8616e654fcf133
bpf: Disable unsafe helpers in TX timestamping callbacks

New TX timestamping sock_ops callbacks will be added in the
subsequent patch. Some of the existing BPF helpers will not
be safe to be used in the TX timestamping callbacks.

The bpf_sock_ops_setsockopt, bpf_sock_ops_getsockopt, and
bpf_sock_ops_cb_flags_set require owning the sock lock. TX
timestamping callbacks will not own the lock.

The bpf_sock_ops_load_hdr_opt needs the skb->data pointing
to the TCP header. This will not be true in the TX timestamping
callbacks.

At the beginning of these helpers, this patch checks the
bpf_sock->op to ensure these helpers are used by the existing
sock_ops callbacks only.

Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20250220072940.99994-5-kerneljasonxing@gmail.com
net/core/filter.c