};
 
 int bpf_dynptr_check_size(u32 size);
-u32 bpf_dynptr_get_size(const struct bpf_dynptr_kern *ptr);
+u32 __bpf_dynptr_size(const struct bpf_dynptr_kern *ptr);
 
 #ifdef CONFIG_BPF_JIT
 int bpf_trampoline_link_prog(struct bpf_tramp_link *link, struct bpf_trampoline *tr);
 
        return (ptr->size & ~(DYNPTR_RDONLY_BIT)) >> DYNPTR_TYPE_SHIFT;
 }
 
-u32 bpf_dynptr_get_size(const struct bpf_dynptr_kern *ptr)
+u32 __bpf_dynptr_size(const struct bpf_dynptr_kern *ptr)
 {
        return ptr->size & DYNPTR_SIZE_MASK;
 }
 
 static int bpf_dynptr_check_off_len(const struct bpf_dynptr_kern *ptr, u32 offset, u32 len)
 {
-       u32 size = bpf_dynptr_get_size(ptr);
+       u32 size = __bpf_dynptr_size(ptr);
 
        if (len > size || offset > size - len)
                return -E2BIG;
        if (!ptr->data || start > end)
                return -EINVAL;
 
-       size = bpf_dynptr_get_size(ptr);
+       size = __bpf_dynptr_size(ptr);
 
        if (start > size || end > size)
                return -ERANGE;
        return __bpf_dynptr_is_rdonly(ptr);
 }
 
+__bpf_kfunc __u32 bpf_dynptr_size(const struct bpf_dynptr_kern *ptr)
+{
+       if (!ptr->data)
+               return -EINVAL;
+
+       return __bpf_dynptr_size(ptr);
+}
+
 __bpf_kfunc void *bpf_cast_to_kern_ctx(void *obj)
 {
        return obj;
 BTF_ID_FLAGS(func, bpf_dynptr_adjust)
 BTF_ID_FLAGS(func, bpf_dynptr_is_null)
 BTF_ID_FLAGS(func, bpf_dynptr_is_rdonly)
+BTF_ID_FLAGS(func, bpf_dynptr_size)
 BTF_SET8_END(common_btf_ids)
 
 static const struct btf_kfunc_id_set common_kfunc_set = {
 
        }
 
        return verify_pkcs7_signature(data_ptr->data,
-                                     bpf_dynptr_get_size(data_ptr),
+                                     __bpf_dynptr_size(data_ptr),
                                      sig_ptr->data,
-                                     bpf_dynptr_get_size(sig_ptr),
+                                     __bpf_dynptr_size(sig_ptr),
                                      trusted_keyring->key,
                                      VERIFYING_UNSPECIFIED_SIGNATURE, NULL,
                                      NULL);