mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
Fix a few typos
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[codespell]
|
||||
skip = ./.git,tags,go.mod,go.sum,./test/image/latin10k.txt,./website/assets/images
|
||||
ignore-words-list = savable,adin
|
||||
@@ -97,7 +97,7 @@ endif
|
||||
##
|
||||
## Development helpers and tooling.
|
||||
##
|
||||
## These targets faciliate local development by automatically
|
||||
## These targets facilitate local development by automatically
|
||||
## installing and configuring a runtime. Several variables may
|
||||
## be used here to tweak the installation:
|
||||
## RUNTIME - The name of the installed runtime (default: $BRANCH_NAME).
|
||||
@@ -755,3 +755,7 @@ release: $(RELEASE_KEY) $(RELEASE_ARTIFACTS)/$(ARCH)
|
||||
tag: ## Creates and pushes a release tag.
|
||||
@tools/tag_release.sh "$(RELEASE_COMMIT)" "$(RELEASE_NAME)" "$(RELEASE_NOTES)"
|
||||
.PHONY: tag
|
||||
|
||||
codespell:
|
||||
codespell
|
||||
.PHONY: codespell
|
||||
|
||||
@@ -3,7 +3,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file"
|
||||
|
||||
# Root certificates.
|
||||
#
|
||||
# Note that the sha256 hash is ommitted here intentionally. This should not be
|
||||
# Note that the sha256 hash is omitted here intentionally. This should not be
|
||||
# used in any part of the build other than as certificates present in images.
|
||||
http_file(
|
||||
name = "google_root_pem",
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"gvisor.dev/gvisor/pkg/errors/linuxerr"
|
||||
)
|
||||
|
||||
// capsEquals returns trun when the given creds' capabilities match the given caps.
|
||||
// capsEquals returns true when the given creds' capabilities match the given caps.
|
||||
func capsEquals(creds *Credentials, caps TaskCapabilities) bool {
|
||||
return creds.PermittedCaps == caps.PermittedCaps &&
|
||||
creds.InheritableCaps == caps.InheritableCaps &&
|
||||
|
||||
@@ -30,7 +30,7 @@ type Saver interface {
|
||||
// +stateify savable
|
||||
type CheckpointGeneration struct {
|
||||
// Count is incremented every time a checkpoint is triggered, even if the
|
||||
// chekpoint failed.
|
||||
// checkpoint failed.
|
||||
Count uint32
|
||||
// Restore indicates if the current instance resumed after the checkpoint or
|
||||
// it was restored from a checkpoint.
|
||||
|
||||
@@ -273,7 +273,7 @@ type Context interface {
|
||||
// Release() releases any resources associated with this context.
|
||||
Release()
|
||||
|
||||
// PrepareSleep() is called when the tread switches to the
|
||||
// PrepareSleep() is called when the thread switches to the
|
||||
// interruptible sleep state.
|
||||
PrepareSleep()
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ func (s *Server) Count() int {
|
||||
return len(s.points)
|
||||
}
|
||||
|
||||
// Reset throws aways all points received so far and returns the number of
|
||||
// Reset throws away all points received so far and returns the number of
|
||||
// points discarded.
|
||||
func (s *Server) Reset() int {
|
||||
s.cond.L.Lock()
|
||||
|
||||
@@ -162,7 +162,7 @@ func (p *Protocol) getLink(ctx context.Context, s *netlink.Socket, msg *nlmsg.Me
|
||||
return nil
|
||||
}
|
||||
|
||||
// newLink handles RTM_NEWLINK reqeusts.
|
||||
// newLink handles RTM_NEWLINK requests.
|
||||
func (p *Protocol) newLink(ctx context.Context, s *netlink.Socket, msg *nlmsg.Message, ms *nlmsg.MessageSet) *syserr.Error {
|
||||
stack := s.Stack()
|
||||
if stack == nil {
|
||||
|
||||
@@ -184,7 +184,7 @@ func (s *Stack) SetInterface(ctx context.Context, msg *nlmsg.Message) *syserr.Er
|
||||
}
|
||||
|
||||
func (s *Stack) setLink(ctx context.Context, id tcpip.NICID, linkAttrs map[uint16]nlmsg.BytesView) *syserr.Error {
|
||||
// IFLA_NET_NS_FD has to be handled first, because other parameters may be reseted.
|
||||
// IFLA_NET_NS_FD has to be handled first, because other parameters may be reset.
|
||||
if v, ok := linkAttrs[linux.IFLA_NET_NS_FD]; ok {
|
||||
fd, ok := v.Uint32()
|
||||
if !ok {
|
||||
|
||||
@@ -99,7 +99,7 @@ func (n *Notifier) UpdateFD(fd uint32) {
|
||||
// object. Once notifications arrive, they are dispatched to the
|
||||
// registered queue.
|
||||
func (n *Notifier) waitAndNotify(ioInit chan int32) error {
|
||||
// plugin stack leverages TLS varaibles, so bind this goroutine with
|
||||
// plugin stack leverages TLS variables, so bind this goroutine with
|
||||
// one specific OS thread
|
||||
runtime.LockOSThread()
|
||||
|
||||
|
||||
@@ -283,8 +283,8 @@ func (b *BridgeEndpoint) Close() {}
|
||||
// SetOnCloseAction implements stack.LinkEndpoint.Close.
|
||||
func (b *BridgeEndpoint) SetOnCloseAction(func()) {}
|
||||
|
||||
// Add a new FDBEntry by learning. The learning happens when a packaet
|
||||
// is recevied by a bridge port, the bridge will use the port for the future
|
||||
// Add a new FDBEntry by learning. The learning happens when a packet
|
||||
// is received by a bridge port, the bridge will use the port for the future
|
||||
// deliveries to the NIC device.
|
||||
// The addr is the key when it looks for the entry.
|
||||
//
|
||||
|
||||
@@ -1149,7 +1149,7 @@ type NetworkLinkEndpoint interface {
|
||||
// Close is called when the endpoint is removed from a stack.
|
||||
Close()
|
||||
|
||||
// SetOnCloseAction sets the action that will be exected before closing the
|
||||
// SetOnCloseAction sets the action that will be executed before closing the
|
||||
// endpoint. It is used to destroy a network device when its endpoint
|
||||
// is closed. Endpoints that are closed only after destroying their
|
||||
// network devices can implement this method as no-op.
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ go_binary(
|
||||
# The runsc-race target is a race-compatible BUILD target. This must be built
|
||||
# via: bazel build --features=race :runsc-race
|
||||
#
|
||||
# This is neccessary because the race feature must apply to all dependencies
|
||||
# This is necessary because the race feature must apply to all dependencies
|
||||
# due a bug in gazelle file selection. The pure attribute must be off because
|
||||
# the race detector requires linking with non-Go components, although we still
|
||||
# require a static binary.
|
||||
|
||||
@@ -33,7 +33,7 @@ var (
|
||||
)
|
||||
|
||||
// hostInetConn allows reading and writing to a local host socket for hostinet.
|
||||
// hostInetConn implments proxyConn.
|
||||
// hostInetConn implements proxyConn.
|
||||
type hostInetConn struct {
|
||||
// wq is the WaitQueue registered with fdnotifier for this fd.
|
||||
wq waiter.Queue
|
||||
|
||||
@@ -64,7 +64,7 @@ func TestLocalHostSocket(t *testing.T) {
|
||||
}
|
||||
|
||||
if !slices.Equal(data[:recLen], clientData) {
|
||||
return fmt.Errorf("server mismatch data recieved: got: %s want: %s", data[:recLen], clientData)
|
||||
return fmt.Errorf("server mismatch data received: got: %s want: %s", data[:recLen], clientData)
|
||||
}
|
||||
|
||||
sentLen, err := conn.Write(serverData)
|
||||
|
||||
@@ -96,7 +96,7 @@ type ProcessProcfsDump struct {
|
||||
StartTime int64 `json:"clone_ts,omitempty"`
|
||||
// Root is /proc/[pid]/root.
|
||||
Root string `json:"root,omitempty"`
|
||||
// Limits constains resource limits for this process. Currently only
|
||||
// Limits constrains resource limits for this process. Currently only
|
||||
// RLIMIT_NOFILE is supported.
|
||||
Limits map[string]limits.Limit `json:"limits,omitempty"`
|
||||
// Cgroup is /proc/[pid]/cgroup split into an array.
|
||||
|
||||
+1
-1
@@ -1006,7 +1006,7 @@ func (c *containerMounter) mountTmp(ctx context.Context, spec *specs.Spec, conf
|
||||
for _, m := range c.mounts {
|
||||
// m.Destination has been cleaned, so it's to use equality here.
|
||||
if m.Destination == "/tmp" {
|
||||
log.Debugf(`Explict "/tmp" mount found, skipping internal tmpfs, mount: %+v`, m)
|
||||
log.Debugf(`Explicit "/tmp" mount found, skipping internal tmpfs, mount: %+v`, m)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ func TestIsValidSlice(t *testing.T) {
|
||||
err: ErrInvalidSlice,
|
||||
},
|
||||
{
|
||||
name: "has path seperators",
|
||||
name: "has path separators",
|
||||
slice: "systemd.slice/child.slice",
|
||||
err: ErrInvalidSlice,
|
||||
},
|
||||
|
||||
+1
-1
@@ -585,7 +585,7 @@ func (b *Boot) Execute(_ context.Context, f *flag.FlagSet, args ...any) subcomma
|
||||
// prepareArgs returns the args that can be used to re-execute the current
|
||||
// program. It manipulates the flags of the subcommands.Command identified by
|
||||
// subCmdName and fSet is the flag.FlagSet of this subcommand. It applies the
|
||||
// flags specified by override map. In case of conflict, flag is overriden.
|
||||
// flags specified by override map. In case of conflict, flag is overridden.
|
||||
//
|
||||
// Postcondition: prepareArgs() takes ownership of override map.
|
||||
func prepareArgs(subCmdName string, fSet *flag.FlagSet, override map[string]string) []string {
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ func (d *Debug) Execute(_ context.Context, f *flag.FlagSet, args ...any) subcomm
|
||||
pid := c.Sandbox.Getpid()
|
||||
util.Infof("Sending signal %d to process: %d", d.signal, pid)
|
||||
if err := unix.Kill(pid, unix.Signal(d.signal)); err != nil {
|
||||
return util.Errorf("failed to send signal %d to processs %d", d.signal, pid)
|
||||
return util.Errorf("failed to send signal %d to process %d", d.signal, pid)
|
||||
}
|
||||
}
|
||||
if d.stacks {
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ func (c *Do) Execute(_ context.Context, f *flag.FlagSet, args ...any) subcommand
|
||||
conf.Network = config.NetworkHost
|
||||
|
||||
case nil:
|
||||
// Setup successfull.
|
||||
// Setup successful.
|
||||
defer clean()
|
||||
|
||||
default:
|
||||
|
||||
+1
-1
@@ -596,7 +596,7 @@ func shouldExposeNvidiaDevice(path string) bool {
|
||||
}
|
||||
|
||||
// shouldExposeVfioDevice returns true if path refers to an VFIO device
|
||||
// which shuold be exposed to the container.
|
||||
// which should be exposed to the container.
|
||||
func shouldExposeVFIODevice(path string) bool {
|
||||
return strings.HasPrefix(path, filepath.Dir(vfio.VFIOPath))
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func (i *Install) Execute(_ context.Context, f *flag.FlagSet, _ ...any) subcomma
|
||||
// Extract the executable.
|
||||
path, err := os.Executable()
|
||||
if err != nil {
|
||||
log.Fatalf("Error reading current exectuable: %v", err)
|
||||
log.Fatalf("Error reading current executable: %v", err)
|
||||
}
|
||||
|
||||
i.executablePath = path
|
||||
|
||||
@@ -88,7 +88,7 @@ func (m *Mitigate) Execute(_ context.Context, f *flag.FlagSet, args ...any) subc
|
||||
return m.execute()
|
||||
}
|
||||
|
||||
// execute executes mitigate operations. Seperate from Execute method for
|
||||
// execute executes mitigate operations. Separate from Execute method for
|
||||
// easier mocking.
|
||||
func (m *Mitigate) execute() subcommands.ExitStatus {
|
||||
beforeSet, err := m.control.getCPUs()
|
||||
|
||||
@@ -79,7 +79,7 @@ OPTIONS:
|
||||
|
||||
// SetFlags implements subcommands.Command.SetFlags.
|
||||
func (p *PortForward) SetFlags(f *flag.FlagSet) {
|
||||
f.StringVar(&p.stream, "stream", "", "Stream mode - a Unix doman socket")
|
||||
f.StringVar(&p.stream, "stream", "", "Stream mode - a Unix domain socket")
|
||||
}
|
||||
|
||||
// Execute implements subcommands.Command.Execute.
|
||||
|
||||
@@ -52,7 +52,7 @@ func (*Statefile) Usage() string {
|
||||
|
||||
// SetFlags implements subcommands.Command.
|
||||
func (s *Statefile) SetFlags(f *flag.FlagSet) {
|
||||
f.BoolVar(&s.list, "list", false, "lists the metdata in the statefile.")
|
||||
f.BoolVar(&s.list, "list", false, "lists the metadata in the statefile.")
|
||||
f.StringVar(&s.get, "get", "", "extracts the given metadata key.")
|
||||
f.StringVar(&s.key, "key", "", "the integrity key for the file.")
|
||||
f.StringVar(&s.output, "output", "", "target to write the result.")
|
||||
|
||||
@@ -1139,7 +1139,7 @@ const (
|
||||
// Linux network stack.
|
||||
XDPModeRedirect
|
||||
|
||||
// XDPModeTunnel uses XDP_REDIRECT to redirect packets directy from the
|
||||
// XDPModeTunnel uses XDP_REDIRECT to redirect packets directly from the
|
||||
// host NIC to the VETH device inside the container's network
|
||||
// namespace. Packets are read from the VETH via AF_XDP, as in
|
||||
// XDPModeNS.
|
||||
|
||||
@@ -33,7 +33,7 @@ import (
|
||||
)
|
||||
|
||||
// socketPath creates a path inside bundleDir and ensures that the returned
|
||||
// path is under 108 charactors (the unix socket path length limit),
|
||||
// path is under 108 characters (the unix socket path length limit),
|
||||
// relativizing the path if necessary.
|
||||
func socketPath(bundleDir string) (string, error) {
|
||||
num := rand.Intn(10000)
|
||||
|
||||
@@ -885,7 +885,7 @@ func TestExec(t *testing.T) {
|
||||
}
|
||||
|
||||
// TestExecProcList verifies that a container can exec a new program and it
|
||||
// shows correcly in the process list.
|
||||
// shows correctly in the process list.
|
||||
func TestExecProcList(t *testing.T) {
|
||||
for name, conf := range configs(t, false /* noOverlay */) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
@@ -2007,7 +2007,7 @@ func TestAbbreviatedIDs(t *testing.T) {
|
||||
defer cont.Destroy()
|
||||
}
|
||||
|
||||
// These should all be unambigious.
|
||||
// These should all be unambiguous.
|
||||
unambiguous := map[string]string{
|
||||
"f": cids[0],
|
||||
cids[0]: cids[0],
|
||||
|
||||
@@ -83,7 +83,7 @@ func (rpc *goferToHostRPC) OpenMount(m *specs.Mount, res *OpenMountResult) error
|
||||
rpc.openMountRequests = make(chan *openMountRequest)
|
||||
go func() {
|
||||
// This goroutine holds the current threads forever. It
|
||||
// never exits, because child proccesses can set
|
||||
// never exits, because child processes can set
|
||||
// PDEATHSIG. It can't serve other go-routines, because
|
||||
// it does unshare CLONE_FS.
|
||||
runtime.LockOSThread()
|
||||
|
||||
@@ -478,7 +478,7 @@ func TestMultiPIDNSKill(t *testing.T) {
|
||||
// Wait until all processes are created.
|
||||
for _, c := range containers {
|
||||
if err := waitForProcessCount(c, processes); err != nil {
|
||||
t.Fatalf("error waitting for processes: %v", err)
|
||||
t.Fatalf("error waiting for processes: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,7 +496,7 @@ func TestMultiPIDNSKill(t *testing.T) {
|
||||
}
|
||||
// Wait for the process to get killed.
|
||||
if err := waitForProcessCount(c, processes-1); err != nil {
|
||||
t.Fatalf("error waitting for processes: %v", err)
|
||||
t.Fatalf("error waiting for processes: %v", err)
|
||||
}
|
||||
procs, err = c.Processes()
|
||||
if err != nil {
|
||||
@@ -1038,7 +1038,7 @@ func TestMultiContainerKillAll(t *testing.T) {
|
||||
// Wait until all processes are created.
|
||||
rootProcCount := int(math.Pow(2, 3) - 1)
|
||||
if err := waitForProcessCount(containers[0], rootProcCount); err != nil {
|
||||
t.Fatalf("error waitting for processes: %v", err)
|
||||
t.Fatalf("error waiting for processes: %v", err)
|
||||
}
|
||||
procCount := int(math.Pow(2, 5) - 1)
|
||||
if err := waitForProcessCount(containers[1], procCount); err != nil {
|
||||
|
||||
@@ -240,7 +240,7 @@ func TestSharedVolumeFile(t *testing.T) {
|
||||
// read inside.
|
||||
f, err := os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, 0)
|
||||
if err != nil {
|
||||
t.Fatalf("Error openning file %q: %v", filename, err)
|
||||
t.Fatalf("Error opening file %q: %v", filename, err)
|
||||
}
|
||||
defer f.Close()
|
||||
if _, err := f.Write([]byte("host")); err != nil {
|
||||
|
||||
@@ -345,7 +345,7 @@ func TestProcfsDump(t *testing.T) {
|
||||
|
||||
// Check that bin/sleep is part of the executable path.
|
||||
if wantExeSubStr := "bin/sleep"; !strings.HasSuffix(procfsDump[0].Exe, wantExeSubStr) {
|
||||
t.Errorf("expected %q to be part of execuable path %q", wantExeSubStr, procfsDump[0].Exe)
|
||||
t.Errorf("expected %q to be part of executable path %q", wantExeSubStr, procfsDump[0].Exe)
|
||||
}
|
||||
|
||||
if len(procfsDump[0].Args) != 2 {
|
||||
|
||||
@@ -46,7 +46,7 @@ type CPUSet []*CPU
|
||||
// NewCPUSet creates a CPUSet from data read from /proc/cpuinfo.
|
||||
func NewCPUSet(data string) (CPUSet, error) {
|
||||
// Each processor entry should start with the
|
||||
// processor key. Find the beginings of each.
|
||||
// processor key. Find the beginnings of each.
|
||||
r := buildRegex(processorKey)
|
||||
indices := r.FindAllStringIndex(data, -1)
|
||||
|
||||
@@ -59,7 +59,7 @@ func NewCPUSet(data string) (CPUSet, error) {
|
||||
|
||||
// Valid cpus are now defined by strings in between
|
||||
// indexes (e.g. data[index[i], index[i+1]]).
|
||||
// There should be len(indicies) - 1 CPUs
|
||||
// There should be len(indices) - 1 CPUs
|
||||
// since the last index is the end of the string.
|
||||
var set CPUSet
|
||||
// Find each string that represents a CPU. These begin "processor".
|
||||
|
||||
@@ -847,7 +847,7 @@ func (s *Sandbox) createSandboxProcess(conf *config.Config, args *Args, startSyn
|
||||
// shown as `exe`.
|
||||
cmd.Args[0] = "runsc-sandbox"
|
||||
|
||||
// Tranfer FDs that need to be present before the "boot" command.
|
||||
// Transfer FDs that need to be present before the "boot" command.
|
||||
// Start at 3 because 0, 1, and 2 are taken by stdin/out/err.
|
||||
nextFD := donations.Transfer(cmd, 3)
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ import (
|
||||
// lifetime. This also means only one container can run at a time, as it
|
||||
// monopolizes the device.
|
||||
//
|
||||
// TODO(b/240191988): Enbable device sharing via XDP_SHARED_UMEM.
|
||||
// TODO(b/240191988): Enable device sharing via XDP_SHARED_UMEM.
|
||||
// TODO(b/240191988): IPv6 support.
|
||||
// TODO(b/240191988): Merge redundant code with CreateLinksAndRoutes once
|
||||
// features are finalized.
|
||||
@@ -93,7 +93,7 @@ func createRedirectInterfacesAndRoutes(conn *urpc.Client, conf *config.Config) e
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load pinned map %s: %w", mapPath, err)
|
||||
}
|
||||
// TODO(b/240191988): Updating of pinned maps should be sychronized and
|
||||
// TODO(b/240191988): Updating of pinned maps should be synchronized and
|
||||
// check for the existence of the key.
|
||||
mapKey := uint32(0)
|
||||
mapVal := uint32(xdpSockFD)
|
||||
@@ -280,7 +280,7 @@ func createSocketXDP(iface net.Interface) ([]*os.File, error) {
|
||||
|
||||
// Insert our AF_XDP socket into the BPF map that dictates where
|
||||
// packets are redirected to.
|
||||
// TODO(b/240191988): Updating of pinned maps should be sychronized and
|
||||
// TODO(b/240191988): Updating of pinned maps should be synchronized and
|
||||
// check for the existence of the key.
|
||||
key := uint32(0)
|
||||
val := uint32(fd)
|
||||
@@ -390,7 +390,7 @@ func createXDPTunnel(conn *urpc.Client, nsPath string, conf *config.Config) erro
|
||||
// Insert our AF_XDP socket into the BPF map that dictates where
|
||||
// packets are redirected to.
|
||||
// TODO(b/240191988): Updating of pinned maps should be
|
||||
// sychronized and check for the existence of the key.
|
||||
// synchronized and check for the existence of the key.
|
||||
key := uint32(0)
|
||||
val := uint32(fd)
|
||||
if err := objects.SockMap.Update(&key, &val, 0 /* flags */); err != nil {
|
||||
@@ -448,7 +448,7 @@ func createXDPTunnel(conn *urpc.Client, nsPath string, conf *config.Config) erro
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load pinned host map %s: %w", hostMapPath, err)
|
||||
}
|
||||
// TODO(b/240191988): Updating of pinned maps should be sychronized and
|
||||
// TODO(b/240191988): Updating of pinned maps should be synchronized and
|
||||
// check for the existence of the key.
|
||||
mapKey := uint32(0)
|
||||
mapVal := uint32(vethIface.Index)
|
||||
@@ -530,7 +530,7 @@ func createXDPTunnel(conn *urpc.Client, nsPath string, conf *config.Config) erro
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load pinned veth map %s: %w", vethMapPath, err)
|
||||
}
|
||||
// TODO(b/240191988): Updating of pinned maps should be sychronized and
|
||||
// TODO(b/240191988): Updating of pinned maps should be synchronized and
|
||||
// check for the existence of the key.
|
||||
mapKey = uint32(0)
|
||||
mapVal = uint32(hostIface.Index)
|
||||
|
||||
@@ -357,7 +357,7 @@ func AllCapabilitiesUint64() uint64 {
|
||||
return rv
|
||||
}
|
||||
|
||||
// MergeCapabilities merges the capabilites from first and second.
|
||||
// MergeCapabilities merges the capabilities from first and second.
|
||||
func MergeCapabilities(first, second *specs.LinuxCapabilities) *specs.LinuxCapabilities {
|
||||
return &specs.LinuxCapabilities{
|
||||
Bounding: mergeUnique(first.Bounding, second.Bounding),
|
||||
@@ -454,7 +454,7 @@ func capsFromNames(names []string, skipSet map[linux.Capability]struct{}) (auth.
|
||||
if !ok {
|
||||
return 0, fmt.Errorf("unknown capability %q", n)
|
||||
}
|
||||
// Should we skip this capabilty?
|
||||
// Should we skip this capability?
|
||||
if _, ok := skipSet[c]; ok {
|
||||
continue
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ To run root tests, run:
|
||||
There are a few other interesting variations for image and integration tests:
|
||||
|
||||
* overlay: sets writable overlay inside the sentry
|
||||
* hostnet: configures host network pass-thru, instead of netstack
|
||||
* hostnet: configures host network passthrough, instead of netstack
|
||||
* kvm: runsc the test using the KVM platform, instead of systrap
|
||||
|
||||
The test will build runsc, configure it with your local docker, restart
|
||||
|
||||
@@ -150,7 +150,7 @@ func BenchmarkSizeNode(b *testing.B) {
|
||||
cmd, args := meminfo.MakeCmd()
|
||||
before, err := machine.RunCommand(cmd, args...)
|
||||
if err != nil {
|
||||
b.Fatalf("failed to run meminfo commend: %v", err)
|
||||
b.Fatalf("failed to run meminfo command: %v", err)
|
||||
}
|
||||
|
||||
// Create N Node servers.
|
||||
|
||||
@@ -117,7 +117,7 @@ func doBenchmarkRedis(b *testing.B, ops []string) {
|
||||
}
|
||||
name, err := tools.ParametersToName(param)
|
||||
if err != nil {
|
||||
b.Fatalf("Failed to parse paramaters: %v", err)
|
||||
b.Fatalf("Failed to parse parameters: %v", err)
|
||||
}
|
||||
|
||||
b.Run(name, func(b *testing.B) {
|
||||
|
||||
@@ -28,7 +28,7 @@ var (
|
||||
debug = flag.Bool("debug", false, "turns on debug messages for individual benchmarks")
|
||||
)
|
||||
|
||||
// Init performs any harness initilialization before runs.
|
||||
// Init performs any harness initialization before runs.
|
||||
func Init() error {
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "Usage: %s -- --test.bench=<regex>\n", os.Args[0])
|
||||
|
||||
@@ -39,7 +39,7 @@ func BenchmarkHttpd(b *testing.B) {
|
||||
benchmarkHttpdDocSize(b)
|
||||
}
|
||||
|
||||
// BenchmarkContinuousHttpd runs specific benchmarks for continous jobs.
|
||||
// BenchmarkContinuousHttpd runs specific benchmarks for continuous jobs.
|
||||
// The runtime under test is the server serving a runc client.
|
||||
func BenchmarkContinuousHttpd(b *testing.B) {
|
||||
sizes := []string{"10Kb", "100Kb", "1Mb"}
|
||||
|
||||
@@ -40,7 +40,7 @@ func BenchmarkNginxDocSize(b *testing.B) {
|
||||
benchmarkNginxDocSize(b, false /* tmpfs */)
|
||||
}
|
||||
|
||||
// BenchmarkContinuousNginx runs specific benchmarks for continous jobs.
|
||||
// BenchmarkContinuousNginx runs specific benchmarks for continuous jobs.
|
||||
// The runtime under test is the sever serving a runc client.
|
||||
func BenchmarkContinuousNginx(b *testing.B) {
|
||||
sizes := []string{"10Kb", "100Kb", "1Mb"}
|
||||
|
||||
@@ -28,8 +28,8 @@ import (
|
||||
|
||||
// BenchmarkNode runs requests using 'hey' against a Node server run on
|
||||
// 'runtime'. The server responds to requests by grabbing some data in a
|
||||
// redis instance and returns the data in its reponse. The test loops through
|
||||
// increasing amounts of concurency for requests.
|
||||
// redis instance and returns the data in its response. The test loops through
|
||||
// increasing amounts of concurrency for requests.
|
||||
func BenchmarkNode(b *testing.B) {
|
||||
concurrency := []int{1, 5, 10, 25}
|
||||
for _, c := range concurrency {
|
||||
|
||||
@@ -74,7 +74,7 @@ var (
|
||||
traceprofile = flag.String("traceprofile", "", "write a 5s trace of the benchmark to the specified file.")
|
||||
useIpv6 = flag.Bool("ipv6", false, "use ipv6 instead of ipv4.")
|
||||
sniff = flag.Bool("sniff", false, "log sniffed packets")
|
||||
useXDP = flag.Bool("xdp", false, "use AF_XDP as a link enpoint instead of fdbased")
|
||||
useXDP = flag.Bool("xdp", false, "use AF_XDP as a link endpoint instead of fdbased")
|
||||
)
|
||||
|
||||
type impl interface {
|
||||
|
||||
@@ -139,7 +139,7 @@ func (s *SysbenchMemory) Report(b *testing.B, output string) {
|
||||
|
||||
var memoryOperationsRE = regexp.MustCompile(`Total\s+operations:\s+\d+\s+\((\s*\d+\.\d+\s*)\s+per\s+second\)`)
|
||||
|
||||
// parseOperations parses memory operations per second form sysbench memory ouput.
|
||||
// parseOperations parses memory operations per second form sysbench memory output.
|
||||
func (s *SysbenchMemory) parseOperations(data string) (float64, error) {
|
||||
match := memoryOperationsRE.FindStringSubmatch(data)
|
||||
if len(match) < 2 {
|
||||
|
||||
@@ -80,7 +80,7 @@ func TestExecCapabilities(t *testing.T) {
|
||||
t.Errorf("wrong %s, got: %q, want: %q", cap, got, want)
|
||||
}
|
||||
// CapBnd and CpaInh are unchanged, other capabilities will
|
||||
// be tranformed for non-root users.
|
||||
// be transformed for non-root users.
|
||||
wantCaps[cap] = fmt.Sprintf("%s:\t%s\n", cap, noCap)
|
||||
if cap == "CapBnd" || cap == "CapInh" {
|
||||
wantCaps[cap] = got
|
||||
|
||||
@@ -1040,7 +1040,7 @@ func (*FilterInputInvertDportDrop) ContainerAction(ctx context.Context, ip net.I
|
||||
timedCtx, cancel := context.WithTimeout(ctx, NegativeTimeout)
|
||||
defer cancel()
|
||||
if err := listenTCP(timedCtx, dropPort, ipv6); err == nil {
|
||||
return fmt.Errorf("connection was established when it shouldnt have been")
|
||||
return fmt.Errorf("connection was established when it shouldn't have been")
|
||||
} else if !errors.Is(err, context.DeadlineExceeded) {
|
||||
return fmt.Errorf("error reading: %v", err)
|
||||
}
|
||||
|
||||
@@ -769,7 +769,7 @@ func (*FilterOutputInvertSportDrop) ContainerAction(ctx context.Context, ip net.
|
||||
timedCtx, cancel := context.WithTimeout(ctx, NegativeTimeout)
|
||||
defer cancel()
|
||||
if err := listenTCP(timedCtx, dropPort, ipv6); err == nil {
|
||||
return fmt.Errorf("connection was established when it shouldnt have been")
|
||||
return fmt.Errorf("connection was established when it shouldn't have been")
|
||||
} else if !errors.Is(err, context.DeadlineExceeded) {
|
||||
return fmt.Errorf("error reading: %v", err)
|
||||
}
|
||||
@@ -938,7 +938,7 @@ func (*FilterOutputDropSrcPorts) LocalAction(ctx context.Context, ip net.IP, ipv
|
||||
|
||||
if err := connectTCP(timedCtx, ip, port, ipv6); err == nil {
|
||||
errCh <- fmt.Errorf(
|
||||
"expected timout error on port %d, but got: %w",
|
||||
"expected timeout error on port %d, but got: %w",
|
||||
port, err,
|
||||
)
|
||||
return
|
||||
|
||||
@@ -88,7 +88,7 @@ func MeasureStartup(ctx context.Context, t *testing.T, k8sCtx k8sctx.KubernetesC
|
||||
t.Fatalf("Failed to read log on cluster %q: %v", cluster.GetName(), err)
|
||||
}
|
||||
if strings.TrimSpace(buf.String()) != "hello" {
|
||||
t.Fatalf("Mistmatch output: got: %q want: %q", buf.String(), "hello")
|
||||
t.Fatalf("Mismatched output: got: %q want: %q", buf.String(), "hello")
|
||||
}
|
||||
|
||||
// For longer running containers, and where the desired duration to
|
||||
|
||||
@@ -10,7 +10,7 @@ message TestRangeSpec {
|
||||
// Name for clusters. This name will be used as a template for all created
|
||||
// clusters (e.g. my-cluster will have clusters named something like
|
||||
// "my-cluster-0" with an ascending index). Cluster names are limited to
|
||||
// 40 charecters, so names will be truncated to fit this constraint.
|
||||
// 40 characters, so names will be truncated to fit this constraint.
|
||||
string name = 1;
|
||||
|
||||
// A nodepool built with the runtime under test.
|
||||
|
||||
@@ -59,6 +59,6 @@ func RunHello(ctx context.Context, t *testing.T, k8sCtx k8sctx.KubernetesContext
|
||||
t.Fatalf("Failed to read log on cluster %q: %v", cluster.GetName(), err)
|
||||
}
|
||||
if strings.TrimSpace(buf.String()) != "hello" {
|
||||
t.Fatalf("Mistmatch output: got: %q want: %q", buf.String(), "hello")
|
||||
t.Fatalf("Mismatch output: got: %q want: %q", buf.String(), "hello")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ func (p ProctorSettings) ToArgs() []string {
|
||||
type Filter func(test string) bool
|
||||
|
||||
// RunTests is a helper that is called by main. It exists so that we can run
|
||||
// defered functions before exiting. It returns an exit code that should be
|
||||
// deferred functions before exiting. It returns an exit code that should be
|
||||
// passed to os.Exit.
|
||||
func RunTests(lang, image string, filter Filter, batchSize int, timeout time.Duration, proctorSettings ProctorSettings) int {
|
||||
// Construct the shared docker instance.
|
||||
|
||||
@@ -89,7 +89,7 @@ SyscallFailsWithErrno(...)
|
||||
|
||||
### Use test utilities (RAII classes)
|
||||
|
||||
The test utilties are written as RAII classes. These utilities should be
|
||||
The test utilities are written as RAII classes. These utilities should be
|
||||
preferred over custom test harnesses.
|
||||
|
||||
Local class instances should be preferred, wherever possible, over full test
|
||||
|
||||
@@ -1080,7 +1080,7 @@ TEST(DevicesCgroup, IgnorePartialMatchRule) {
|
||||
IsPosixErrorOkAndHolds("c 7:* rw\n"));
|
||||
|
||||
// Expect no change to the allow list since minor device matches partially a
|
||||
// exsting rule for character devices 7:*.
|
||||
// existing rule for character devices 7:*.
|
||||
ASSERT_NO_ERRNO(c.WriteControlFile("devices.deny", "c 7:0 w"));
|
||||
EXPECT_THAT(c.ReadControlFile("devices.list"),
|
||||
IsPosixErrorOkAndHolds("c 7:* rw\n"));
|
||||
|
||||
@@ -490,7 +490,7 @@ TEST(ElfTest, DataSegment) {
|
||||
})));
|
||||
}
|
||||
|
||||
// Additonal pages beyond filesz honor (only) execute protections.
|
||||
// Additional pages beyond filesz honor (only) execute protections.
|
||||
//
|
||||
// N.B. Linux changed this in 4.11 (16e72e9b30986 "powerpc: do not make the
|
||||
// entire heap executable"). Previously, extra pages were always RW.
|
||||
|
||||
@@ -83,7 +83,7 @@ TEST_F(FlockTest, TestLockableAnyMode) {
|
||||
}
|
||||
|
||||
TEST_F(FlockTest, TestUnlockWithNoHolders) {
|
||||
// Test that unlocking when no one holds a lock succeeeds.
|
||||
// Test that unlocking when no one holds a lock succeeds.
|
||||
ASSERT_THAT(flock(test_file_fd_.get(), LOCK_UN), SyscallSucceedsWithValue(0));
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ TEST_F(FlockTest, TestMultipleHolderSharedExclusive) {
|
||||
const FileDescriptor fd =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(Open(test_file_name_, O_RDWR));
|
||||
|
||||
// Verify We're unable to get an exlcusive lock via the second FD.
|
||||
// Verify We're unable to get an exclusive lock via the second FD.
|
||||
// because someone is holding a shared lock.
|
||||
ASSERT_THAT(flock(fd.get(), LOCK_EX | LOCK_NB),
|
||||
SyscallFailsWithErrno(EWOULDBLOCK));
|
||||
@@ -518,7 +518,7 @@ TEST_F(FlockTest, BlockingLockNoBlockingForSharedLocks) {
|
||||
|
||||
// Only a single shared lock is held, the lock will be granted immediately.
|
||||
// This should be granted without any blocking. Don't save here to avoid
|
||||
// wild discrepencies on timing.
|
||||
// wild discrepancies on timing.
|
||||
timer.Start();
|
||||
ASSERT_THAT(flock(fd.get(), LOCK_SH), SyscallSucceeds());
|
||||
|
||||
@@ -535,7 +535,7 @@ TEST_F(FlockTest, BlockingLockNoBlockingForSharedLocks) {
|
||||
absl::SleepFor(kHoldLockTime);
|
||||
|
||||
// Release the first shared lock. Don't save in this situation to avoid
|
||||
// discrepencies in timing.
|
||||
// discrepancies in timing.
|
||||
EXPECT_THAT(flock(test_file_fd_.get(), LOCK_UN), SyscallSucceeds());
|
||||
}
|
||||
|
||||
@@ -557,7 +557,7 @@ TEST_F(FlockTest, BlockingLockFirstSharedSecondExclusive) {
|
||||
ASSERT_NO_ERRNO_AND_VALUE(Open(test_file_name_, O_RDWR));
|
||||
|
||||
// This exclusive lock should block because someone is already holding a
|
||||
// shared lock. We don't save here to avoid wild discrepencies on timing.
|
||||
// shared lock. We don't save here to avoid wild discrepancies on timing.
|
||||
timer.Start();
|
||||
ASSERT_THAT(RetryEINTR(flock)(fd.get(), LOCK_EX), SyscallSucceeds());
|
||||
|
||||
@@ -572,7 +572,7 @@ TEST_F(FlockTest, BlockingLockFirstSharedSecondExclusive) {
|
||||
absl::SleepFor(kHoldLockTime);
|
||||
|
||||
// Release the shared lock allowing the thread to proceed.
|
||||
// We don't save here to avoid wild discrepencies in timing.
|
||||
// We don't save here to avoid wild discrepancies in timing.
|
||||
EXPECT_THAT(flock(test_file_fd_.get(), LOCK_UN), SyscallSucceeds());
|
||||
}
|
||||
|
||||
@@ -594,7 +594,7 @@ TEST_F(FlockTest, BlockingLockFirstExclusiveSecondShared) {
|
||||
ASSERT_NO_ERRNO_AND_VALUE(Open(test_file_name_, O_RDWR));
|
||||
|
||||
// This shared lock should block because someone is already holding an
|
||||
// exclusive lock. We don't save here to avoid wild discrepencies on timing.
|
||||
// exclusive lock. We don't save here to avoid wild discrepancies on timing.
|
||||
timer.Start();
|
||||
ASSERT_THAT(RetryEINTR(flock)(fd.get(), LOCK_SH), SyscallSucceeds());
|
||||
|
||||
@@ -609,7 +609,7 @@ TEST_F(FlockTest, BlockingLockFirstExclusiveSecondShared) {
|
||||
absl::SleepFor(kHoldLockTime);
|
||||
|
||||
// Release the exclusive lock allowing the blocked thread to proceed.
|
||||
// We don't save here to avoid wild discrepencies in timing.
|
||||
// We don't save here to avoid wild discrepancies in timing.
|
||||
EXPECT_THAT(flock(test_file_fd_.get(), LOCK_UN), SyscallSucceeds());
|
||||
}
|
||||
|
||||
@@ -646,7 +646,7 @@ TEST_F(FlockTest, BlockingLockFirstExclusiveSecondExclusive) {
|
||||
absl::SleepFor(kHoldLockTime);
|
||||
|
||||
// Release the exclusive lock allowing the blocked thread to proceed.
|
||||
// We don't save to avoid wild discrepencies in timing.
|
||||
// We don't save to avoid wild discrepancies in timing.
|
||||
EXPECT_THAT(flock(test_file_fd_.get(), LOCK_UN), SyscallSucceeds());
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class ForkTest : public ::testing::Test {
|
||||
}
|
||||
}
|
||||
|
||||
// Exit exits the proccess.
|
||||
// Exit exits the process.
|
||||
void Exit(int code) {
|
||||
_exit(code);
|
||||
|
||||
|
||||
@@ -1008,7 +1008,7 @@ TEST(Inotify, ReadWithTooSmallBufferFails) {
|
||||
// outright without the event being dequeued.
|
||||
EXPECT_THAT(read(fd.get(), buf.data(), sizeof(struct inotify_event) - 1),
|
||||
SyscallFailsWithErrno(EINVAL));
|
||||
// Try a buffer just large enough. This should succeeed.
|
||||
// Try a buffer just large enough. This should succeed.
|
||||
EXPECT_THAT(
|
||||
readlen = read(fd.get(), buf.data(), sizeof(struct inotify_event)),
|
||||
SyscallSucceeds());
|
||||
@@ -2017,7 +2017,7 @@ TEST(Inotify, Exec) {
|
||||
// descriptors after their corresponding files have been unlinked.
|
||||
//
|
||||
// We need to disable S/R because there are filesystems where we cannot re-open
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesytems.
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesystems.
|
||||
TEST(Inotify, IncludeUnlinkedFile) {
|
||||
const DisableSave ds;
|
||||
|
||||
@@ -2070,7 +2070,7 @@ TEST(Inotify, IncludeUnlinkedFile) {
|
||||
// children that have already been unlinked.
|
||||
//
|
||||
// We need to disable S/R because there are filesystems where we cannot re-open
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesytems.
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesystems.
|
||||
TEST(Inotify, ExcludeUnlink) {
|
||||
const DisableSave ds;
|
||||
const TempPath dir = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateDir());
|
||||
@@ -2108,7 +2108,7 @@ TEST(Inotify, ExcludeUnlink) {
|
||||
}
|
||||
|
||||
// We need to disable S/R because there are filesystems where we cannot re-open
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesytems.
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesystems.
|
||||
TEST(Inotify, ExcludeUnlinkDirectory) {
|
||||
const DisableSave ds;
|
||||
const TempPath parent = ASSERT_NO_ERRNO_AND_VALUE(TempPath::CreateDir());
|
||||
@@ -2148,7 +2148,7 @@ TEST(Inotify, ExcludeUnlinkDirectory) {
|
||||
// for fds on "dir/child" but not "dir/child2".
|
||||
//
|
||||
// We need to disable S/R because there are filesystems where we cannot re-open
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesytems.
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesystems.
|
||||
TEST(Inotify, ExcludeUnlinkMultipleChildren) {
|
||||
// Inotify does not work properly with hard links in gofer and overlay fs.
|
||||
SKIP_IF(IsRunningOnGvisor() &&
|
||||
@@ -2192,7 +2192,7 @@ TEST(Inotify, ExcludeUnlinkMultipleChildren) {
|
||||
// events include changes to metadata and extended attributes.
|
||||
//
|
||||
// We need to disable S/R because there are filesystems where we cannot re-open
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesytems.
|
||||
// fds to an unlinked file across S/R, e.g. gofer-backed filesystems.
|
||||
TEST(Inotify, ExcludeUnlinkInodeEvents) {
|
||||
// NOTE(gvisor.dev/issue/3654): In the gofer filesystem, we do not allow
|
||||
// setting attributes through an fd if the file at the open path has been
|
||||
|
||||
@@ -309,10 +309,10 @@ TEST(MemfdTest, SealWriteWithWrite) {
|
||||
SyscallSucceedsWithValue(kPageSize));
|
||||
ASSERT_THAT(fcntl(memfd.get(), F_ADD_SEALS, F_SEAL_WRITE), SyscallSucceeds());
|
||||
|
||||
// Attemping to write at the end of the file fails.
|
||||
// Attempting to write at the end of the file fails.
|
||||
EXPECT_THAT(write(memfd.get(), buf.data(), 1), SyscallFailsWithErrno(EPERM));
|
||||
|
||||
// Attemping to overwrite an existing part of the memfd fails.
|
||||
// Attempting to overwrite an existing part of the memfd fails.
|
||||
EXPECT_THAT(pwrite(memfd.get(), buf.data(), 1, 0),
|
||||
SyscallFailsWithErrno(EPERM));
|
||||
EXPECT_THAT(pwrite(memfd.get(), buf.data(), buf.size() / 2, kPageSize / 2),
|
||||
|
||||
@@ -47,7 +47,7 @@ TEST(MknodTest, RegularFilePermissions) {
|
||||
umask(newUmask);
|
||||
|
||||
// Attempt to open file with mode 0777. Not specifying file type should create
|
||||
// a regualar file.
|
||||
// a regular file.
|
||||
mode_t perms = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||
EXPECT_THAT(mknod(node.c_str(), perms, 0), SyscallSucceeds());
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ TEST(MqTest, ChangeIpcNamespace) {
|
||||
|
||||
// As mq_unlink(2) uses queue's name, it should fail after changing IPC
|
||||
// namespace. To clean the queue, we should unlink it now, this should not
|
||||
// cause a problem, as the queue presists until the last mq_close(2).
|
||||
// cause a problem, as the queue persists until the last mq_close(2).
|
||||
ASSERT_NO_ERRNO(MqUnlink(queue.name()));
|
||||
|
||||
ASSERT_THAT(unshare(CLONE_NEWIPC), SyscallSucceeds());
|
||||
|
||||
@@ -202,7 +202,7 @@ void ReceiveMessage(int sock, int ifindex) {
|
||||
EXPECT_EQ(src.sll_addr[i], 0);
|
||||
}
|
||||
|
||||
// Verify the IP header. We memcpy to deal with pointer aligment.
|
||||
// Verify the IP header. We memcpy to deal with pointer alignment.
|
||||
struct iphdr ip = {};
|
||||
memcpy(&ip, buf, sizeof(ip));
|
||||
EXPECT_EQ(ip.ihl, 5);
|
||||
@@ -212,7 +212,7 @@ void ReceiveMessage(int sock, int ifindex) {
|
||||
EXPECT_EQ(ip.daddr, htonl(INADDR_LOOPBACK));
|
||||
EXPECT_EQ(ip.saddr, htonl(INADDR_LOOPBACK));
|
||||
|
||||
// Verify the UDP header. We memcpy to deal with pointer aligment.
|
||||
// Verify the UDP header. We memcpy to deal with pointer alignment.
|
||||
struct udphdr udp = {};
|
||||
memcpy(&udp, buf + sizeof(iphdr), sizeof(udp));
|
||||
EXPECT_EQ(udp.dest, kPort);
|
||||
@@ -370,7 +370,7 @@ TEST_P(CookedPacketTest, DoubleBindSucceeds) {
|
||||
|
||||
// Bind and verify we do not receive data on interface which is not bound
|
||||
TEST_P(CookedPacketTest, BindDrop) {
|
||||
// TOOD(b/379932042): This is flakey and blocking submissions.
|
||||
// TODO(b/379932042): This is flaky and blocking submissions.
|
||||
GTEST_SKIP();
|
||||
|
||||
// Let's use a simple IP payload: a UDP datagram.
|
||||
@@ -430,7 +430,7 @@ TEST_P(CookedPacketTest, BindDrop) {
|
||||
// Verify that we receive outbound packets. This test requires at least one
|
||||
// non loopback interface so that we can actually capture an outgoing packet.
|
||||
TEST_P(CookedPacketTest, ReceiveOutbound) {
|
||||
// TOOD(b/379932042): This is flakey and blocking submissions.
|
||||
// TODO(b/379932042): This is flaky and blocking submissions.
|
||||
GTEST_SKIP();
|
||||
|
||||
// Only ETH_P_ALL sockets can receive outbound packets on linux.
|
||||
|
||||
@@ -189,7 +189,7 @@ TEST_P(RawPacketTest, Receive) {
|
||||
}
|
||||
EXPECT_EQ(eth.h_proto, htons(ETH_P_IP));
|
||||
|
||||
// Verify the IP header. We memcpy to deal with pointer aligment.
|
||||
// Verify the IP header. We memcpy to deal with pointer alignment.
|
||||
struct iphdr ip = {};
|
||||
memcpy(&ip, buf + sizeof(ethhdr), sizeof(ip));
|
||||
EXPECT_EQ(ip.ihl, 5);
|
||||
@@ -199,7 +199,7 @@ TEST_P(RawPacketTest, Receive) {
|
||||
EXPECT_EQ(ip.daddr, htonl(INADDR_LOOPBACK));
|
||||
EXPECT_EQ(ip.saddr, htonl(INADDR_LOOPBACK));
|
||||
|
||||
// Verify the UDP header. We memcpy to deal with pointer aligment.
|
||||
// Verify the UDP header. We memcpy to deal with pointer alignment.
|
||||
struct udphdr udp = {};
|
||||
memcpy(&udp, buf + sizeof(eth) + sizeof(iphdr), sizeof(udp));
|
||||
EXPECT_EQ(udp.dest, kPort);
|
||||
@@ -317,7 +317,7 @@ TEST_P(RawPacketTest, SendFromLoopback) {
|
||||
}
|
||||
|
||||
TEST_P(RawPacketTest, SendFromUnspec) {
|
||||
// TOOD(b/379932042): This is flakey and blocking submissions.
|
||||
// TODO(b/379932042): This is flaky and blocking submissions.
|
||||
GTEST_SKIP();
|
||||
|
||||
ASSERT_NO_FATAL_FAILURE(ValidateSend(s_, INADDR_ANY, GetLoopbackIndex()));
|
||||
|
||||
@@ -66,7 +66,7 @@ class PartialBadBufferTest : public ::testing::Test {
|
||||
EXPECT_THAT(WriteFd(fd_, &kMessage, size), SyscallSucceedsWithValue(size));
|
||||
ASSERT_THAT(lseek(fd_, 0, SEEK_SET), SyscallSucceeds());
|
||||
|
||||
// Map a useable buffer.
|
||||
// Map a usable buffer.
|
||||
addr_ = mmap(0, 2 * kPageSize, PROT_READ | PROT_WRITE,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
ASSERT_NE(addr_, MAP_FAILED);
|
||||
|
||||
@@ -233,7 +233,7 @@ TEST(PivotRootTest, DotDot) {
|
||||
const auto rest = [&] {
|
||||
TEST_CHECK_SUCCESS(chroot(root.path().c_str()));
|
||||
TEST_CHECK_SUCCESS(chdir(new_root_path.c_str()));
|
||||
// pivot_root should be able to stack put_old ontop of new_root. This allows
|
||||
// pivot_root should be able to stack put_old on top of new_root. This allows
|
||||
// users to pivot_root without creating a temp directory.
|
||||
TEST_CHECK_SUCCESS(syscall(__NR_pivot_root, ".", "."));
|
||||
TEST_CHECK_SUCCESS(umount2(".", MNT_DETACH));
|
||||
|
||||
@@ -268,7 +268,7 @@ TEST_F(PollTest, ImmediatelyReturnOnlyOnPollEvents) {
|
||||
// Wait for read related event on the write side of the pipe, since a write
|
||||
// is possible on fds[1] it would mean that POLLOUT would return immediately.
|
||||
// We should make sure that we're not woken up with that state that we didn't
|
||||
// specificially request.
|
||||
// specifically request.
|
||||
constexpr int kTimeoutMs = 100;
|
||||
struct pollfd poll_fd = {fd1.get(), POLLIN | POLLPRI | POLLRDHUP, 0};
|
||||
EXPECT_THAT(RetryEINTR(poll)(&poll_fd, 1, kTimeoutMs),
|
||||
|
||||
@@ -33,7 +33,7 @@ ABSL_FLAG(bool, prctl_pr_get_keepcaps, false,
|
||||
"If true the test will verify that prctl with pr_get_keepcaps"
|
||||
"returns 0. The test will exit with the result of that check.");
|
||||
|
||||
// These tests exist seperately from prctl because we need to start
|
||||
// These tests exist separately from prctl because we need to start
|
||||
// them as root. Setuid() has the behavior that permissions are fully
|
||||
// removed if one of the UIDs were 0 before a setuid() call. This
|
||||
// behavior can be changed by using PR_SET_KEEPCAPS and that is what
|
||||
|
||||
@@ -224,7 +224,7 @@ PosixError WithSubprocess(SubprocessCallback const& running,
|
||||
|
||||
if (running) {
|
||||
// The first arg, RSD, refers to a "running process", or a process with a
|
||||
// state of Running (R), Interruptable Sleep (S) or Uninterruptable
|
||||
// state of Running (R), Interruptible Sleep (S) or Uninterruptible
|
||||
// Sleep (D).
|
||||
CompareProcessState("RSD", child_pid);
|
||||
RETURN_IF_ERRNO(running(child_pid));
|
||||
@@ -2216,7 +2216,7 @@ TEST(ProcPidFile, SubprocessZombie) {
|
||||
// FIXME(gvisor.dev/issue/164): Loosen requirement due to inconsistent
|
||||
// behavior on different kernels.
|
||||
//
|
||||
// ~4.3: Succeds and returns 0.
|
||||
// ~4.3: Succeeds and returns 0.
|
||||
// 4.17: Succeeds and returns 1.
|
||||
// gVisor: Succeeds and returns 0.
|
||||
EXPECT_THAT(ReadWhileZombied("auxv", buf, sizeof(buf)), SyscallSucceeds());
|
||||
|
||||
@@ -153,7 +153,7 @@ TEST(ProcNetDev, Format) {
|
||||
EXPECT_GT(entries.size(), 0);
|
||||
}
|
||||
|
||||
// GetMibsAllocationSysctl retuns a value of the net.core.mibs_allocation
|
||||
// GetMibsAllocationSysctl returns a value of the net.core.mibs_allocation
|
||||
// sysctl./proc/sys/net/core/mibs_allocation
|
||||
//
|
||||
// When mibs_allocation is unset, a netns creation inherits MIB from init
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2019 Google LLC
|
||||
// Copyright 2019 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.
|
||||
@@ -149,7 +149,7 @@ TEST(ProcNetTCP, Exists) {
|
||||
// Should be just the header since we don't have any tcp sockets yet.
|
||||
EXPECT_EQ(content, header_line);
|
||||
} else {
|
||||
// On a general linux machine, we could have abitrary sockets on the system,
|
||||
// On a general linux machine, we could have arbitrary sockets on the system,
|
||||
// so just check the header.
|
||||
EXPECT_THAT(content, ::testing::StartsWith(header_line));
|
||||
}
|
||||
@@ -385,7 +385,7 @@ TEST(ProcNetTCP6, Exists) {
|
||||
// Should be just the header since we don't have any tcp sockets yet.
|
||||
EXPECT_EQ(content, header_line);
|
||||
} else {
|
||||
// On a general linux machine, we could have abitrary sockets on the system,
|
||||
// On a general linux machine, we could have arbitrary sockets on the system,
|
||||
// so just check the header.
|
||||
EXPECT_THAT(content, ::testing::StartsWith(header_line));
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ TEST(ProcNetUnix, Exists) {
|
||||
const std::string content =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(GetContents("/proc/net/unix"));
|
||||
const std::string header_line = StrCat(kProcNetUnixHeader, "\n");
|
||||
// We could have abitrary sockets on the system, so just check the header.
|
||||
// We could have arbitrary sockets on the system, so just check the header.
|
||||
EXPECT_THAT(content, ::testing::StartsWith(header_line));
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class RawHDRINCL : public ::testing::Test {
|
||||
// Closes the socket created by SetUp().
|
||||
void TearDown() override;
|
||||
|
||||
// Returns a valid looback IP header with no payload.
|
||||
// Returns a valid loopback IP header with no payload.
|
||||
struct iphdr LoopbackHeader();
|
||||
|
||||
// Fills in buf with an IP header, UDP header, and payload. Returns false if
|
||||
|
||||
@@ -145,7 +145,7 @@ TEST_F(RawSocketICMPTest, SendAndReceiveBadChecksum) {
|
||||
icmp.un.echo.id = 2014;
|
||||
ASSERT_NO_FATAL_FAILURE(SendEmptyICMP(icmp));
|
||||
|
||||
// Veryify that we get the echo, then that there's nothing else to read.
|
||||
// Verify that we get the echo, then that there's nothing else to read.
|
||||
char recv_buf[kEmptyICMPSize];
|
||||
struct sockaddr_in src;
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
@@ -296,7 +296,7 @@ TEST_F(RawSocketICMPTest, RawAndPingSockets) {
|
||||
}
|
||||
|
||||
// A raw ICMP socket should be able to send a malformed short ICMP Echo Request,
|
||||
// while a ping socket should not. Neither should be able to receieve a short
|
||||
// while a ping socket should not. Neither should be able to receive a short
|
||||
// malformed packet.
|
||||
TEST_F(RawSocketICMPTest, ShortEchoRawAndPingSockets) {
|
||||
// By default, ping sockets cannot be created on Linux, even with root privs.
|
||||
@@ -343,7 +343,7 @@ TEST_F(RawSocketICMPTest, ShortEchoRawAndPingSockets) {
|
||||
|
||||
// A raw ICMP socket should be able to send a malformed short ICMP Echo Reply,
|
||||
// while ping socket should not.
|
||||
// Neither should be able to receieve a short malformed packet.
|
||||
// Neither should be able to receive a short malformed packet.
|
||||
TEST_F(RawSocketICMPTest, ShortEchoReplyRawAndPingSockets) {
|
||||
// By default, ping sockets cannot be created on Linux, even with root privs.
|
||||
// So we only run the test with gVisor and not hostinet, and even then require
|
||||
|
||||
@@ -960,7 +960,7 @@ TEST(SemaphoreTest, SemInfo) {
|
||||
EXPECT_EQ(info.semume, kSemUme);
|
||||
// There could be semaphores existing in the system during the test, which
|
||||
// prevents the test from getting a exact number, but the test could expect at
|
||||
// least the number of sempahroes it creates in the begining of the test.
|
||||
// least the number of semaphores it creates in the beginning of the test.
|
||||
EXPECT_GE(info.semusz, sem_ids.size());
|
||||
EXPECT_EQ(info.semvmx, kSemVmx);
|
||||
EXPECT_GE(info.semaem, sem_ids.size() * kSemSetSize);
|
||||
|
||||
@@ -182,7 +182,7 @@ TEST_P(SendFileTest, Shutdown) {
|
||||
ASSERT_NO_ERRNO_AND_VALUE(Open(in_file.path(), O_RDONLY));
|
||||
|
||||
// Read some data, then shutdown the socket. We don't actually care about
|
||||
// checking the contents (other tests do that), so we just re-use the same
|
||||
// checking the contents (other tests do that), so we just reuse the same
|
||||
// buffer as above.
|
||||
ScopedThread t([&]() {
|
||||
size_t done = 0;
|
||||
|
||||
@@ -255,7 +255,7 @@ TEST_F(SigProcMaskTest, AliasedSets) {
|
||||
mask = mask2;
|
||||
ASSERT_THAT(raw_sigprocmask(SIG_SETMASK, &mask, &mask), SyscallSucceeds());
|
||||
|
||||
// Check that the exchange succeeeded:
|
||||
// Check that the exchange succeeded:
|
||||
// mask should now contain the previously-set mask blocking only kTestSignal1.
|
||||
EXPECT_THAT(mask, EqualsSigset(mask1));
|
||||
// The current mask should block only kTestSignal2.
|
||||
|
||||
@@ -35,7 +35,7 @@ TEST(SocketTest, UnixConnectNeedsWritePerm) {
|
||||
SyscallSucceeds());
|
||||
ASSERT_THAT(listen(bound.get(), 1), SyscallSucceeds());
|
||||
|
||||
// Drop capabilites that allow us to override permision checks. Otherwise if
|
||||
// Drop capabilities that allow us to override permission checks. Otherwise if
|
||||
// the test is run as root, the connect below will bypass permission checks
|
||||
// and succeed unexpectedly.
|
||||
AutoCapability cap(CAP_DAC_OVERRIDE, false);
|
||||
|
||||
@@ -419,7 +419,7 @@ TEST_P(AllSocketPairTest, SetSocketRecvBufForceAboveMax) {
|
||||
std::unique_ptr<SocketPair> sockets =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
|
||||
|
||||
// Discover maxmimum buffer size by setting to a really large value.
|
||||
// Discover maximum buffer size by setting to a really large value.
|
||||
constexpr int kRcvBufSz = 0xffffffff;
|
||||
ASSERT_THAT(setsockopt(sockets->first_fd(), SOL_SOCKET, SO_RCVBUF, &kRcvBufSz,
|
||||
sizeof(kRcvBufSz)),
|
||||
|
||||
@@ -321,7 +321,7 @@ void tcpSimpleConnectTest(TestAddress const& listener,
|
||||
|
||||
// Accept the connection.
|
||||
//
|
||||
// We have to assign a name to the accepted socket, as unamed temporary
|
||||
// We have to assign a name to the accepted socket, as unnamed temporary
|
||||
// objects are destructed upon full evaluation of the expression it is in,
|
||||
// potentially causing the connecting socket to fail to shutdown properly.
|
||||
auto accepted =
|
||||
@@ -965,7 +965,7 @@ TEST_P(SocketInetLoopbackTest, TCPNonBlockingConnectClose) {
|
||||
.fd = accepted.get(),
|
||||
.events = POLLIN | POLLRDHUP,
|
||||
};
|
||||
// Use a large timeout to accomodate for retransmitted FINs.
|
||||
// Use a large timeout to accommodate for retransmitted FINs.
|
||||
constexpr int kTimeout = 120000;
|
||||
int n = poll(&pfd, 1, kTimeout);
|
||||
ASSERT_GE(n, 0) << strerror(errno);
|
||||
@@ -1046,7 +1046,7 @@ TEST_P(SocketInetLoopbackTest, TCPBacklog) {
|
||||
if (pfd.revents == POLLIN) {
|
||||
// Accept the connection.
|
||||
//
|
||||
// We have to assign a name to the accepted socket, as unamed temporary
|
||||
// We have to assign a name to the accepted socket, as unnamed temporary
|
||||
// objects are destructed upon full evaluation of the expression it is in,
|
||||
// potentially causing the connecting socket to fail to shutdown properly.
|
||||
auto accepted =
|
||||
@@ -1126,7 +1126,7 @@ TEST_P(SocketInetLoopbackTest, TCPBacklogAcceptAll) {
|
||||
ASSERT_EQ(pfd.revents, POLLIN);
|
||||
// Accept the connection.
|
||||
//
|
||||
// We have to assign a name to the accepted socket, as unamed temporary
|
||||
// We have to assign a name to the accepted socket, as unnamed temporary
|
||||
// objects are destructed upon full evaluation of the expression it is in,
|
||||
// potentially causing the connecting socket to fail to shutdown properly.
|
||||
auto accepted =
|
||||
@@ -1222,7 +1222,7 @@ TEST_P(SocketInetLoopbackTest, TCPResetAfterClose) {
|
||||
|
||||
// Trying to read should return zero as the other end did send
|
||||
// us a FIN. We do it twice to verify that the RST does not cause an
|
||||
// ECONNRESET on the read after EOF has been read by applicaiton.
|
||||
// ECONNRESET on the read after EOF has been read by application.
|
||||
EXPECT_THAT(RetryEINTR(recv)(accepted.get(), &data, sizeof(data), 0),
|
||||
SyscallSucceedsWithValue(0));
|
||||
EXPECT_THAT(RetryEINTR(recv)(accepted.get(), &data, sizeof(data), 0),
|
||||
@@ -1315,7 +1315,7 @@ TEST_P(SocketInetLoopbackTest, TCPAcceptAfterReset) {
|
||||
sockaddr_storage conn_addr = connector.addr;
|
||||
ASSERT_NO_ERRNO(SetAddrPort(connector.family(), &conn_addr, port));
|
||||
|
||||
// TODO(b/153489135): Reenable Cooperative S/R once bug is fixed.
|
||||
// TODO(b/153489135): Re-enable Cooperative S/R once bug is fixed.
|
||||
DisableSave ds;
|
||||
ASSERT_THAT(RetryEINTR(connect)(conn_fd.get(), AsSockAddr(&conn_addr),
|
||||
connector.addr_len),
|
||||
|
||||
@@ -218,7 +218,7 @@ TEST_P(IPUnboundSocketTest, InvalidLargeTOS) {
|
||||
}
|
||||
|
||||
TEST_P(IPUnboundSocketTest, CheckSkipECN) {
|
||||
// Test is inconsistant on different kernels.
|
||||
// Test is inconsistent on different kernels.
|
||||
SKIP_IF(!IsRunningOnGvisor() || IsRunningWithHostinet());
|
||||
auto socket = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());
|
||||
int set = 0xFF;
|
||||
|
||||
@@ -2073,7 +2073,7 @@ TEST_P(IPv4UDPUnboundSocketTest, SetSocketRecvBufBelowMin) {
|
||||
TEST_P(IPv4UDPUnboundSocketTest, SetSocketRecvBufAboveMax) {
|
||||
auto s = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());
|
||||
|
||||
// Discover maxmimum buffer size by setting to a really large value.
|
||||
// Discover maximum buffer size by setting to a really large value.
|
||||
constexpr int kRcvBufSz = 0xffffffff;
|
||||
ASSERT_THAT(setsockopt(s->get(), SOL_SOCKET, SO_RCVBUF, &kRcvBufSz,
|
||||
sizeof(kRcvBufSz)),
|
||||
@@ -2103,7 +2103,7 @@ TEST_P(IPv4UDPUnboundSocketTest, SetSocketRecvBuf) {
|
||||
int max = 0;
|
||||
int min = 0;
|
||||
{
|
||||
// Discover maxmimum buffer size by setting to a really large value.
|
||||
// Discover maximum buffer size by setting to a really large value.
|
||||
constexpr int kRcvBufSz = 0xffffffff;
|
||||
ASSERT_THAT(setsockopt(s->get(), SOL_SOCKET, SO_RCVBUF, &kRcvBufSz,
|
||||
sizeof(kRcvBufSz)),
|
||||
@@ -2178,7 +2178,7 @@ TEST_P(IPv4UDPUnboundSocketTest, SetSocketSendBufBelowMin) {
|
||||
TEST_P(IPv4UDPUnboundSocketTest, SetSocketSendBufAboveMax) {
|
||||
auto s = ASSERT_NO_ERRNO_AND_VALUE(NewSocket());
|
||||
|
||||
// Discover maxmimum buffer size by setting to a really large value.
|
||||
// Discover maximum buffer size by setting to a really large value.
|
||||
constexpr int kSndBufSz = 0xffffffff;
|
||||
ASSERT_THAT(setsockopt(s->get(), SOL_SOCKET, SO_SNDBUF, &kSndBufSz,
|
||||
sizeof(kSndBufSz)),
|
||||
@@ -2208,7 +2208,7 @@ TEST_P(IPv4UDPUnboundSocketTest, SetSocketSendBuf) {
|
||||
int max = 0;
|
||||
int min = 0;
|
||||
{
|
||||
// Discover maxmimum buffer size by setting to a really large value.
|
||||
// Discover maximum buffer size by setting to a really large value.
|
||||
constexpr int kSndBufSz = 0xffffffff;
|
||||
ASSERT_THAT(setsockopt(s->get(), SOL_SOCKET, SO_SNDBUF, &kSndBufSz,
|
||||
sizeof(kSndBufSz)),
|
||||
|
||||
@@ -109,7 +109,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
absl::StrFormat("NETLINK_ROUTE (%d)", NETLINK_ROUTE)),
|
||||
std::make_tuple(SO_PASSCRED, IsEqual(0), "0")));
|
||||
|
||||
// Validates the reponses to RTM_GETLINK + NLM_F_DUMP.
|
||||
// Validates the responses to RTM_GETLINK + NLM_F_DUMP.
|
||||
void CheckGetLinkResponse(const struct nlmsghdr* hdr, int seq, int port) {
|
||||
EXPECT_THAT(hdr->nlmsg_type, AnyOf(Eq(RTM_NEWLINK), Eq(NLMSG_DONE)));
|
||||
|
||||
@@ -944,7 +944,7 @@ TEST(NetlinkRouteTest, GetRouteDump) {
|
||||
ASSERT_NO_ERRNO(NetlinkRequestResponse(
|
||||
fd, &req, sizeof(req),
|
||||
[&](const struct nlmsghdr* hdr) {
|
||||
// Validate the reponse to RTM_GETROUTE + NLM_F_DUMP.
|
||||
// Validate the response to RTM_GETROUTE + NLM_F_DUMP.
|
||||
EXPECT_THAT(hdr->nlmsg_type, AnyOf(Eq(RTM_NEWROUTE), Eq(NLMSG_DONE)));
|
||||
|
||||
EXPECT_TRUE((hdr->nlmsg_flags & NLM_F_MULTI) == NLM_F_MULTI)
|
||||
@@ -1042,7 +1042,7 @@ TEST(NetlinkRouteTest, GetRouteRequest) {
|
||||
bool rtDstFound = false;
|
||||
ASSERT_NO_ERRNO(NetlinkRequestResponseSingle(
|
||||
fd, &req, sizeof(req), [&](const struct nlmsghdr* hdr) {
|
||||
// Validate the reponse to RTM_GETROUTE request with RTM_F_LOOKUP_TABLE
|
||||
// Validate the response to RTM_GETROUTE request with RTM_F_LOOKUP_TABLE
|
||||
// flag.
|
||||
EXPECT_THAT(hdr->nlmsg_type, RTM_NEWROUTE);
|
||||
|
||||
@@ -1154,7 +1154,7 @@ TEST_P(NetlinkRouteIpInvariantTest, NewRoute) {
|
||||
ASSERT_NO_ERRNO(NetlinkRequestResponse(
|
||||
fd, &req, sizeof(req),
|
||||
[&](const struct nlmsghdr* hdr) {
|
||||
// Validate the reponse to RTM_GETROUTE + NLM_F_DUMP.
|
||||
// Validate the response to RTM_GETROUTE + NLM_F_DUMP.
|
||||
EXPECT_THAT(hdr->nlmsg_type, AnyOf(Eq(RTM_NEWROUTE), Eq(NLMSG_DONE)));
|
||||
// The test should not proceed if it's not a RTM_NEWROUTE message.
|
||||
if (hdr->nlmsg_type != RTM_NEWROUTE) {
|
||||
@@ -1254,7 +1254,7 @@ TEST_P(NetlinkRouteIpInvariantTest, DeleteRoute) {
|
||||
ASSERT_NO_ERRNO(NetlinkRequestResponse(
|
||||
fd, &req, sizeof(req),
|
||||
[&](const struct nlmsghdr* hdr) {
|
||||
// Validate the reponse to RTM_GETROUTE.
|
||||
// Validate the response to RTM_GETROUTE.
|
||||
EXPECT_THAT(hdr->nlmsg_type, AnyOf(Eq(RTM_NEWROUTE), Eq(NLMSG_DONE)));
|
||||
// The test should not proceed if it's not a RTM_NEWROUTE message.
|
||||
if (hdr->nlmsg_type != RTM_NEWROUTE) {
|
||||
@@ -1292,7 +1292,7 @@ TEST_P(NetlinkRouteIpInvariantTest, DeleteRoute) {
|
||||
false));
|
||||
// No route that matches the given destination address can be found.
|
||||
EXPECT_FALSE(routeDstFound);
|
||||
// Removing a route that doens't exist returns an error.
|
||||
// Removing a route that doesn't exist returns an error.
|
||||
EXPECT_THAT(
|
||||
DelUnicastRoute(loopback_link.index, family, prefixlen, dst, dst_len),
|
||||
PosixErrorIs(ESRCH, _));
|
||||
|
||||
@@ -35,7 +35,7 @@ PosixErrorOr<uint32_t> NetlinkPortID(int fd);
|
||||
|
||||
// Send the passed request and call fn on all response netlink messages.
|
||||
//
|
||||
// To be used on requests with NLM_F_MULTI reponses.
|
||||
// To be used on requests with NLM_F_MULTI responses.
|
||||
PosixError NetlinkRequestResponse(
|
||||
const FileDescriptor& fd, void* request, size_t len,
|
||||
const std::function<void(const struct nlmsghdr* hdr)>& fn,
|
||||
@@ -43,7 +43,7 @@ PosixError NetlinkRequestResponse(
|
||||
|
||||
// Call fn on all response netlink messages.
|
||||
//
|
||||
// To be used on requests with NLM_F_MULTI reponses.
|
||||
// To be used on requests with NLM_F_MULTI responses.
|
||||
PosixError NetlinkResponse(
|
||||
const FileDescriptor& fd,
|
||||
const std::function<void(const struct nlmsghdr* hdr)>& fn,
|
||||
@@ -51,7 +51,7 @@ PosixError NetlinkResponse(
|
||||
|
||||
// Send the passed request and call fn on all response netlink messages.
|
||||
//
|
||||
// To be used on requests without NLM_F_MULTI reponses.
|
||||
// To be used on requests without NLM_F_MULTI responses.
|
||||
PosixError NetlinkRequestResponseSingle(
|
||||
const FileDescriptor& fd, void* request, size_t len,
|
||||
const std::function<void(const struct nlmsghdr* hdr)>& fn);
|
||||
|
||||
@@ -142,7 +142,7 @@ TEST_P(StreamUnixSocketPairTest, SetSocketSendBuf) {
|
||||
int max = 0;
|
||||
int min = 0;
|
||||
{
|
||||
// Discover maxmimum buffer size by setting to a really large value.
|
||||
// Discover maximum buffer size by setting to a really large value.
|
||||
constexpr int kRcvBufSz = INT_MAX;
|
||||
ASSERT_THAT(
|
||||
setsockopt(s, SOL_SOCKET, SO_SNDBUF, &kRcvBufSz, sizeof(kRcvBufSz)),
|
||||
|
||||
@@ -1236,7 +1236,7 @@ PosixErrorOr<FileDescriptor> nonBlockingConnectNoListener(
|
||||
// We will first create a socket and bind to ensure we bind a port but will
|
||||
// not call listen on this socket.
|
||||
// Then we will create a new socket that will connect to the port bound by
|
||||
// the first socket and that shoud fail.
|
||||
// the first socket and that should fail.
|
||||
constexpr int sock_type = SOCK_STREAM | SOCK_NONBLOCK;
|
||||
int b_sock;
|
||||
RETURN_ERROR_IF_SYSCALL_FAIL(b_sock = socket(family, sock_type, IPPROTO_TCP));
|
||||
|
||||
@@ -357,7 +357,7 @@ PosixErrorOr<TunTapInterface> OpenAndAttachTunTap(const std::string& dev_name,
|
||||
// * Assign IP address 10.0.0.1/24 to kernel.
|
||||
// * MAC address: kMacA
|
||||
// * Bring up the interface.
|
||||
// * Send an ICMP echo reqest (ping) packet from 10.0.0.2 (kMacB) to kernel.
|
||||
// * Send an ICMP echo request (ping) packet from 10.0.0.2 (kMacB) to kernel.
|
||||
// * Loop to receive packets from TAP device/fd:
|
||||
// * If packet is an ICMP echo reply, it stops and passes the test.
|
||||
// * If packet is an ARP request, it responds with canned reply and resends
|
||||
|
||||
@@ -274,7 +274,7 @@ TEST(UtimensatTest, OnRelPath) {
|
||||
}
|
||||
|
||||
TEST(UtimensatTest, OmitNoop) {
|
||||
// Setting both timespecs to UTIME_OMIT on a nonexistant path should succeed.
|
||||
// Setting both timespecs to UTIME_OMIT on a nonexistent path should succeed.
|
||||
auto path = NewTempAbsPath();
|
||||
const struct timespec times[2] = {{0, UTIME_OMIT}, {0, UTIME_OMIT}};
|
||||
EXPECT_THAT(utimensat(0, path.c_str(), times, 0), SyscallSucceeds());
|
||||
|
||||
@@ -793,7 +793,7 @@ func checkSyscallClone(msg test.Message) error {
|
||||
if err := checkContextData(p.ContextData); err != nil {
|
||||
return err
|
||||
}
|
||||
// Flags used by default in system calls that use clone(2) in the underying.
|
||||
// Flags used by default in system calls that use clone(2) in the underlying.
|
||||
rawFlags := unix.CLONE_CHILD_CLEARTID | unix.CLONE_CHILD_SETTID | uint64(unix.SIGCHLD)
|
||||
// Flags used for clone(2) syscall in workload.cc
|
||||
cloneFlags := uint64(unix.SIGCHLD) | unix.CLONE_VFORK | unix.CLONE_FILES
|
||||
|
||||
@@ -138,7 +138,7 @@ void runReadWrite() {
|
||||
if (!fd_or.ok()) {
|
||||
err(1, "open(O_CREAT): %s", fd_or.error().ToString().c_str());
|
||||
}
|
||||
auto cleaup = absl::MakeCleanup([path] { unlink(path.c_str()); });
|
||||
auto cleanup = absl::MakeCleanup([path] { unlink(path.c_str()); });
|
||||
|
||||
auto fd = std::move(fd_or.ValueOrDie());
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ class AddrFDSocketPair : public SocketPair {
|
||||
size_t second_addr_len() const override { return second_len_; }
|
||||
|
||||
private:
|
||||
// to_storage coverts a sockaddr_* to a sockaddr_storage.
|
||||
// to_storage converts a sockaddr_* to a sockaddr_storage.
|
||||
static struct sockaddr_storage to_storage(const sockaddr_un& addr);
|
||||
static struct sockaddr_storage to_storage(const sockaddr_in& addr);
|
||||
static struct sockaddr_storage to_storage(const sockaddr_in6& addr);
|
||||
|
||||
@@ -91,7 +91,7 @@ def bpf_program(name, src, bpf_object, visibility, hdrs):
|
||||
|
||||
Args:
|
||||
name: target name for BPF program.
|
||||
src: BPF program souce code in C.
|
||||
src: BPF program source code in C.
|
||||
bpf_object: name of generated bpf object code.
|
||||
visibility: target visibility.
|
||||
hdrs: header files, but currently unsupported.
|
||||
|
||||
@@ -207,7 +207,7 @@ func findPackage(pkg *types.Package, pkgName string) (*types.Package, error) {
|
||||
func matchRegexp(pass *analysis.Pass, pos func() token.Pos, re *regexp.Regexp, text string) ([]string, bool) {
|
||||
m := re.FindStringSubmatch(text)
|
||||
if m == nil && checkconstRegexp.FindString(text) != "" {
|
||||
pass.Reportf(pos(), "potentially misformed checkconst directives")
|
||||
pass.Reportf(pos(), "potentially malformed checkconst directives")
|
||||
}
|
||||
return m, m != nil
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ type foo struct {
|
||||
}
|
||||
```
|
||||
|
||||
These semantics are enforcable on `sync.Mutex`, `sync.RWMutex` and `sync.Locker`
|
||||
These semantics are enforceable on `sync.Mutex`, `sync.RWMutex` and `sync.Locker`
|
||||
fields. Semantics with respect to reading and writing are automatically detected
|
||||
and enforced. If an access is read-only, then the lock need only be held as a
|
||||
read lock, in the case of an `sync.RWMutex`.
|
||||
@@ -142,7 +142,7 @@ func foo(ts *testStruct) {
|
||||
}
|
||||
```
|
||||
|
||||
This pattern often applies to defer usage, which allows defered functions to be
|
||||
This pattern often applies to defer usage, which allows deferred functions to be
|
||||
fully analyzed with the lock state at time of execution.
|
||||
|
||||
However, if a closure is passed to another function, the anonymous function
|
||||
|
||||
@@ -298,7 +298,7 @@ func (pc *passContext) checkGuards(inst almostInst, from ssa.Value, accessObj ty
|
||||
for s, info := range ls.lockedMutexes {
|
||||
// Is this an object for which we have facts? If there
|
||||
// is no ability to name this object, then we don't
|
||||
// bother with any inferrence. We also ignore any self
|
||||
// bother with any inference. We also ignore any self
|
||||
// references (e.g. accessing a mutex while you are
|
||||
// holding that exact mutex).
|
||||
if info.object == nil || accessObj == info.object {
|
||||
|
||||
@@ -247,7 +247,7 @@ type elemType interface {
|
||||
func (l *lockState) valueAndObject(v ssa.Value) (string, types.Object) {
|
||||
switch x := v.(type) {
|
||||
case *ssa.Parameter:
|
||||
// Was this provided as a paramter for a local anonymous
|
||||
// Was this provided as a parameter for a local anonymous
|
||||
// function invocation?
|
||||
v, ok := l.stored[x]
|
||||
if ok {
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// badFieldsStruct verifies that refering invalid fields fails.
|
||||
// badFieldsStruct verifies that referring invalid fields fails.
|
||||
type badFieldsStruct struct {
|
||||
// +checklocks:mu
|
||||
x int // +checklocksfail
|
||||
|
||||
@@ -111,7 +111,7 @@ func main() {
|
||||
|
||||
// The access token may be passed as a file so it doesn't show up in
|
||||
// command line arguments. It also may be provided through the
|
||||
// environment to faciliate use through GitHub's CI system.
|
||||
// environment to facilitate use through GitHub's CI system.
|
||||
token := os.Getenv("GITHUB_TOKEN")
|
||||
if len(tokenFile) != 0 {
|
||||
bytes, err := os.ReadFile(tokenFile)
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ find . -type d -exec chmod 0755 {} \;
|
||||
# Update the current working set and commit.
|
||||
# If the current working commit has already been committed to the remote go
|
||||
# branch, then we have nothing to commit here. So allow empty commit. This can
|
||||
# occur when this script is run parallely (via pull_request and push events)
|
||||
# occur when this script is run parallelly (via pull_request and push events)
|
||||
# and the push workflow finishes before the pull_request workflow can run this.
|
||||
git add --all && git commit --allow-empty -m "Merge ${head} (automated)"
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ go_template_instance = rule(
|
||||
"imports": attr.string_dict(doc = "the map from imports used in types/consts to their import paths"),
|
||||
"input_substrs": attr.string_dict(doc = "the map from sub-strings to their replacements, applied just after reading the template code"),
|
||||
"substrs": attr.string_dict(doc = "the map from sub-strings to their replacements, applied just before writing the template instance code"),
|
||||
"anon": attr.bool(doc = "whether anoymous fields should be processed", mandatory = False, default = False),
|
||||
"anon": attr.bool(doc = "whether anonymous fields should be processed", mandatory = False, default = False),
|
||||
"package": attr.string(doc = "the package for the generated source file", mandatory = False),
|
||||
"out": attr.output(doc = "output file", mandatory = True),
|
||||
"_tool": attr.label(executable = True, cfg = "exec", default = Label("//tools/go_generics")),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user