has to have BTF in order to use bpf_spin_lock
Okabe-Rintarou-0 opened this issue · 5 comments
Is there an existing issue for this?
- I have searched the existing issues
Version
higher than v1.14.13 and lower than v1.15.0
What happened?
use bpf2go, met verifier error: has to have BTF in order to use bpf_spin_lock
struct cluster_stats_key {
__u64 netns_cookie;
__u32 cluster_id;
};
struct {
__uint(type, BPF_MAP_TYPE_HASH);
__uint(key_size, sizeof(struct cluster_stats_key));
__uint(value_size, sizeof(struct cluster_stats));
__uint(map_flags, BPF_F_NO_PREALLOC);
__uint(max_entries, MAP_SIZE_OF_CLUSTER);
} map_of_cluster_stats SEC(".maps");
struct cluster_sock_data {
__u32 cluster_id;
};
struct {
__uint(type, BPF_MAP_TYPE_SK_STORAGE);
__uint(map_flags, BPF_F_NO_PREALLOC);
__type(key, int);
__type(value, struct cluster_sock_data);
} map_of_cluster_sock SEC(".maps");
bpf_spin_lock(&stats->lock);
stats->active_connections += delta;
bpf_spin_unlock((&stats->lock);
How can we reproduce the issue?
run the code above
Cilium Version
v0.15.0
Kernel Version
6.19
Kubernetes Version
1.23.17
Regression
No response
Sysdump
No response
Relevant log output
No response
Anything else?
No response
Cilium Users Document
- Are you a user of Cilium? Please add yourself to the Users doc
Code of Conduct
- I agree to follow this project's Code of Conduct
What command were you running that caused this issue? Are you doing development, or did you experience this while deploying Cilium?
i am using bpf2go:
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags -O0 -g --cflags -D__x86_64__ KmeshSockops ../ads/sockops.c -- -I../ads/include -I../../include -I../../../api/v2-c
maybe i am in the wrong place, i should put the issue in cilium/ebpf
The code snippet seems to be incomplete, which is likely to hinder any response. Specifically, it doesn't look fully formed and I see references to a stats
variable that isn't declared in the code snippet.
I've moved this tentatively over to cilium/ebpf, although it's not clear to me whether this is related to the library at all.
It's not clear to me what the problem is, since both the code and any error messages are incomplete. Closing this since it's unlikely to be a bug or issue with the lib. If you have questions around how to use spinlocks with the lib, please search our GH discussions (https://github.com/cilium/ebpf/discussions) or create a new one.