Skip to content

Commit

Permalink
syscalls: do not conceal BPF_PROG_* syscall errors
Browse files Browse the repository at this point in the history
The error wrapping code for BPF_PROG_* syscall-related errors would mask
the true source of all underlying syscall errors, which meant that you
couldn't detect several fairly important cases (such as -EACESS and
-EPERM). It seems that this behaviour wasn't intentional (prior to
commit de57e91, the behaviour was to bubble up the syscall error)
and the similar wrapping of BPF_MAP_* errors did bubble up the syscall
error to.

This is needed for runc to be able to detect permission errors due to
SELinux labels blocking certain operations (mainly NewProgramFromID),
and unifies the behaviour for BPF_PROG_* and BPF_MAP_* syscalls.

Fixes: de57e91 ("Add *GetNextID")
Signed-off-by: Aleksa Sarai <[email protected]>
  • Loading branch information
cyphar committed Jul 1, 2021
1 parent 37b4af7 commit 7cf7600
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions syscalls.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,9 @@ func wrapObjError(err error) error {
return nil
}
if errors.Is(err, unix.ENOENT) {
return fmt.Errorf("%w", ErrNotExist)
return ErrNotExist
}

return errors.New(err.Error())
return err
}

func wrapMapError(err error) error {
Expand Down

0 comments on commit 7cf7600

Please sign in to comment.