Skip to content

Commit 2eace67

Browse files
committed
probeProgram: catch sys.ENOTSUPP error for unknown op codes
This commit extends the error catching in the `probeProgram` function by additionally catching `sys.ENOTSUPP`. We see this error being returned when compiling BPF programs that contain instructions with an unknown op code (ex. checking ISA v4 support in arm64 with kernel version <v6.6). This error code is different than EINVAL or EOPNOTSUPP. Signed-off-by: Simone Magnani <simone.magnani@isovalent.com>
1 parent 73439ca commit 2eace67

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

features/prog.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ func probeProgram(spec *ebpf.ProgramSpec) error {
4040
}
4141

4242
switch {
43+
// ENOTSUPP occurs when attempting to create a program with an unknown op code.
4344
// EINVAL occurs when attempting to create a program with an unknown type.
4445
// E2BIG occurs when ProgLoadAttr contains non-zero bytes past the end
4546
// of the struct known by the running kernel, meaning the kernel is too old
4647
// to support the given prog type.
47-
case errors.Is(err, unix.EINVAL), errors.Is(err, unix.E2BIG):
48+
case errors.Is(err, sys.ENOTSUPP), errors.Is(err, unix.EINVAL), errors.Is(err, unix.E2BIG):
4849
err = ebpf.ErrNotSupported
4950
}
5051

0 commit comments

Comments
 (0)