Implement close_range.

Fixes #5500

PiperOrigin-RevId: 431454836
This commit is contained in:
Konstantin Bogomolov
2022-02-28 09:37:03 -08:00
committed by gVisor bot
parent f375784d83
commit 5c95e1d39c
20 changed files with 819 additions and 37 deletions
+1
View File
@@ -7,6 +7,7 @@ go_library(
srcs = [
"capability.go",
"clone.go",
"close_range.go",
"epoll.go",
"futex.go",
"linux64_amd64.go",
+32
View File
@@ -0,0 +1,32 @@
// Copyright 2022 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package strace
import (
"gvisor.dev/gvisor/pkg/abi"
"gvisor.dev/gvisor/pkg/abi/linux"
)
// CloseRangeFlagSet is the set of close_range(2) flags.
var CloseRangeFlagSet = abi.FlagSet{
{
Flag: uint64(linux.CLOSE_RANGE_CLOEXEC),
Name: "CLOSE_RANGE_CLOEXEC",
},
{
Flag: uint64(linux.CLOSE_RANGE_UNSHARE),
Name: "CLOSE_RANGE_UNSHARE",
},
}
+1
View File
@@ -372,6 +372,7 @@ var linuxAMD64 = SyscallMap{
433: makeSyscallInfo("fspick", FD, Path, Hex),
434: makeSyscallInfo("pidfd_open", Hex, Hex),
435: makeSyscallInfo("clone3", Hex, Hex),
436: makeSyscallInfo("close_range", FD, FD, CloseRangeFlags),
441: makeSyscallInfo("epoll_pwait2", FD, EpollEvents, Hex, Timespec, SigSet),
}
+1
View File
@@ -313,6 +313,7 @@ var linuxARM64 = SyscallMap{
433: makeSyscallInfo("fspick", FD, Path, Hex),
434: makeSyscallInfo("pidfd_open", Hex, Hex),
435: makeSyscallInfo("clone3", Hex, Hex),
436: makeSyscallInfo("close_range", FD, FD, CloseRangeFlags),
441: makeSyscallInfo("epoll_pwait2", FD, EpollEvents, Hex, Timespec, SigSet),
}
+2
View File
@@ -496,6 +496,8 @@ func (i *SyscallInfo) pre(t *kernel.Task, args arch.SyscallArguments, maximumBlo
output = append(output, ProtectionFlagSet.Parse(uint64(args[arg].Uint())))
case MmapFlags:
output = append(output, MmapFlagSet.Parse(uint64(args[arg].Uint())))
case CloseRangeFlags:
output = append(output, CloseRangeFlagSet.Parse(uint64(args[arg].Uint())))
case Oct:
output = append(output, "0o"+strconv.FormatUint(args[arg].Uint64(), 8))
case Hex:
+3
View File
@@ -244,6 +244,9 @@ const (
// MmapFlags is the flags argument in mmap(2).
MmapFlags
// CloseRangeFlags are close_range(2) flags.
CloseRangeFlags
)
// defaultFormat is the syscall argument format to use if the actual format is