Thread (1 message) 1 message, 1 author, 2025-07-23

Re: [PATCH bpf-next v3 01/10] bpf: Add dynptr type for skb metadata

From: Jakub Sitnicki <jakub@cloudflare.com>
Date: 2025-07-23 09:02:47
Also in: bpf

On Tue, Jul 22, 2025 at 05:37 PM -07, Martin KaFai Lau wrote:
On 7/21/25 3:52 AM, Jakub Sitnicki wrote:
quoted
@@ -21788,12 +21798,17 @@ static void specialize_kfunc(struct bpf_verifier_env *env,
  	if (offset)
  		return;
  -	if (func_id == special_kfunc_list[KF_bpf_dynptr_from_skb]) {
+	if (func_id == special_kfunc_list[KF_bpf_dynptr_from_skb] ||
+	    func_id == special_kfunc_list[KF_bpf_dynptr_from_skb_meta]) {
I don't think this check is needed. The skb_meta is writable to tc.
quoted
  		seen_direct_write = env->seen_direct_write;
  		is_rdonly = !may_access_direct_pkt_data(env, NULL, BPF_WRITE);
is_rdonly is always false here.
quoted
  -		if (is_rdonly)
-			*addr = (unsigned long)bpf_dynptr_from_skb_rdonly;
+		if (is_rdonly) {
+			if (func_id == special_kfunc_list[KF_bpf_dynptr_from_skb])
+				*addr = (unsigned long)bpf_dynptr_from_skb_rdonly;
+			else if (func_id == special_kfunc_list[KF_bpf_dynptr_from_skb_meta])
+				*addr = (unsigned long)bpf_dynptr_from_skb_meta_rdonly;
+		}
[ ... ]
quoted
+int bpf_dynptr_from_skb_meta_rdonly(struct __sk_buff *skb, u64 flags,
so I suspect this is never used and not needed now. Please check.
It can be revisited in the future when other hooks are supported. It will be a
useful comment in the commit message.
You're right. This is dead code ATM. I missed that. Will remove.

[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help