mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Ignore AT_NO_AUTOMOUNT flag in fstatat(2).
Similar to our approach in statx(2). Binaries like mount(1) are using this flag and if we don't support it, we get confusing error messages. PiperOrigin-RevId: 576946190
This commit is contained in:
@@ -50,6 +50,9 @@ func Newfstatat(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uint
|
||||
}
|
||||
|
||||
func fstatat(t *kernel.Task, dirfd int32, pathAddr, statAddr hostarch.Addr, flags int32) error {
|
||||
// TODO(b/270247637): gVisor does not yet support automount, so
|
||||
// AT_NO_AUTOMOUNT flag is a no-op.
|
||||
flags &= ^linux.AT_NO_AUTOMOUNT
|
||||
if flags&^(linux.AT_EMPTY_PATH|linux.AT_SYMLINK_NOFOLLOW) != 0 {
|
||||
return linuxerr.EINVAL
|
||||
}
|
||||
|
||||
@@ -783,16 +783,20 @@ TEST_F(StatTest, StatxInvalidFlags) {
|
||||
SyscallFailsWithErrno(EINVAL));
|
||||
}
|
||||
|
||||
TEST_F(StatTest, StatxIgnoreNoAutomount) {
|
||||
SKIP_IF(!IsRunningOnGvisor() && statx(-1, nullptr, 0, 0, nullptr) < 0 &&
|
||||
errno == ENOSYS);
|
||||
// TODO(b/270247637): AT_NO_AUTOMOUNT flag has no effect because gVisor does
|
||||
// not support automount yet.
|
||||
TEST_F(StatTest, StatIgnoreNoAutomount) {
|
||||
if (IsRunningOnGvisor() || statx(-1, nullptr, 0, 0, nullptr) == 0 ||
|
||||
errno != ENOSYS) {
|
||||
struct kernel_statx stx;
|
||||
EXPECT_THAT(
|
||||
statx(-1, test_file_name_.c_str(), AT_NO_AUTOMOUNT, STATX_ALL, &stx),
|
||||
SyscallSucceeds());
|
||||
}
|
||||
|
||||
// NOTE(b/270219255): AT_NO_AUTOMOUNT flag has no effect because gVisor does
|
||||
// not support automount.
|
||||
struct kernel_statx stx;
|
||||
EXPECT_THAT(
|
||||
statx(-1, test_file_name_.c_str(), AT_NO_AUTOMOUNT, STATX_ALL, &stx),
|
||||
SyscallSucceeds());
|
||||
struct stat st;
|
||||
EXPECT_THAT(fstatat(AT_FDCWD, test_file_name_.c_str(), &st, AT_NO_AUTOMOUNT),
|
||||
SyscallSucceeds());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user