190 Commits
Author SHA1 Message Date
Zach KoopmansandgVisor bot ce58d71fd5 [syserror] Remove pkg syserror.
Removes package syserror and moves still relevant code to either linuxerr
or to syserr (to be later removed).

Internal errors are converted from random types to *errors.Error types used
in linuxerr. Internal errors are in linuxerr/internal.go.

PiperOrigin-RevId: 390724202
2021-08-13 17:16:52 -07:00
Zach KoopmansandgVisor bot 02370bbd31 [syserror] Convert remaining syserror definitions to linuxerr.
Convert remaining public errors (e.g. EINTR) from syserror to linuxerr.

PiperOrigin-RevId: 390471763
2021-08-12 15:19:12 -07:00
Jamie LiuandgVisor bot a89b2f005b Use atomics when checking for parent setgid in VFS2 tmpfs file creation.
Reported-by: syzbot+59550b48e06cc0d3b638@syzkaller.appspotmail.com
PiperOrigin-RevId: 386075453
2021-07-21 12:54:34 -07:00
Zach KoopmansandgVisor bot e3fdd15932 [syserror] Update syserror to linuxerr for more errors.
Update the following from syserror to the linuxerr equivalent:
EEXIST
EFAULT
ENOTDIR
ENOTTY
EOPNOTSUPP
ERANGE
ESRCH

PiperOrigin-RevId: 384329869
2021-07-12 15:26:20 -07:00
Zach KoopmansandgVisor bot 590b8d3e99 [syserror] Update several syserror errors to linuxerr equivalents.
Update/remove most syserror errors to linuxerr equivalents. For list
of removed errors, see //pkg/syserror/syserror.go.

PiperOrigin-RevId: 382574582
2021-07-01 12:05:19 -07:00
Zach KoopmansandgVisor bot 6ef2684096 [syserror] Update syserror to linuxerr for EACCES, EBADF, and EPERM.
Update all instances of the above errors to the faster linuxerr implementation.
With the temporary linuxerr.Equals(), no logical changes are made.

PiperOrigin-RevId: 382306655
2021-06-30 08:18:59 -07:00
Zach KoopmansandgVisor bot 54b71221c0 [syserror] Change syserror to linuxerr for E2BIG, EADDRINUSE, and EINVAL
Remove three syserror entries duplicated in linuxerr. Because of the
linuxerr.Equals method, this is a mere change of return values from
syserror to linuxerr definitions.

Done with only these three errnos as CLs removing all grow to a significantly
large size.

PiperOrigin-RevId: 382173835
2021-06-29 15:08:46 -07:00
Zach KoopmansandgVisor bot e1dc1c78e7 [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
2021-06-22 15:53:32 -07:00
Jamie LiuandgVisor bot 0892420c97 Minor VFS2 xattr changes.
- Allow the gofer client to use most xattr namespaces. As documented by the
  updated comment, this is consistent with e.g. Linux's FUSE client, and allows
  gofers to provide extended attributes from FUSE filesystems.

- Make tmpfs' listxattr omit xattrs in the "trusted" namespace for
  non-privileged users.

PiperOrigin-RevId: 378778854
2021-06-10 18:25:04 -07:00
Jamie LiuandgVisor bot ee1003bde2 Implement RENAME_NOREPLACE for all VFS2 filesystem implementations.
PiperOrigin-RevId: 377966969
2021-06-07 11:42:34 -07:00
Dean DengandgVisor bot 894187b2c6 Resolve remaining O_PATH TODOs.
O_PATH is now implemented in vfs2.

Fixes #2782.

PiperOrigin-RevId: 373861410
2021-05-14 14:04:46 -07:00
gVisor bot cc762235ce Internal change.
PiperOrigin-RevId: 366462448
2021-04-02 09:58:19 -07:00
Zach KoopmansandgVisor bot 8a2f7e716d [syserror] Split usermem package
Split usermem package to help remove syserror dependency in go_marshal.
New hostarch package contains code not dependent on syserror.

PiperOrigin-RevId: 365651233
2021-03-29 13:30:21 -07:00
Rahat MahmoodandgVisor bot c5667022b6 Report filesystem-specific mount options.
PiperOrigin-RevId: 362406813
2021-03-11 16:49:36 -08:00
Kevin KrakauerandgVisor bot 81ea0016e6 Support setgid directories in tmpfs and kernfs
PiperOrigin-RevId: 356868412
2021-02-10 17:45:18 -08:00
Andrei VaginandgVisor bot d6dbe6e5ca pipe: writeLocked has to return ErrWouldBlock if the pipe is full
PiperOrigin-RevId: 356450303
2021-02-09 01:34:45 -08:00
Ayush RanjanandgVisor bot f2c881f684 [vfs] Make sticky bit check consistent with Linux.
Our implementation of vfs.CheckDeleteSticky was not consistent with Linux,
specifically not consistent with fs/linux.h:check_sticky().

One of the biggest differences was that the vfs implementation did not
allow the owner of the sticky directory to delete files inside it that belonged
to other users.

This change makes our implementation consistent with Linux.

Also adds an integration test to check for this. This bug is also present in
VFS1.

Updates #3027

PiperOrigin-RevId: 355557425
2021-02-03 22:44:51 -08:00
Dean DengandgVisor bot f52f0101bb Implement F_GETLK fcntl.
Fixes #5113.

PiperOrigin-RevId: 353313374
2021-01-22 13:58:16 -08:00
Dean DengandgVisor bot 55332aca95 Move Lock/UnlockPOSIX into LockFD util.
PiperOrigin-RevId: 352904728
2021-01-20 16:55:07 -08:00
Fabricio VoznikaandgVisor bot dbe4176565 Check for existence before permissions
Return EEXIST when overwritting a file as long as the caller has exec
permission on the parent directory, even if the caller doesn't have
write permission.

Also reordered the mount write check, which happens before permission
is checked.

Closes #5164

PiperOrigin-RevId: 351868123
2021-01-14 13:43:10 -08:00
Jamie LiuandgVisor bot 3a16b829c5 Port filesystem metrics to VFS2.
PiperOrigin-RevId: 343196927
2020-11-18 18:10:02 -08:00
Andrei VaginandgVisor bot 10ba578c01 tmpfs: make sure that a dentry will not be destroyed before the open() call
If we don't hold a reference, the dentry can be destroyed by another thread.

Reported-by: syzbot+f2132e50060c41f6d41f@syzkaller.appspotmail.com
PiperOrigin-RevId: 342951940
2020-11-17 14:56:21 -08:00
Andrei VaginandgVisor bot e869e2c7cd fs/tmpfs: change regularFile.size atomically
PiperOrigin-RevId: 342221309
2020-11-13 01:51:24 -08:00
Andrei VaginandgVisor bot cc1b20590c fs/tmpfs: use atomic operations to access inode.mode
PiperOrigin-RevId: 342214859
2020-11-13 00:48:22 -08:00
Jamie LiuandgVisor bot ac62743e38 Read fsimpl/tmpfs timestamps atomically.
PiperOrigin-RevId: 341982672
2020-11-11 22:46:09 -08:00