Commit Graph
22 Commits
Author SHA1 Message Date
Jing ChenandgVisor bot 090d92a726 Have lgetxattr return ENODATA.
It is a workaround to lgetxattr/lsetxattr working with security.capacity when running docker in gvisor.

PiperOrigin-RevId: 563194162
2023-09-06 13:13:19 -07:00
Ayush RanjanandgVisor bot f8e29b59d7 Mark newly created directories in merged parents in overlay as opaque.
This is an optimization that will prevent needless lookups on lower layers for
directories. This is analogous to the Linux commit 97c684cc9110 ("ovl: create
directories inside merged parent opaque").

If mkdir(2) does succeed, then none of the lower layers have a file at that
position, otherwise mkdir(2) would have failed with EEXIST.

Changes on the lower layer underneath a new upper layer directory are not
visible. See the following for example:
```
$ sudo mount -t overlay -o lowerdir=lower,upperdir=upper,workdir=workdir none overlay
$ mkdir -p overlay/dir/dir1
$ mkdir -p lower/dir/dir2
$ ls overlay/dir/
dir1
```

Benchmarking shows that this change cuts ABSL build time by 9.5%!
```
goos: linux
goarch: amd64
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
                                                  │ /tmp/benchout.runsc │     /tmp/benchout.runsc-opt      │
                                                  │       sec/op        │   sec/op    vs base              │
BuildABSL/page_cache.clean/filesystem.bindfs-8              71.16 ± 12%   64.40 ± 3%  -9.50% (p=0.003 n=8)
BuildGRPC/page_cache.clean/filesystem.bindfs-8              418.2 ±  1%   419.9 ± 1%       ~ (p=0.721 n=8)
RubySpecTest/page_cache.clean/filesystem.bindfs-8           76.67 ±  5%   75.17 ± 1%       ~ (p=0.382 n=8)
geomean                                                     131.6         126.7       -3.78%

                                                  │ /tmp/benchout.runsc │   /tmp/benchout.runsc-opt   │
                                                  │      load.sec       │  load.sec   vs base         │
RubySpecTest/page_cache.clean/filesystem.bindfs-8            12.95 ± 6%   12.80 ± 5%  ~ (p=0.625 n=8)
```

PiperOrigin-RevId: 538823897
2023-06-08 10:33:25 -07:00
gVisor bot d034171d9c Merge pull request #8679 from avagin:cpp-warnings
PiperOrigin-RevId: 523157922
2023-04-10 10:59:51 -07:00
Andrei Vagin 3445db339d Fix all c++ compile time warnings 2023-03-09 19:01:00 -08:00
gVisor bot b0bd6ceec7 Use syscall() for XattrWithOPath
Avoids Bionic when running on Android.
See https://android-review.googlesource.com/c/platform/bionic/+/152663.

PiperOrigin-RevId: 446795777
2022-05-05 13:09:46 -07:00
Ayush RanjanandgVisor bot f6263c38df Remove VFS1 special handling in tests.
Also clean up usage of GVISOR_VFS environment variable.
Updates #1624

PiperOrigin-RevId: 429100450
2022-02-16 11:41:51 -08:00
Fabricio VoznikaandgVisor bot e00ab957e8 Fix up TODOs in the code
PiperOrigin-RevId: 371231148
2021-04-29 16:42:45 -07:00
Fabricio VoznikaandgVisor bot 3fe6a879b2 Remove side effect from test cases
Restore capabilities for tests that need to change them.

PiperOrigin-RevId: 371007047
2021-04-28 16:22:24 -07:00
Adin ScannellandgVisor bot ce8ee943e7 Remove _NoRandomSave tests.
We do not currently run random save tests.

PiperOrigin-RevId: 368309921
2021-04-13 15:42:41 -07:00
gVisor bot 4f82319e45 Add O_PATH support in vfs2
PiperOrigin-RevId: 354367665
2021-01-28 12:24:37 -08:00
Nicolas LacasseandgVisor bot 64cf78c3fd Check that we have access to the trusted.* xattr namespace directly.
These operations require CAP_SYS_ADMIN in the root user namespace. There's no
easy way to check that other than trying the operation and seeing what happens.

PiperOrigin-RevId: 331242256
2020-09-11 16:10:12 -07:00
Ayush RanjanandgVisor bot a00b2df74e [vfs] Capitalize x in the {Get/Set/Remove/List}xattr functions.
PiperOrigin-RevId: 330554450
2020-09-08 11:51:39 -07:00
Nicolas LacasseandgVisor bot 8f1b4fae1a tmpfs: Allow xattrs in the trusted namespace if creds has CAP_SYS_ADMIN.
This is needed to support the overlay opaque attribute.

PiperOrigin-RevId: 328552985
2020-08-26 10:05:34 -07:00
Michael PrattandgVisor bot 458dbc511d Remove various uses of 'whitelist'
Updates #2972

PiperOrigin-RevId: 317113059
2020-06-18 09:03:39 -07:00
Dean DengandgVisor bot 5551efe76a Port extended attributes to VFS2.
As in VFS1, we only support the user.* namespace. Plumbing is added to tmpfs
and goferfs.
Note that because of the slightly different order of checks between VFS2 and
Linux, one of the xattr tests needs to be relaxed slightly.

Fixes #2363.

PiperOrigin-RevId: 305985121
2020-04-10 19:02:55 -07:00
Dean DengandgVisor bot a995bd4ab5 Support listxattr and removexattr syscalls.
Note that these are only implemented for tmpfs, and other impls will still
return EOPNOTSUPP.

PiperOrigin-RevId: 293899385
2020-02-07 14:47:13 -08:00
Nicolas LacasseandgVisor bot f17fd634ac Disable get/set xattrs until list/remove exist too.
PiperOrigin-RevId: 293411655
2020-02-05 11:26:19 -08:00
Dean DengandgVisor bot 23b9c1ee86 Update bug number for supporting extended attribute namespaces.
PiperOrigin-RevId: 291774815
2020-01-27 12:50:18 -08:00
Dean DengandgVisor bot 53657fb2a5 Add syscalls for lgetxattr, fgetxattr, lsetxattr, and fsetxattr.
Note that these simply will use the same logic as getxattr and setxattr, which
is not yet implemented for most filesystems.

PiperOrigin-RevId: 290800960
2020-01-21 12:43:18 -08:00
Dean DengandgVisor bot 9227f56ab6 Disable xattr tests.
These can remain disabled until we actually support extended attributes.

The following modifications were also made:
1. Disable save/restore on tests that change file permissions. Restore will not
work properly for these tests, since it will try to open the file with
read-write after it has been read- or write-only.
2. Change user.abc to user.test.

PiperOrigin-RevId: 290123941
2020-01-16 13:11:47 -08:00
Dean DengandgVisor bot 6d81bced9c Implement checks for get/setxattr at the syscall layer.
Add checks for input arguments, file type, permissions, etc. that match
the Linux implementation. A call to get/setxattr that passes all the
checks will still currently return EOPNOTSUPP. Actual support will be
added in following commits.

Only allow user.* extended attributes for the time being.

PiperOrigin-RevId: 285835159
2019-12-16 13:20:07 -08:00
Dean DengandgVisor bot 191c6cfe4c Add syscall tests for getxattr and setxattr.
Support for getxattr and setxattr are in subsequent commits.

PiperOrigin-RevId: 285088817
2019-12-11 16:41:17 -08:00