Skip to content

Commit 528ec8c

Browse files
authored
Merge pull request #534 from msherif1234/fix_4.15_verifier_err
NETOBSERV-2051: Fix eBPF verifier errors with 5.14.0-284.71.1.el9_2
2 parents dd5826d + ecdb483 commit 528ec8c

File tree

9 files changed

+36
-36
lines changed

9 files changed

+36
-36
lines changed

bpf/flows.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,15 @@ static inline int flow_monitor(struct __sk_buff *skb, u8 direction) {
239239
if (extra_metrics != NULL) {
240240
update_dns(extra_metrics, &pkt, dns_errno);
241241
} else {
242-
additional_metrics new_metrics = {
243-
.start_mono_time_ts = pkt.current_ts,
244-
.end_mono_time_ts = pkt.current_ts,
245-
.eth_protocol = eth_protocol,
246-
.dns_record.id = pkt.dns_id,
247-
.dns_record.flags = pkt.dns_flags,
248-
.dns_record.latency = pkt.dns_latency,
249-
.dns_record.errno = dns_errno,
250-
};
242+
additional_metrics new_metrics;
243+
__builtin_memset(&new_metrics, 0, sizeof(new_metrics));
244+
new_metrics.start_mono_time_ts = pkt.current_ts;
245+
new_metrics.end_mono_time_ts = pkt.current_ts;
246+
new_metrics.eth_protocol = eth_protocol;
247+
new_metrics.dns_record.id = pkt.dns_id;
248+
new_metrics.dns_record.flags = pkt.dns_flags;
249+
new_metrics.dns_record.latency = pkt.dns_latency;
250+
new_metrics.dns_record.errno = dns_errno;
251251
long ret =
252252
bpf_map_update_elem(&additional_flow_metrics, &id, &new_metrics, BPF_NOEXIST);
253253
if (ret != 0) {

bpf/network_events_monitoring.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ static inline int trace_network_events(struct sk_buff *skb, struct rh_psample_me
106106

107107
// there is no matching flows so lets create new one and add the network event metadata
108108
u64 current_time = bpf_ktime_get_ns();
109-
additional_metrics new_flow = {
110-
.start_mono_time_ts = current_time,
111-
.end_mono_time_ts = current_time,
112-
.eth_protocol = eth_protocol,
113-
.network_events_idx = 0,
114-
};
109+
additional_metrics new_flow;
110+
__builtin_memset(&new_flow, 0, sizeof(new_flow));
111+
new_flow.start_mono_time_ts = current_time;
112+
new_flow.end_mono_time_ts = current_time;
113+
new_flow.eth_protocol = eth_protocol;
114+
new_flow.network_events_idx = 0;
115115
bpf_probe_read_kernel(new_flow.network_events[0], md_len, user_cookie);
116116
new_flow.network_events_idx++;
117117
ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_flow, BPF_NOEXIST);

bpf/pkt_drops.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ static inline int trace_pkt_drop(void *ctx, u8 state, struct sk_buff *skb,
7575
}
7676
// there is no matching flows so lets create new one and add the drops
7777
u64 current_time = bpf_ktime_get_ns();
78-
additional_metrics new_flow = {
79-
.start_mono_time_ts = current_time,
80-
.end_mono_time_ts = current_time,
81-
.eth_protocol = eth_protocol,
82-
.pkt_drops.packets = 1,
83-
.pkt_drops.bytes = len,
84-
.pkt_drops.latest_state = state,
85-
.pkt_drops.latest_flags = flags,
86-
.pkt_drops.latest_drop_cause = reason,
87-
};
78+
additional_metrics new_flow;
79+
__builtin_memset(&new_flow, 0, sizeof(new_flow));
80+
new_flow.start_mono_time_ts = current_time;
81+
new_flow.end_mono_time_ts = current_time;
82+
new_flow.eth_protocol = eth_protocol;
83+
new_flow.pkt_drops.packets = 1;
84+
new_flow.pkt_drops.bytes = len;
85+
new_flow.pkt_drops.latest_state = state;
86+
new_flow.pkt_drops.latest_flags = flags;
87+
new_flow.pkt_drops.latest_drop_cause = reason;
8888
ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_flow, BPF_NOEXIST);
8989
if (ret != 0) {
9090
if (trace_messages && ret != -EEXIST) {

bpf/pkt_translation.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ static inline long translate_lookup_and_update_flow(flow_id *id, u16 flags,
9494
}
9595

9696
// there is no matching flows so lets create new one and add the xlation
97-
additional_metrics new_extra_metrics = {
98-
.start_mono_time_ts = current_time,
99-
.end_mono_time_ts = current_time,
100-
.eth_protocol = eth_protocol,
101-
};
97+
additional_metrics new_extra_metrics;
98+
__builtin_memset(&new_extra_metrics, 0, sizeof(new_extra_metrics));
99+
new_extra_metrics.start_mono_time_ts = current_time;
100+
new_extra_metrics.end_mono_time_ts = current_time;
101+
new_extra_metrics.eth_protocol = eth_protocol;
102102
parse_tuple(reply_t, &new_extra_metrics.translated_flow, zone_id, family,
103103
id->transport_protocol, true);
104104
ret = bpf_map_update_elem(&additional_flow_metrics, id, &new_extra_metrics, BPF_NOEXIST);

bpf/rtt_tracker.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ static inline int calculate_flow_rtt_tcp(struct sock *sk, struct sk_buff *skb) {
7171
}
7272

7373
u64 current_time = bpf_ktime_get_ns();
74-
additional_metrics new_flow = {
75-
.start_mono_time_ts = current_time,
76-
.end_mono_time_ts = current_time,
77-
.eth_protocol = eth_protocol,
78-
.flow_rtt = rtt,
79-
};
74+
additional_metrics new_flow;
75+
__builtin_memset(&new_flow, 0, sizeof(new_flow));
76+
new_flow.start_mono_time_ts = current_time;
77+
new_flow.end_mono_time_ts = current_time;
78+
new_flow.eth_protocol = eth_protocol;
79+
new_flow.flow_rtt = rtt;
8080
ret = bpf_map_update_elem(&additional_flow_metrics, &id, &new_flow, BPF_NOEXIST);
8181
if (ret != 0) {
8282
if (trace_messages && ret != -EEXIST) {

pkg/ebpf/bpf_arm64_bpfel.o

1.09 KB
Binary file not shown.

pkg/ebpf/bpf_powerpc_bpfel.o

1.1 KB
Binary file not shown.

pkg/ebpf/bpf_s390_bpfeb.o

1.09 KB
Binary file not shown.

pkg/ebpf/bpf_x86_bpfel.o

1.09 KB
Binary file not shown.

0 commit comments

Comments
 (0)