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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/21/25 3:52 AM, Jakub Sitnicki wrote:
@@ -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.

  		seen_direct_write = env->seen_direct_write;
  		is_rdonly = !may_access_direct_pkt_data(env, NULL, BPF_WRITE);

is_rdonly is always false here.

- 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;
+		}

[ ... ]

+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.

+				    struct bpf_dynptr *ptr__uninit)
+{
+	return dynptr_from_skb_meta(skb, flags, ptr__uninit, true);
+}




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux