diff options
author | Zach Koopmans <zkoopmans@google.com> | 2021-06-22 15:50:41 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-06-22 15:53:32 -0700 |
commit | e1dc1c78e7a523fc64ca28bed60a9a40ea1de46a (patch) | |
tree | a8679f27d3a333ed79f5620ba8109985cbcdcf4e /pkg/sentry/loader | |
parent | 01bcd55c3ad3b6c3bc0179a13e5f0045fa3707b7 (diff) |
[syserror] Add conversions to linuxerr with temporary Equals method.
Add Equals method to compare syserror and unix.Errno errors to linuxerr errors.
This will facilitate removal of syserror definitions in a followup, and
finding needed conversions from unix.Errno to linuxerr.
PiperOrigin-RevId: 380909667
Diffstat (limited to 'pkg/sentry/loader')
-rw-r--r-- | pkg/sentry/loader/BUILD | 1 | ||||
-rw-r--r-- | pkg/sentry/loader/elf.go | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/pkg/sentry/loader/BUILD b/pkg/sentry/loader/BUILD index 80f862628..54bfed644 100644 --- a/pkg/sentry/loader/BUILD +++ b/pkg/sentry/loader/BUILD @@ -20,6 +20,7 @@ go_library( "//pkg/abi/linux/errno", "//pkg/context", "//pkg/cpuid", + "//pkg/errors/linuxerr", "//pkg/hostarch", "//pkg/log", "//pkg/rand", diff --git a/pkg/sentry/loader/elf.go b/pkg/sentry/loader/elf.go index 8fc3e2a79..4c7666e33 100644 --- a/pkg/sentry/loader/elf.go +++ b/pkg/sentry/loader/elf.go @@ -24,6 +24,7 @@ import ( "gvisor.dev/gvisor/pkg/abi/linux" "gvisor.dev/gvisor/pkg/context" "gvisor.dev/gvisor/pkg/cpuid" + "gvisor.dev/gvisor/pkg/errors/linuxerr" "gvisor.dev/gvisor/pkg/hostarch" "gvisor.dev/gvisor/pkg/log" "gvisor.dev/gvisor/pkg/sentry/arch" @@ -621,7 +622,7 @@ func loadInitialELF(ctx context.Context, m *mm.MemoryManager, fs *cpuid.FeatureS func loadInterpreterELF(ctx context.Context, m *mm.MemoryManager, f fsbridge.File, initial loadedELF) (loadedELF, error) { info, err := parseHeader(ctx, f) if err != nil { - if err == syserror.ENOEXEC { + if linuxerr.Equals(linuxerr.ENOEXEC, err) { // Bad interpreter. err = syserror.ELIBBAD } |