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
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.
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
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>
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
- 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
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
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
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
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
- 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
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
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
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