15 Commits

Author SHA1 Message Date
Ayush Ranjan 9d41ac1ff0 Fix unsigned to signed integer conversion in syserr.getHostTranslation().
unix.Errno is of type `uintptr`, which is an unsigned integer. It was being
casted to `int`, which is a signed integer of the same size. This cast could
overflow due to unsigned -> signed.

Reported-by: syzbot+08e5bf6f25d7db4316b9@syzkaller.appspotmail.com
PiperOrigin-RevId: 680668525
2024-09-30 12:11:53 -07:00
Ayush Ranjan 3971ecbc6c Remove linuxerr.IsValid and use syserr.IsValid instead.
linuxerr.IsValid just checks if the errno is less than the max possible errno
value. syserr.IsValid additionally checks if the errno can be translated by the
syserr package.

Furthermore, drop the usage of linuxerr.TranslateError(), which only checks
against a map with 3 entries of sentry-internal errors. Earlier, connError()
would always fail at this step and end up returning linuxerr.EINVAL even if the
errno being returned is valid.

Reported-by: syzbot+180b8537798c091bf9fd@syzkaller.appspotmail.com
PiperOrigin-RevId: 680021716
2024-09-28 12:34:57 -07:00
Ayush Ranjan 40bde6c617 Add EHWPOISON to host_linux.go
Reported-by: syzbot+a5a17bdcbcb46c5ca38c@syzkaller.appspotmail.com
PiperOrigin-RevId: 671639531
2024-09-05 23:19:47 -07:00
Nayana Bidari e6cf09a18c Add ERFKILL errno to host_linux file.
Reported-by: syzbot+60bb099bed4694a37f61@syzkaller.appspotmail.com
PiperOrigin-RevId: 663361199
2024-08-15 10:43:38 -07:00
Ayush Ranjan 0184ec4aac Add ENAVAIL to host_linux.go.
Reported-by: syzbot+60bb099bed4694a37f61@syzkaller.appspotmail.com
PiperOrigin-RevId: 658858051
2024-08-02 11:53:26 -07:00
Ayush Ranjan ef1ca17e58 Add EISNAM to linuxHostTranslations and fix error message for ENOTNAM.
Reported-by: syzbot+2817f67abeaf8fca4427@syzkaller.appspotmail.com
PiperOrigin-RevId: 658584815
2024-08-01 16:57:38 -07:00
Kevin Krakauer b490036d83 netstack: remove {linux,darwin}HostTranslation
It can be replaced with a simpler type.

PiperOrigin-RevId: 409533054
2021-11-12 16:24:59 -08:00
Kevin Krakauer 82793c5e90 netstack: fix Mac build error
- Stub out sighandling functions with panics on Darwin
- Put Linux-specific errors into their own syserr file

Not sure how best to get automated tests running, so I'll leave that for a later
change.

Fixes #6839.
Related to #1270.

PiperOrigin-RevId: 409516969
2021-11-12 15:24:47 -08:00
Jamie Liu 1ad3822200 Add go:build directives as required by Go 1.17's gofmt.
PiperOrigin-RevId: 385894869
2021-07-20 16:28:45 -07:00
Ayush Ranjan a9441aea27 [op] Replace syscall package usage with golang.org/x/sys/unix in pkg/.
The syscall package has been deprecated in favor of golang.org/x/sys.

Note that syscall is still used in the following places:
- pkg/sentry/socket/hostinet/stack.go: some netlink related functionalities
  are not yet available in golang.org/x/sys.
- syscall.Stat_t is still used in some places because os.FileInfo.Sys() still
  returns it and not unix.Stat_t.

Updates #214

PiperOrigin-RevId: 360701387
2021-03-03 10:25:58 -08:00
Adin Scannell 4cba3904f4 Remove existing nogo exceptions.
PiperOrigin-RevId: 347047550
2020-12-11 12:06:49 -08:00
Michael Pratt 4d52a55201 Change copyright notice to "The gVisor Authors"
Based on the guidelines at
https://opensource.google.com/docs/releasing/authors/.

1. $ rg -l "Google LLC" | xargs sed -i 's/Google LLC.*/The gVisor Authors./'
2. Manual fixup of "Google Inc" references.
3. Add AUTHORS file. Authors may request to be added to this file.
4. Point netstack AUTHORS to gVisor AUTHORS. Drop CONTRIBUTORS.

Fixes #209

PiperOrigin-RevId: 245823212
Change-Id: I64530b24ad021a7d683137459cafc510f5ee1de9
2019-04-29 14:26:23 -07:00
Ian Gudger 8fce67af24 Use correct company name in copyright header
PiperOrigin-RevId: 217951017
Change-Id: Ie08bf6987f98467d07457bcf35b5f1ff6e43c035
2018-10-19 16:35:11 -07:00
Ian Gudger a620bea045 Reduce map lookups in syserr
PiperOrigin-RevId: 208755352
Change-Id: Ia24630f452a4a42940ab73a8113a2fd5ea2cfca2
2018-08-14 19:03:38 -07:00
Googler d02b74a5dc Check in gVisor.
PiperOrigin-RevId: 194583126
Change-Id: Ica1d8821a90f74e7e745962d71801c598c652463
2018-04-28 01:44:26 -04:00