Skip to content

Commit 7242ffa

Browse files
committed
[1.2] cgroup: ebpf: make unexpected errors in haveBpfProgReplace louder
(This is a cherry-pick of c0044c7.) If we get an unexpected error here, it is probably because of a library or kernel change that could cause our detection logic to be invalid. As a result, these warnings should be louder so users have a chance to tell us about them sooner (or so we might notice them before doing a release, as happened with the 1.2.0 regression). Signed-off-by: Aleksa Sarai <[email protected]>
1 parent e26e0fd commit 7242ffa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

libcontainer/cgroups/devices/ebpf_linux.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ func haveBpfProgReplace() bool {
107107
},
108108
})
109109
if err != nil {
110-
logrus.Debugf("checking for BPF_F_REPLACE support: ebpf.NewProgram failed: %v", err)
110+
logrus.Warnf("checking for BPF_F_REPLACE support: ebpf.NewProgram failed: %v", err)
111111
return
112112
}
113113
defer prog.Close()
114114

115115
devnull, err := os.Open("/dev/null")
116116
if err != nil {
117-
logrus.Debugf("checking for BPF_F_REPLACE support: open dummy target fd: %v", err)
117+
logrus.Warnf("checking for BPF_F_REPLACE support: open dummy target fd: %v", err)
118118
return
119119
}
120120
defer devnull.Close()
@@ -138,7 +138,11 @@ func haveBpfProgReplace() bool {
138138
return
139139
}
140140
if !errors.Is(err, unix.EBADF) {
141-
logrus.Debugf("checking for BPF_F_REPLACE: got unexpected (not EBADF or EINVAL) error: %v", err)
141+
// If we see any new errors here, it's possible that there is a
142+
// regression due to a cilium/ebpf update and the above EINVAL
143+
// checks are not working. So, be loud about it so someone notices
144+
// and we can get the issue fixed quicker.
145+
logrus.Warnf("checking for BPF_F_REPLACE: got unexpected (not EBADF or EINVAL) error: %v", err)
142146
}
143147
haveBpfProgReplaceBool = true
144148
})

0 commit comments

Comments
 (0)