Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrupted bpf_features.h #10857

Closed
pchaigno opened this issue Apr 6, 2020 · 0 comments · Fixed by #10861
Closed

Corrupted bpf_features.h #10857

pchaigno opened this issue Apr 6, 2020 · 0 comments · Fixed by #10861
Assignees
Labels
kind/bug This is a bug in the Cilium logic.
Milestone

Comments

@pchaigno
Copy link
Member

pchaigno commented Apr 6, 2020

2020-04-03T14:27:02.178302737Z level=error msg="Command execution failed" cmd="[/var/lib/cilium/bpf/init.sh /var/lib/cilium/bpf /var/run/cilium/state 10.10.1.165 fd04::12 vxlan enp0s8 <nil> <nil> 1500 false false <nil> true true /var/run/cilium/cgroupv2 /sys/fs/bpf true v2]" error="exit status 1" subsys=datapath-loader
[...]
2020-04-03T14:27:02.180517863Z level=warning msg="+ clang -O2 -target bpf -emit-llvm -Wall -Wextra -Werror -Wno-address-of-packed-member -Wno-unknown-warning-option -Wno-gnu-variable-sized-type-not-at-end -I. -I/run/cilium/state/globals -I/var/lib/cilium/bpf -I/var/lib/cilium/bpf/include -D__NR_CPUS__=2 -DENABLE_ARP_RESPONDER=1 -DHANDLE_NS=1 -DSECLABEL=2 -DLB_L3 -DLB_L4 -DDISABLE_LOOPBACK_LB -DBPF_PKT_DIR=1 '-DNODE_MAC={.addr={0x72,0x3b,0x45,0x3b,0x56,0x9d}}' -DCALLS_MAP=cilium_calls_overlay_2 -c /var/lib/cilium/bpf/bpf_overlay.c -o -" subsys=datapath-loader
2020-04-03T14:27:02.180520664Z level=warning msg="In file included from /var/lib/cilium/bpf/bpf_overlay.c:4:" subsys=datapath-loader
2020-04-03T14:27:02.180522844Z level=warning msg="In file included from /var/lib/cilium/bpf/include/bpf/ctx/skb.h:11:" subsys=datapath-loader
2020-04-03T14:27:02.180525046Z level=warning msg="In file included from /var/lib/cilium/bpf/include/linux/../bpf/helpers_skb.h:11:" subsys=datapath-loader
2020-04-03T14:27:02.180527268Z level=warning msg="In file included from /var/lib/cilium/bpf/include/linux/../bpf/features_skb.h:7:" subsys=datapath-loader
2020-04-03T14:27:02.18052949Z level=warning msg="In file included from /var/lib/cilium/bpf/include/linux/../bpf/features.h:7:" subsys=datapath-loader
2020-04-03T14:27:02.180631807Z level=warning msg="/run/cilium/state/globals/bpf_features.h:3165:60: error: ISO C99 requires whitespace after the macro name [-Werror,-Wc99-extensions]" subsys=datapath-loader
2020-04-03T14:27:02.180638469Z level=warning msg="#define BPF__PROG_TYPE_tracing__HELPER_bpf_probe_read_kerne#endif /* BPF_FEATURES_H_ */" subsys=datapath-loader
2020-04-03T14:27:02.180640895Z level=warning msg="                                                           ^" subsys=datapath-loader
2020-04-03T14:27:02.180643092Z level=warning msg="/run/cilium/state/globals/bpf_features.h:1:2: error: unterminated conditional directive" subsys=datapath-loader
2020-04-03T14:27:02.180649289Z level=warning msg="#ifndef BPF_FEATURES_H_" subsys=datapath-loader
2020-04-03T14:27:02.180652497Z level=warning msg=" ^" subsys=datapath-loader
2020-04-03T14:27:02.180654666Z level=warning msg="2 errors generated." subsys=datapath-loader
2020-04-03T14:27:02.180705683Z level=error msg="Error while initializing daemon" error="exit status 1" subsys=daemon
2020-04-03T14:27:02.18071275Z level=fatal msg="Error while creating daemon" error="exit status 1" subsys=daemon

Noticed in https://jenkins.cilium.io/job/Cilium-PR-Ginkgo-Tests-Validated/18496/testReport/Suite-k8s-1/11/K8sDatapathConfig_MonitorAggregation_Checks_that_monitor_aggregation_restricts_notifications/.

f9f3b3b1_K8sDatapathConfig_MonitorAggregation_Checks_that_monitor_aggregation_restricts_notifications.zip

This is likely happening because, although we wait for the producer command to finish, we don't wait for the consumer goroutine:

io.WriteString(writer, "#ifndef BPF_FEATURES_H_\n")
io.WriteString(writer, "#define BPF_FEATURES_H_\n\n")
go io.Copy(writer, stdoutPipe)
if err := cmd.Wait(); err != nil {
stderr, err := ioutil.ReadAll(stderrPipe)
if err != nil {
return errors.Wrap(err,
"reading from bpftool feature probe stderr pipe failed")
}
return errors.Wrapf(err,
"bpftool feature probe did not run successfully: %s",
stderr)
}
io.WriteString(writer, "#endif /* BPF_FEATURES_H_ */\n")

/cc @mrostecki

@pchaigno pchaigno added the kind/bug This is a bug in the Cilium logic. label Apr 6, 2020
@pchaigno pchaigno self-assigned this Apr 6, 2020
pchaigno added a commit that referenced this issue Apr 6, 2020
When copying the output of bpftool into the bpf_features.h file, although
we wait for the bpftool command to finish, we don't wait for the consumer
goroutine. This issue can lead to corrupted bpf_features.h files. We
however do not need a goroutine to copy bpftool's output.

Fixes: #10857
Fixes: #10019
Signed-off-by: Paul Chaignon <paul@cilium.io>
@joestringer joestringer added this to the 1.8 milestone Apr 7, 2020
pchaigno added a commit that referenced this issue Apr 9, 2020
When copying the output of bpftool into the bpf_features.h file, although
we wait for the bpftool command to finish, we don't wait for the consumer
goroutine. This issue can lead to corrupted bpf_features.h files. We
however do not need a goroutine to copy bpftool's output.

Fixes: #10857
Fixes: #10019
Signed-off-by: Paul Chaignon <paul@cilium.io>
joestringer pushed a commit that referenced this issue Apr 9, 2020
When copying the output of bpftool into the bpf_features.h file, although
we wait for the bpftool command to finish, we don't wait for the consumer
goroutine. This issue can lead to corrupted bpf_features.h files. We
however do not need a goroutine to copy bpftool's output.

Fixes: #10857
Fixes: #10019
Signed-off-by: Paul Chaignon <paul@cilium.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is a bug in the Cilium logic.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants