54 Commits
Author SHA1 Message Date
Ayush RanjanandgVisor bot 84670a4fc6 gofer: Fix bug when casting auth.K{U/G}ID to int.
auth.K{U/G}ID has type uint32. When uid = auth.NoID = math.MaxUint32, which is
intended to represent -1, and it is casted to int, it becomes 4294967295 on
64-bit systems as int is 8 bytes in size. So the == -1 check fails.

Fixed the bug by explicitly setting syscall args to -1 when uid.Ok() == false.
Similarly, fix the bug in runsc/fsgofer.

PiperOrigin-RevId: 728258705
2025-02-18 10:16:08 -08:00
gVisor bot 7aa4c49b0d Merge pull request #11291 from xianzhe-databricks:fix-uds-auth
PiperOrigin-RevId: 712981221
2025-01-07 11:25:40 -08:00
xianzhe-databricks c4f686f4e1 Add a new RPC ConnectWithCreds to allow gofer to connect to a unix domain socket with application's credentials 2025-01-03 17:50:06 +01:00
Jing Chen 7cc17225e6 Remove references to math/rand package's Read function.
The helper function is deprecated. The package gvisor.dev/gvisor/pkg/rand
depends on crypto/rand which performs worse thatn math/rand, the changes
are fine since they are not at any gVisor's hot path.

The ultimate goal is to migrate math/rand to math/rand/v2.
2024-10-16 18:17:15 +00:00
Koichi Shiraishi 0cf77c02f8 all: remove use io/ioutil deprecated package & fix some deprecated thing
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2024-10-10 20:36:24 +09:00
Ayush RanjanandgVisor bot 1303df5f70 Skip running the UDS lisafs test for runsc/fsgofer.
In some test environments, the `TEST_TMPDIR` path is too long.
So creating a socket file inside that via bind(2) fails with EINVAL.
bind(2) requires paths to be shorter than 108.

PiperOrigin-RevId: 609110892
2024-02-21 13:54:19 -08:00
Andrei VaginandgVisor bot 5b33e4a3d8 Enable leak checkers for runsc tests
Updates #4572

PiperOrigin-RevId: 597307765
2024-01-10 11:30:58 -08:00
Andrei Vagin 5f4abad306 Fix a few typos
It is an idea of running codespell as part of our presubmit checks.
Before enabling it for new changes, let's fix what it has found.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
2023-10-25 12:13:42 -07:00
Ayush RanjanandgVisor bot 26a5961d4d Print flags as hex or octal values in lisafs messages.
This makes RPC logs more readable.

PiperOrigin-RevId: 520745226
2023-03-30 14:37:03 -07:00
Ayush RanjanandgVisor bot 8fb66eb289 Get HardLink test in //runsc/fsgofer:lisafs_test to pass.
This test was attempting to create a link with the same name as the target.
Changed that to use a different name for link. This test also exposed a ref
count bug in LISAFS RPC handlers. Fixed that.

Updates #8688

PiperOrigin-RevId: 516912550
2023-03-15 13:26:13 -07:00
Ayush RanjanandgVisor bot 4c5803c47f Improve lisafs debug log messages.
- Improves Statx prints. Used by Inode, which is in turn used by many messages.
  Now mode and timestamps are much more readable.
- Print all mask fields as hex for readability.
- Made WalkStatus readable.
- Improves printing of slices. Earlier, there was a ", " suffix which was
  confusing because it could look like an empty string entry. Now we print
  slices more meticulously.
- Consistently use Stringer implementations to print things, instead of %+v. So
  future improvements are easier to make.

PiperOrigin-RevId: 516895609
2023-03-15 12:20:52 -07:00
Adin ScannellandgVisor bot 1ceb814544 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Ayush RanjanandgVisor bot dbfc591d94 Optionally donate a host FD to the mount point in lisafs.
This is not used as of now. This is required for directfs later. The impacted
RPCs are Mount and Open. Mount has been modified to now donate an optional FD
to the mount point.

As the mount point can be a socket or a symlink, which needs to be opened with
O_PATH, we can no longer expect unix.SetNonblock() to work always while donating
FD in lisafs. So allow it to fail. Just log a warning in such cases.

Also split out the logic to start channels from lisafs.NewClient(). Not all
clients require channels.

PiperOrigin-RevId: 504631423
2023-01-25 12:30:20 -08:00
Ayush RanjanandgVisor bot 239be78fbb Make gofer.dentry a generic type.
This introduces a new gofer.dentry.impl field which can hold dentry
implementation specific details. For now there exists only one implementation,
which is a lisafs dentry.

This work is in preparation for adding a direct host dentry implementation,
which will make host syscalls instead of making RPCs.

This change should have no change in behavior or performance.

PiperOrigin-RevId: 503203994
2023-01-19 10:46:30 -08:00
Ayush RanjanandgVisor bot 54dafa76c2 Prevent lisafs socket communicator from returning io.EOF when server exits.
This is consistent with what our p9 package does. See
pkg/p9/client.go:sendRecvLegacySyscallErr(). This is also consistent with what
lisafs channel communicator does.

We log the actual error that caused the RPC to fail and map all transport
errors to EIO. Returning io.EOF to the client may cause the sentry to panic if
it tries to convert it into a syscall error in kernel.ExtractErrno().

PiperOrigin-RevId: 495696116
2022-12-15 14:29:16 -08:00
Ayush RanjanandgVisor bot 175db901ca Replace pkg/refs with pkg/refsvfs2.
All VFS1 only bits have been deleted.

Updates #1624

PiperOrigin-RevId: 492273183
2022-12-01 12:46:11 -08:00
Kevin KrakauerandgVisor bot d8aa09e04c convert uses of interface{} to any
Done via:
  find . -name "*.go" | xargs sed -i -E 's/interface\{\}/any/g'

PiperOrigin-RevId: 487033228
2022-11-08 13:14:06 -08:00
Fabricio VoznikaandgVisor bot 7e3bd4db0f Add rudimentary UDS test to lisafs
PiperOrigin-RevId: 483732841
2022-10-25 11:35:28 -07:00
Fabricio VoznikaandgVisor bot 0eb861df56 Replace fsgofer-host-uds flag
The new `host-uds` flag has the following differences:

  * More granular control: user can specify whether to ignore host UDS,
    connect to an existing host UDS, create a host UDS, or both
  * Will shortly be used to also control pipes from the host, hence the
    removal of UDS from the name
  * Can be used with other filesystems, not gofer-based, hence the
    removal of fsgofer from the name

This change also removes support for bind() from 9P based gofer since it's
not supported and would make this change more complicated.

Updates #8037

PiperOrigin-RevId: 483538832
2022-10-24 18:26:44 -07:00
Ayush RanjanandgVisor bot 9fc4c0dfad Add lisafs package README.
Replace proposal README with protocol specification.

PiperOrigin-RevId: 481053610
2022-10-13 21:18:24 -07:00
Ayush RanjanandgVisor bot 6ac829ca1e Minor bug fixes in gofer's BindAt mechanism.
- Allow lisafs client to open socket FDs. BindAt is now supported. So
  opening sockets over a connection should also be supported.
- Initialize socket's node with its name. Earlier, we were using the
  entire host path to init node's name.
- vfs.MknodOptions.Endpoint can be a connectionless endpoint, which does not
  implement transport.HostBoundEndpoint. In such a case, fallback to synthetic
  sockets.

PiperOrigin-RevId: 477212574
2022-09-27 10:44:26 -07:00
Ayush RanjanandgVisor bot 68fd6aba43 Update BindAt RPC to include other creation options.
BindAt should also be setting the socket file mode and owners.
All file creation RPCs do this. This is required for correct behavior.

PiperOrigin-RevId: 477023055
2022-09-26 16:49:27 -07:00
Ayush RanjanandgVisor bot 0479a63023 Use a different host FD to back lisafs.ControlFD for a bound socket.
Earlier we were using the socket(2) FD as the socket file's
lisafs.ControlFD. However, the same socket(2) FD is used to back the
lisafs.BoundSocketFD. These are two separate FDIDs on the lisafs
connection. Closing one, should not make the other unusable.

PiperOrigin-RevId: 476470242
2022-09-23 15:03:36 -07:00
Ayush RanjanandgVisor bot 72e8fabaec Add transport.BoundSocketFD interface.
This is beneficial for 2 reasons:
- transport package should not depend on lisafs, which is a user of that
  package.
- This allows users other than lisafs client to use transport.HostBoundEndpoint.

PiperOrigin-RevId: 475326947
2022-09-19 10:37:15 -07:00
Ayush RanjanandgVisor bot 49d88e92ed Do not debug log read/write buffers in lisafs.
These logs are not helpful and just make logs very noisy.

PiperOrigin-RevId: 463136631
2022-07-25 11:35:24 -07:00