Skip to content

Commit 08e0524

Browse files
Update info.go
Co-authored-by: Dylan Reimerink <[email protected]> Signed-off-by: secDre4mer <[email protected]>
1 parent 25e50b4 commit 08e0524

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

info.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,9 @@ func newProgramInfoFromFd(fd *sys.FD) (*ProgramInfo, error) {
420420
info2.XlatedProgLen = info.XlatedProgLen
421421
info2.XlatedProgInsns = sys.SlicePointer(pi.insns)
422422

423-
// Linux kernel has a bug(?): if xlated_prog_len is specified and access is denied
424-
// by kernel.kptr_restrict or net.core.bpf_jit_harden sysctls, the syscall doesn't only
425-
// skip the xlated program's bytes, but other information as well.
426-
// See handling of xlated_prog_insns in bpf_prog_get_info_by_fd in kernel/bpf/syscall.c.
427-
// To avoid skipping other information, we specify xlated_prog_len in a separate syscall.
423+
// When kernel.kptr_restrict and net.core.bpf_jit_harden are both set, it causes the
424+
// syscall to abort when trying to readback xlated instructions, skipping other info
425+
// as well. So request xlated instructions seperately.
428426
if err := sys.ObjInfo(fd, &info2); err != nil {
429427
return nil, err
430428
}

0 commit comments

Comments
 (0)