diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 000000000..ae96b9796 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,3 @@ +[codespell] +skip = ./.git,tags,go.mod,go.sum,./test/image/latin10k.txt,./website/assets/images +ignore-words-list = savable,adin diff --git a/Makefile b/Makefile index 9353e4279..23eb079fd 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/WORKSPACE b/WORKSPACE index 4d47d5164..07306d8ac 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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", diff --git a/pkg/sentry/kernel/auth/capability_set_test.go b/pkg/sentry/kernel/auth/capability_set_test.go index 35c3a514f..fbc1ba608 100644 --- a/pkg/sentry/kernel/auth/capability_set_test.go +++ b/pkg/sentry/kernel/auth/capability_set_test.go @@ -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 && diff --git a/pkg/sentry/kernel/kernel_restore.go b/pkg/sentry/kernel/kernel_restore.go index 9b9ad7fd5..d3dc267b6 100644 --- a/pkg/sentry/kernel/kernel_restore.go +++ b/pkg/sentry/kernel/kernel_restore.go @@ -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. diff --git a/pkg/sentry/platform/platform.go b/pkg/sentry/platform/platform.go index 7d58bcdee..e1f1984a9 100644 --- a/pkg/sentry/platform/platform.go +++ b/pkg/sentry/platform/platform.go @@ -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() } diff --git a/pkg/sentry/seccheck/sinks/remote/test/server.go b/pkg/sentry/seccheck/sinks/remote/test/server.go index f54679dfd..fe3d6656c 100644 --- a/pkg/sentry/seccheck/sinks/remote/test/server.go +++ b/pkg/sentry/seccheck/sinks/remote/test/server.go @@ -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() diff --git a/pkg/sentry/socket/netlink/route/protocol.go b/pkg/sentry/socket/netlink/route/protocol.go index 073c95060..8c5104bba 100644 --- a/pkg/sentry/socket/netlink/route/protocol.go +++ b/pkg/sentry/socket/netlink/route/protocol.go @@ -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 { diff --git a/pkg/sentry/socket/netstack/stack.go b/pkg/sentry/socket/netstack/stack.go index fc21771bd..1d69aa3da 100644 --- a/pkg/sentry/socket/netstack/stack.go +++ b/pkg/sentry/socket/netstack/stack.go @@ -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 { diff --git a/pkg/sentry/socket/plugin/stack/notifier.go b/pkg/sentry/socket/plugin/stack/notifier.go index 3d7f55f55..4d3f1781a 100644 --- a/pkg/sentry/socket/plugin/stack/notifier.go +++ b/pkg/sentry/socket/plugin/stack/notifier.go @@ -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() diff --git a/pkg/tcpip/stack/bridge.go b/pkg/tcpip/stack/bridge.go index e3ef36a05..fa7fd56cb 100644 --- a/pkg/tcpip/stack/bridge.go +++ b/pkg/tcpip/stack/bridge.go @@ -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. // diff --git a/pkg/tcpip/stack/registration.go b/pkg/tcpip/stack/registration.go index ee5952f9b..a5938e439 100644 --- a/pkg/tcpip/stack/registration.go +++ b/pkg/tcpip/stack/registration.go @@ -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. diff --git a/runsc/BUILD b/runsc/BUILD index 941fb6f2b..edb28983a 100644 --- a/runsc/BUILD +++ b/runsc/BUILD @@ -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. diff --git a/runsc/boot/portforward/portforward_hostinet.go b/runsc/boot/portforward/portforward_hostinet.go index 40ec37e72..7271b98dc 100644 --- a/runsc/boot/portforward/portforward_hostinet.go +++ b/runsc/boot/portforward/portforward_hostinet.go @@ -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 diff --git a/runsc/boot/portforward/portforward_hostinet_test.go b/runsc/boot/portforward/portforward_hostinet_test.go index 831124523..0d9705705 100644 --- a/runsc/boot/portforward/portforward_hostinet_test.go +++ b/runsc/boot/portforward/portforward_hostinet_test.go @@ -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) diff --git a/runsc/boot/procfs/dump.go b/runsc/boot/procfs/dump.go index 05178b5ca..1c5a6cf10 100644 --- a/runsc/boot/procfs/dump.go +++ b/runsc/boot/procfs/dump.go @@ -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. diff --git a/runsc/boot/vfs.go b/runsc/boot/vfs.go index 67670df99..9cc6f2268 100644 --- a/runsc/boot/vfs.go +++ b/runsc/boot/vfs.go @@ -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 } } diff --git a/runsc/cgroup/systemd_test.go b/runsc/cgroup/systemd_test.go index 308d61435..655b5362e 100644 --- a/runsc/cgroup/systemd_test.go +++ b/runsc/cgroup/systemd_test.go @@ -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, }, diff --git a/runsc/cmd/boot.go b/runsc/cmd/boot.go index 611561425..b18c12baa 100644 --- a/runsc/cmd/boot.go +++ b/runsc/cmd/boot.go @@ -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 { diff --git a/runsc/cmd/debug.go b/runsc/cmd/debug.go index 50d469f67..a23f51bd2 100644 --- a/runsc/cmd/debug.go +++ b/runsc/cmd/debug.go @@ -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 { diff --git a/runsc/cmd/do.go b/runsc/cmd/do.go index 8d639cf48..4d908dcd8 100644 --- a/runsc/cmd/do.go +++ b/runsc/cmd/do.go @@ -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: diff --git a/runsc/cmd/gofer.go b/runsc/cmd/gofer.go index 75194a303..a3f7185c2 100644 --- a/runsc/cmd/gofer.go +++ b/runsc/cmd/gofer.go @@ -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)) } diff --git a/runsc/cmd/install.go b/runsc/cmd/install.go index b7192bf59..365728c7e 100644 --- a/runsc/cmd/install.go +++ b/runsc/cmd/install.go @@ -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 diff --git a/runsc/cmd/mitigate.go b/runsc/cmd/mitigate.go index 88e9605d2..894d8b844 100644 --- a/runsc/cmd/mitigate.go +++ b/runsc/cmd/mitigate.go @@ -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() diff --git a/runsc/cmd/portforward.go b/runsc/cmd/portforward.go index 5aba10985..a414f8f55 100644 --- a/runsc/cmd/portforward.go +++ b/runsc/cmd/portforward.go @@ -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. diff --git a/runsc/cmd/statefile.go b/runsc/cmd/statefile.go index cdff0d840..9b9bd6f6a 100644 --- a/runsc/cmd/statefile.go +++ b/runsc/cmd/statefile.go @@ -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.") diff --git a/runsc/config/config.go b/runsc/config/config.go index 66999a1ad..5291555a6 100644 --- a/runsc/config/config.go +++ b/runsc/config/config.go @@ -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. diff --git a/runsc/container/console_test.go b/runsc/container/console_test.go index 60d0e51fe..0386272d8 100644 --- a/runsc/container/console_test.go +++ b/runsc/container/console_test.go @@ -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) diff --git a/runsc/container/container_test.go b/runsc/container/container_test.go index 9d34a2246..f0825324e 100644 --- a/runsc/container/container_test.go +++ b/runsc/container/container_test.go @@ -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], diff --git a/runsc/container/gofer_to_host_rpc.go b/runsc/container/gofer_to_host_rpc.go index 51023dd0d..9873c3be5 100644 --- a/runsc/container/gofer_to_host_rpc.go +++ b/runsc/container/gofer_to_host_rpc.go @@ -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() diff --git a/runsc/container/multi_container_test.go b/runsc/container/multi_container_test.go index feb3170d5..470a32b86 100644 --- a/runsc/container/multi_container_test.go +++ b/runsc/container/multi_container_test.go @@ -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 { diff --git a/runsc/container/shared_volume_test.go b/runsc/container/shared_volume_test.go index f28a26862..cc1064b8b 100644 --- a/runsc/container/shared_volume_test.go +++ b/runsc/container/shared_volume_test.go @@ -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 { diff --git a/runsc/container/trace_test.go b/runsc/container/trace_test.go index 00379384b..51f65b892 100644 --- a/runsc/container/trace_test.go +++ b/runsc/container/trace_test.go @@ -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 { diff --git a/runsc/mitigate/mitigate.go b/runsc/mitigate/mitigate.go index 00e5bf2a9..d15bcb00b 100644 --- a/runsc/mitigate/mitigate.go +++ b/runsc/mitigate/mitigate.go @@ -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". diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go index 4695003a5..05a58530b 100644 --- a/runsc/sandbox/sandbox.go +++ b/runsc/sandbox/sandbox.go @@ -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) diff --git a/runsc/sandbox/xdp.go b/runsc/sandbox/xdp.go index c6c09410a..6ad1b5ef0 100644 --- a/runsc/sandbox/xdp.go +++ b/runsc/sandbox/xdp.go @@ -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) diff --git a/runsc/specutils/specutils.go b/runsc/specutils/specutils.go index 0dfa18618..ffb37d61a 100644 --- a/runsc/specutils/specutils.go +++ b/runsc/specutils/specutils.go @@ -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 } diff --git a/test/README.md b/test/README.md index a192e41dc..d614c5184 100644 --- a/test/README.md +++ b/test/README.md @@ -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 diff --git a/test/benchmarks/base/size_test.go b/test/benchmarks/base/size_test.go index 186ded0ee..aa8f2ad56 100644 --- a/test/benchmarks/base/size_test.go +++ b/test/benchmarks/base/size_test.go @@ -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. diff --git a/test/benchmarks/database/redis_test.go b/test/benchmarks/database/redis_test.go index f5fa7905f..9aba4c621 100644 --- a/test/benchmarks/database/redis_test.go +++ b/test/benchmarks/database/redis_test.go @@ -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) { diff --git a/test/benchmarks/harness/harness.go b/test/benchmarks/harness/harness.go index a853b7ba8..109e509ab 100644 --- a/test/benchmarks/harness/harness.go +++ b/test/benchmarks/harness/harness.go @@ -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=\n", os.Args[0]) diff --git a/test/benchmarks/network/httpd_test.go b/test/benchmarks/network/httpd_test.go index 54a72542a..3f4fc3549 100644 --- a/test/benchmarks/network/httpd_test.go +++ b/test/benchmarks/network/httpd_test.go @@ -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"} diff --git a/test/benchmarks/network/nginx_test.go b/test/benchmarks/network/nginx_test.go index 801946a79..2d22a9b55 100644 --- a/test/benchmarks/network/nginx_test.go +++ b/test/benchmarks/network/nginx_test.go @@ -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"} diff --git a/test/benchmarks/network/node_test.go b/test/benchmarks/network/node_test.go index 577ea6d19..1d15bfc0c 100644 --- a/test/benchmarks/network/node_test.go +++ b/test/benchmarks/network/node_test.go @@ -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 { diff --git a/test/benchmarks/tcp/tcp_proxy.go b/test/benchmarks/tcp/tcp_proxy.go index 08fc9da91..485254db7 100644 --- a/test/benchmarks/tcp/tcp_proxy.go +++ b/test/benchmarks/tcp/tcp_proxy.go @@ -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 { diff --git a/test/benchmarks/tools/sysbench.go b/test/benchmarks/tools/sysbench.go index 350f8ec98..38ebd0806 100644 --- a/test/benchmarks/tools/sysbench.go +++ b/test/benchmarks/tools/sysbench.go @@ -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 { diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go index c93e02688..6bc9b1126 100644 --- a/test/e2e/exec_test.go +++ b/test/e2e/exec_test.go @@ -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 diff --git a/test/iptables/filter_input.go b/test/iptables/filter_input.go index be99ae145..eb79a205d 100644 --- a/test/iptables/filter_input.go +++ b/test/iptables/filter_input.go @@ -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) } diff --git a/test/iptables/filter_output.go b/test/iptables/filter_output.go index 8c94ce15e..f562f8aca 100644 --- a/test/iptables/filter_output.go +++ b/test/iptables/filter_output.go @@ -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 diff --git a/test/kubernetes/benchmarks/startup.go b/test/kubernetes/benchmarks/startup.go index fcc50a171..abf6630e2 100644 --- a/test/kubernetes/benchmarks/startup.go +++ b/test/kubernetes/benchmarks/startup.go @@ -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 diff --git a/test/kubernetes/test_range_config.proto b/test/kubernetes/test_range_config.proto index 2f6136fa6..37d000008 100644 --- a/test/kubernetes/test_range_config.proto +++ b/test/kubernetes/test_range_config.proto @@ -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. diff --git a/test/kubernetes/tests/hello.go b/test/kubernetes/tests/hello.go index 324ba0e14..b08b27003 100644 --- a/test/kubernetes/tests/hello.go +++ b/test/kubernetes/tests/hello.go @@ -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") } } diff --git a/test/runtimes/runner/lib/lib.go b/test/runtimes/runner/lib/lib.go index ac1641261..5c45f416c 100644 --- a/test/runtimes/runner/lib/lib.go +++ b/test/runtimes/runner/lib/lib.go @@ -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. diff --git a/test/syscalls/README.md b/test/syscalls/README.md index 057872d86..b888ad70e 100644 --- a/test/syscalls/README.md +++ b/test/syscalls/README.md @@ -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 diff --git a/test/syscalls/linux/cgroup.cc b/test/syscalls/linux/cgroup.cc index f17a6cee7..f333f1400 100644 --- a/test/syscalls/linux/cgroup.cc +++ b/test/syscalls/linux/cgroup.cc @@ -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")); diff --git a/test/syscalls/linux/exec_binary.cc b/test/syscalls/linux/exec_binary.cc index b0fb120c6..a14f791b3 100644 --- a/test/syscalls/linux/exec_binary.cc +++ b/test/syscalls/linux/exec_binary.cc @@ -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. diff --git a/test/syscalls/linux/flock.cc b/test/syscalls/linux/flock.cc index 8293ea6f4..b4f4316f2 100644 --- a/test/syscalls/linux/flock.cc +++ b/test/syscalls/linux/flock.cc @@ -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()); } diff --git a/test/syscalls/linux/fork.cc b/test/syscalls/linux/fork.cc index c5abcfb92..77baa8d0c 100644 --- a/test/syscalls/linux/fork.cc +++ b/test/syscalls/linux/fork.cc @@ -102,7 +102,7 @@ class ForkTest : public ::testing::Test { } } - // Exit exits the proccess. + // Exit exits the process. void Exit(int code) { _exit(code); diff --git a/test/syscalls/linux/inotify.cc b/test/syscalls/linux/inotify.cc index 20deb5caf..b0bc0e867 100644 --- a/test/syscalls/linux/inotify.cc +++ b/test/syscalls/linux/inotify.cc @@ -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 diff --git a/test/syscalls/linux/memfd.cc b/test/syscalls/linux/memfd.cc index dbd1c93ae..d08d510e7 100644 --- a/test/syscalls/linux/memfd.cc +++ b/test/syscalls/linux/memfd.cc @@ -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), diff --git a/test/syscalls/linux/mknod.cc b/test/syscalls/linux/mknod.cc index 9b13fd3f1..77e6963d1 100644 --- a/test/syscalls/linux/mknod.cc +++ b/test/syscalls/linux/mknod.cc @@ -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()); diff --git a/test/syscalls/linux/mq.cc b/test/syscalls/linux/mq.cc index 313dcb628..c47a8f2cf 100644 --- a/test/syscalls/linux/mq.cc +++ b/test/syscalls/linux/mq.cc @@ -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()); diff --git a/test/syscalls/linux/packet_socket_dgram.cc b/test/syscalls/linux/packet_socket_dgram.cc index 7ef377349..a6b722e47 100644 --- a/test/syscalls/linux/packet_socket_dgram.cc +++ b/test/syscalls/linux/packet_socket_dgram.cc @@ -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. diff --git a/test/syscalls/linux/packet_socket_raw.cc b/test/syscalls/linux/packet_socket_raw.cc index cd75ba4ff..fe467650b 100644 --- a/test/syscalls/linux/packet_socket_raw.cc +++ b/test/syscalls/linux/packet_socket_raw.cc @@ -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())); diff --git a/test/syscalls/linux/partial_bad_buffer.cc b/test/syscalls/linux/partial_bad_buffer.cc index 8a74afa2e..f305d1b8e 100644 --- a/test/syscalls/linux/partial_bad_buffer.cc +++ b/test/syscalls/linux/partial_bad_buffer.cc @@ -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); diff --git a/test/syscalls/linux/pivot_root.cc b/test/syscalls/linux/pivot_root.cc index c8bfbfeec..c574c7720 100644 --- a/test/syscalls/linux/pivot_root.cc +++ b/test/syscalls/linux/pivot_root.cc @@ -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)); diff --git a/test/syscalls/linux/poll.cc b/test/syscalls/linux/poll.cc index 979da3ff5..6163ab7bc 100644 --- a/test/syscalls/linux/poll.cc +++ b/test/syscalls/linux/poll.cc @@ -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), diff --git a/test/syscalls/linux/prctl_setuid.cc b/test/syscalls/linux/prctl_setuid.cc index c4e9cf528..5f86db17f 100644 --- a/test/syscalls/linux/prctl_setuid.cc +++ b/test/syscalls/linux/prctl_setuid.cc @@ -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 diff --git a/test/syscalls/linux/proc.cc b/test/syscalls/linux/proc.cc index db70712e0..f9d4e1e6f 100644 --- a/test/syscalls/linux/proc.cc +++ b/test/syscalls/linux/proc.cc @@ -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()); diff --git a/test/syscalls/linux/proc_net.cc b/test/syscalls/linux/proc_net.cc index 8e64f832e..11a09b9e3 100644 --- a/test/syscalls/linux/proc_net.cc +++ b/test/syscalls/linux/proc_net.cc @@ -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 diff --git a/test/syscalls/linux/proc_net_tcp.cc b/test/syscalls/linux/proc_net_tcp.cc index 5b6e3e3cd..936a4f48d 100644 --- a/test/syscalls/linux/proc_net_tcp.cc +++ b/test/syscalls/linux/proc_net_tcp.cc @@ -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)); } diff --git a/test/syscalls/linux/proc_net_unix.cc b/test/syscalls/linux/proc_net_unix.cc index f7ff65aad..09ecb67d2 100644 --- a/test/syscalls/linux/proc_net_unix.cc +++ b/test/syscalls/linux/proc_net_unix.cc @@ -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)); } diff --git a/test/syscalls/linux/raw_socket_hdrincl.cc b/test/syscalls/linux/raw_socket_hdrincl.cc index 52b745f0f..90c0e0dc2 100644 --- a/test/syscalls/linux/raw_socket_hdrincl.cc +++ b/test/syscalls/linux/raw_socket_hdrincl.cc @@ -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 diff --git a/test/syscalls/linux/raw_socket_icmp.cc b/test/syscalls/linux/raw_socket_icmp.cc index e02b0c05c..7c4d787db 100644 --- a/test/syscalls/linux/raw_socket_icmp.cc +++ b/test/syscalls/linux/raw_socket_icmp.cc @@ -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 diff --git a/test/syscalls/linux/semaphore.cc b/test/syscalls/linux/semaphore.cc index 4de8b3a12..0cb28492e 100644 --- a/test/syscalls/linux/semaphore.cc +++ b/test/syscalls/linux/semaphore.cc @@ -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); diff --git a/test/syscalls/linux/sendfile_socket.cc b/test/syscalls/linux/sendfile_socket.cc index ac6e89e91..d1d507fdf 100644 --- a/test/syscalls/linux/sendfile_socket.cc +++ b/test/syscalls/linux/sendfile_socket.cc @@ -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; diff --git a/test/syscalls/linux/sigprocmask.cc b/test/syscalls/linux/sigprocmask.cc index a603fc1d1..4233a579e 100644 --- a/test/syscalls/linux/sigprocmask.cc +++ b/test/syscalls/linux/sigprocmask.cc @@ -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. diff --git a/test/syscalls/linux/socket_capability.cc b/test/syscalls/linux/socket_capability.cc index 22f9d5c89..9a12f5dd7 100644 --- a/test/syscalls/linux/socket_capability.cc +++ b/test/syscalls/linux/socket_capability.cc @@ -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); diff --git a/test/syscalls/linux/socket_generic_test_cases.cc b/test/syscalls/linux/socket_generic_test_cases.cc index 5bb0af393..8e2440db9 100644 --- a/test/syscalls/linux/socket_generic_test_cases.cc +++ b/test/syscalls/linux/socket_generic_test_cases.cc @@ -419,7 +419,7 @@ TEST_P(AllSocketPairTest, SetSocketRecvBufForceAboveMax) { std::unique_ptr 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)), diff --git a/test/syscalls/linux/socket_inet_loopback.cc b/test/syscalls/linux/socket_inet_loopback.cc index e2c3ae624..12ecedc66 100644 --- a/test/syscalls/linux/socket_inet_loopback.cc +++ b/test/syscalls/linux/socket_inet_loopback.cc @@ -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), diff --git a/test/syscalls/linux/socket_ip_unbound.cc b/test/syscalls/linux/socket_ip_unbound.cc index ca173b250..0f756e1b1 100644 --- a/test/syscalls/linux/socket_ip_unbound.cc +++ b/test/syscalls/linux/socket_ip_unbound.cc @@ -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; diff --git a/test/syscalls/linux/socket_ipv4_udp_unbound.cc b/test/syscalls/linux/socket_ipv4_udp_unbound.cc index ca45579ad..266caa8f6 100644 --- a/test/syscalls/linux/socket_ipv4_udp_unbound.cc +++ b/test/syscalls/linux/socket_ipv4_udp_unbound.cc @@ -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)), diff --git a/test/syscalls/linux/socket_netlink_route.cc b/test/syscalls/linux/socket_netlink_route.cc index 01a069da1..1e01110e2 100644 --- a/test/syscalls/linux/socket_netlink_route.cc +++ b/test/syscalls/linux/socket_netlink_route.cc @@ -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, _)); diff --git a/test/syscalls/linux/socket_netlink_util.h b/test/syscalls/linux/socket_netlink_util.h index f97276d44..42d7e0240 100644 --- a/test/syscalls/linux/socket_netlink_util.h +++ b/test/syscalls/linux/socket_netlink_util.h @@ -35,7 +35,7 @@ PosixErrorOr 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& 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& 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& fn); diff --git a/test/syscalls/linux/socket_unix_stream.cc b/test/syscalls/linux/socket_unix_stream.cc index 7cf68bf6f..06d299118 100644 --- a/test/syscalls/linux/socket_unix_stream.cc +++ b/test/syscalls/linux/socket_unix_stream.cc @@ -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)), diff --git a/test/syscalls/linux/tcp_socket.cc b/test/syscalls/linux/tcp_socket.cc index 0590aaa70..4f614732e 100644 --- a/test/syscalls/linux/tcp_socket.cc +++ b/test/syscalls/linux/tcp_socket.cc @@ -1236,7 +1236,7 @@ PosixErrorOr 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)); diff --git a/test/syscalls/linux/tuntap.cc b/test/syscalls/linux/tuntap.cc index 3ab8aa581..3214ef86d 100644 --- a/test/syscalls/linux/tuntap.cc +++ b/test/syscalls/linux/tuntap.cc @@ -357,7 +357,7 @@ PosixErrorOr 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 diff --git a/test/syscalls/linux/utimes.cc b/test/syscalls/linux/utimes.cc index da5f9119b..d38398c28 100644 --- a/test/syscalls/linux/utimes.cc +++ b/test/syscalls/linux/utimes.cc @@ -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()); diff --git a/test/trace/trace_test.go b/test/trace/trace_test.go index 5a7f4494c..0a050aab7 100644 --- a/test/trace/trace_test.go +++ b/test/trace/trace_test.go @@ -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 diff --git a/test/trace/workload/workload.cc b/test/trace/workload/workload.cc index 0c5c49a27..2c8370aa3 100644 --- a/test/trace/workload/workload.cc +++ b/test/trace/workload/workload.cc @@ -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()); diff --git a/test/util/socket_util.h b/test/util/socket_util.h index fcf167097..58c58d085 100644 --- a/test/util/socket_util.h +++ b/test/util/socket_util.h @@ -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); diff --git a/tools/bazeldefs/defs.bzl b/tools/bazeldefs/defs.bzl index 2ca4f36a6..9269181e8 100644 --- a/tools/bazeldefs/defs.bzl +++ b/tools/bazeldefs/defs.bzl @@ -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. diff --git a/tools/checkconst/checkconst.go b/tools/checkconst/checkconst.go index eaa06fd59..37adb353e 100644 --- a/tools/checkconst/checkconst.go +++ b/tools/checkconst/checkconst.go @@ -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 } diff --git a/tools/checklocks/README.md b/tools/checklocks/README.md index ad2f0bbb1..ebbdd0bf0 100644 --- a/tools/checklocks/README.md +++ b/tools/checklocks/README.md @@ -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 diff --git a/tools/checklocks/analysis.go b/tools/checklocks/analysis.go index 09ed43946..e342ac8c6 100644 --- a/tools/checklocks/analysis.go +++ b/tools/checklocks/analysis.go @@ -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 { diff --git a/tools/checklocks/state.go b/tools/checklocks/state.go index c342342aa..f2c23b746 100644 --- a/tools/checklocks/state.go +++ b/tools/checklocks/state.go @@ -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 { diff --git a/tools/checklocks/test/incompat.go b/tools/checklocks/test/incompat.go index f55fa532d..c89792bf1 100644 --- a/tools/checklocks/test/incompat.go +++ b/tools/checklocks/test/incompat.go @@ -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 diff --git a/tools/github/main.go b/tools/github/main.go index b18815972..b455e4d2b 100644 --- a/tools/github/main.go +++ b/tools/github/main.go @@ -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) diff --git a/tools/go_branch.sh b/tools/go_branch.sh index 8a82ed0b0..fd8db89ec 100755 --- a/tools/go_branch.sh +++ b/tools/go_branch.sh @@ -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)" diff --git a/tools/go_generics/defs.bzl b/tools/go_generics/defs.bzl index 0318d8ac5..c49489a59 100644 --- a/tools/go_generics/defs.bzl +++ b/tools/go_generics/defs.bzl @@ -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")), diff --git a/tools/go_generics/go_merge/main.go b/tools/go_generics/go_merge/main.go index 2e46a3d3b..b80678627 100644 --- a/tools/go_generics/go_merge/main.go +++ b/tools/go_generics/go_merge/main.go @@ -139,7 +139,7 @@ func main() { // Write the output file. var buf bytes.Buffer if err := format.Node(&buf, fset, f); err != nil { - fatalf("fomatting: %v\n", err) + fatalf("formatting: %v\n", err) } outf, err := os.OpenFile(*output, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644) if err != nil { diff --git a/tools/go_marshal/README.md b/tools/go_marshal/README.md index bbd4c9f48..5fb18fd97 100644 --- a/tools/go_marshal/README.md +++ b/tools/go_marshal/README.md @@ -10,7 +10,7 @@ marshalling go data structures to and from memory. compile-time. `go_marshal` automatically generates implementations for `marshal.Marshallable` -interface. Data structures that require custom serialization can be accomodated +interface. Data structures that require custom serialization can be accommodated through a manual implementation this interface. Data structures can be flagged for code generation by adding a struct-level @@ -91,7 +91,7 @@ padding between short fields. However, if a field is tagged `marshal:"unaligned"`, `go_marshal` will fall back to a safer but slower mechanism to deal with potentially unaligned fields. -Note that the non-packed property is inheritted by any other struct that embeds +Note that the non-packed property is inherited by any other struct that embeds this struct, since the `go_marshal` tool currently can't reason about alignments for embedded structs that are not aligned. diff --git a/tools/go_marshal/analysis/analysis_unsafe.go b/tools/go_marshal/analysis/analysis_unsafe.go index f939082b9..81655f235 100644 --- a/tools/go_marshal/analysis/analysis_unsafe.go +++ b/tools/go_marshal/analysis/analysis_unsafe.go @@ -33,7 +33,7 @@ import ( "gvisor.dev/gvisor/pkg/rand" ) -// RandomizeValue assigns random value(s) to an abitrary type. This is intended +// RandomizeValue assigns random value(s) to an arbitrary type. This is intended // for used with ABI structs from go_marshal, meaning the typical restrictions // apply (fixed-size types, no pointers, maps, channels, etc), and should only // be used on zeroed values to avoid overwriting pointers to active go objects. @@ -164,7 +164,7 @@ func AlignmentCheck(t *testing.T, typ reflect.Type) (ok bool, delta uint64) { // Final field explicitly marked unaligned. break } - t.Fatalf("Suspect offset for field %s.%s at the end of %s, detected an implicit %d byte padding from offset %d to %d at the end of the struct; either add %d bytes of explict padding at end of the struct or tag the final field %s as `marshal:\"unaligned\"`.", + t.Fatalf("Suspect offset for field %s.%s at the end of %s, detected an implicit %d byte padding from offset %d to %d at the end of the struct; either add %d bytes of explicit padding at end of the struct or tag the final field %s as `marshal:\"unaligned\"`.", typ.Name(), f.Name, typ.Name(), implicitPad, nextXOff, typ.Size(), implicitPad, f.Name) } case reflect.Array: diff --git a/tools/go_marshal/defs.bzl b/tools/go_marshal/defs.bzl index c9088f826..a8f33f322 100644 --- a/tools/go_marshal/defs.bzl +++ b/tools/go_marshal/defs.bzl @@ -54,7 +54,7 @@ go_marshal = rule( }, ) -# marshal_deps are the dependencies requied by generated code. +# marshal_deps are the dependencies required by generated code. marshal_deps = [ "//pkg/gohacks", "//pkg/hostarch", diff --git a/tools/go_marshal/gomarshal/generator.go b/tools/go_marshal/gomarshal/generator.go index e290de030..f71e92cf1 100644 --- a/tools/go_marshal/gomarshal/generator.go +++ b/tools/go_marshal/gomarshal/generator.go @@ -35,7 +35,7 @@ import ( // This only applies to import aliases at the moment. All other identifiers // are qualified by a receiver argument, since they're struct fields. // -// All recievers are single letters, so we don't allow import aliases to be a +// All receivers are single letters, so we don't allow import aliases to be a // single letter. var badIdents = []string{ "addr", "blk", "buf", "cc", "dst", "dsts", "count", "err", "hdr", "idx", @@ -43,7 +43,7 @@ var badIdents = []string{ // All single-letter identifiers. } -// Constructed fromt badIdents in init(). +// Constructed from badIdents in init(). var badIdentsMap map[string]struct{} func init() { @@ -277,7 +277,7 @@ func newMarshallableType(fset *token.FileSet, tagLine *ast.Comment, spec *ast.Ty // collectMarshallableTypes walks the parsed AST and collects a list of type // declarations for which we need to generate the Marshallable interface. func (g *Generator) collectMarshallableTypes(a *ast.File, f *token.FileSet) map[*ast.TypeSpec]*marshallableType { - recv := make(map[string]string) // Type name to recevier name. + recv := make(map[string]string) // Type name to receiver name. types := make(map[*ast.TypeSpec]*marshallableType) for _, decl := range a.Decls { gdecl, ok := decl.(*ast.GenDecl) diff --git a/tools/go_marshal/gomarshal/generator_interfaces.go b/tools/go_marshal/gomarshal/generator_interfaces.go index 9917f41b0..410fa4172 100644 --- a/tools/go_marshal/gomarshal/generator_interfaces.go +++ b/tools/go_marshal/gomarshal/generator_interfaces.go @@ -188,7 +188,7 @@ func (g *interfaceGenerator) emitCastToByteSlice(srcPtr, dstVar, lenExpr string) g.emit("hdr.Cap = %s\n\n", lenExpr) } -// emitCastToByteSlice unsafely casts a slice with elements of an abitrary type +// emitCastToByteSlice unsafely casts a slice with elements of an arbitrary type // to a byte slice. As part of the cast, the byte slice is made to look // independent of the src slice by bypassing escape analysis. This means the // byte slice can be used without causing the source to escape. The caller is diff --git a/tools/go_marshal/gomarshal/generator_interfaces_primitive_newtype.go b/tools/go_marshal/gomarshal/generator_interfaces_primitive_newtype.go index 8cc52a99a..f05fa81b7 100644 --- a/tools/go_marshal/gomarshal/generator_interfaces_primitive_newtype.go +++ b/tools/go_marshal/gomarshal/generator_interfaces_primitive_newtype.go @@ -38,7 +38,7 @@ func (g *interfaceGenerator) marshalPrimitiveScalar(accessor, typ, bufVar string g.recordUsedImport("hostarch") g.emit("hostarch.ByteOrder.PutUint64(%s[:8], uint64(*%s))\n", bufVar, accessor) default: - g.emit("// Explicilty cast to the underlying type before dispatching to\n") + g.emit("// Explicitly cast to the underlying type before dispatching to\n") g.emit("// MarshalBytes, so we don't recursively call %s.MarshalBytes\n", accessor) g.emit("inner := (*%s)(%s)\n", typ, accessor) g.emit("inner.MarshalBytes(%s[:%s.SizeBytes()])\n", bufVar, accessor) @@ -62,7 +62,7 @@ func (g *interfaceGenerator) unmarshalPrimitiveScalar(accessor, typ, bufVar, typ g.recordUsedImport("hostarch") g.emit("*%s = %s(%s(hostarch.ByteOrder.Uint64(%s[:8])))\n", accessor, typeCast, typ, bufVar) default: - g.emit("// Explicilty cast to the underlying type before dispatching to\n") + g.emit("// Explicitly cast to the underlying type before dispatching to\n") g.emit("// UnmarshalBytes, so we don't recursively call %s.UnmarshalBytes\n", accessor) g.emit("inner := (*%s)(%s)\n", typ, accessor) g.emit("inner.UnmarshalBytes(%s[:%s.SizeBytes()])\n", bufVar, accessor) diff --git a/tools/go_marshal/gomarshal/generator_interfaces_struct.go b/tools/go_marshal/gomarshal/generator_interfaces_struct.go index 69dbebaaa..8619ca919 100644 --- a/tools/go_marshal/gomarshal/generator_interfaces_struct.go +++ b/tools/go_marshal/gomarshal/generator_interfaces_struct.go @@ -41,7 +41,7 @@ func (g *interfaceGenerator) areFieldsPackedExpression() (string, bool) { for accessor := range g.as { cs = append(cs, fmt.Sprintf("%s.Packed()", accessor)) } - // Sort expressions for determinstic build outputs. + // Sort expressions for deterministic build outputs. sort.Strings(cs) return strings.Join(cs, " && "), true } @@ -229,7 +229,7 @@ func (g *interfaceGenerator) emitMarshallableForStruct(st *ast.StructType) { g.emit("src = src[%d*(%s):]\n", size, lenExpr) } else { // We can't use shiftDynamic here because we don't have - // an instance of the dynamic type we can referece here + // an instance of the dynamic type we can reference here // (since the version in this struct is anonymous). Use // a typed nil pointer to call SizeBytes() instead. g.emit("src = src[(*%s)(nil).SizeBytes()*(%s):]\n", t.Name, lenExpr) diff --git a/tools/go_marshal/gomarshal/util.go b/tools/go_marshal/gomarshal/util.go index fb33be404..95c1af215 100644 --- a/tools/go_marshal/gomarshal/util.go +++ b/tools/go_marshal/gomarshal/util.go @@ -219,7 +219,7 @@ func emit(out io.Writer, indent int, a ...any) { // sourceBuffer represents fragments of generated go source code. // -// sourceBuffer provides a convenient way to build up go souce fragments in +// sourceBuffer provides a convenient way to build up go source fragments in // memory. May be safely zero-value initialized. Not thread-safe. type sourceBuffer struct { // Current indentation level. diff --git a/tools/go_marshal/test/marshal_test.go b/tools/go_marshal/test/marshal_test.go index 571b3184a..67adcb6ef 100644 --- a/tools/go_marshal/test/marshal_test.go +++ b/tools/go_marshal/test/marshal_test.go @@ -77,7 +77,7 @@ func (t *mockCopyContext) CopyOutBytes(_ hostarch.Addr, b []byte) (int, error) { } // CopyInBytes implements marshal.CopyContext.CopyInBytes. The implementation -// completely ignores the source address and always fills b from the begining of +// completely ignores the source address and always fills b from the beginning of // its internal buffer. func (t *mockCopyContext) CopyInBytes(_ hostarch.Addr, b []byte) (int, error) { return t.taskMem.CopyIn(nil, 0, b, usermem.IOOpts{}) @@ -158,7 +158,7 @@ func isZeroes(buf []byte) bool { return true } -// compareMemory compares the first n bytes of two chuncks of memory represented +// compareMemory compares the first n bytes of two chunks of memory represented // by expected and actual. func compareMemory(t *testing.T, expected, actual []byte, n int) { t.Logf("Expected (%d): %v (%d) + (%d) %v\n", len(expected), expected[:n], n, len(expected)-n, expected[n:]) @@ -273,7 +273,7 @@ func copyOutN(t *testing.T, src marshal.Marshallable, limit int) { } // TestLimitedMarshalling verifies marshalling/unmarshalling succeeds when the -// underyling copy in/out operations partially succeed. +// underlying copy in/out operations partially succeed. func TestLimitedMarshalling(t *testing.T) { types := []reflect.Type{ // Packed types. @@ -334,7 +334,7 @@ func TestLimitedMarshalling(t *testing.T) { } // TestLimitedMarshalling verifies marshalling/unmarshalling of slices of -// marshallable types succeed when the underyling copy in/out operations +// marshallable types succeed when the underlying copy in/out operations // partially succeed. func TestLimitedSliceMarshalling(t *testing.T) { types := []struct { @@ -559,7 +559,7 @@ func TestDynamicTypeStruct(t *testing.T) { cc.setLimit(t12.SizeBytes()) if _, err := t12.CopyOut(&cc, hostarch.Addr(0)); err != nil { - t.Fatalf("cc.CopyOut faile: %v", err) + t.Fatalf("cc.CopyOut failed: %v", err) } res := test.Type12Dynamic{ @@ -577,7 +577,7 @@ func TestDynamicTypeIdentifier(t *testing.T) { cc.setLimit(s.SizeBytes()) if _, err := s.CopyOut(&cc, hostarch.Addr(0)); err != nil { - t.Fatalf("cc.CopyOut faile: %v", err) + t.Fatalf("cc.CopyOut failed: %v", err) } res := test.Type13Dynamic(make([]byte, len(s))) diff --git a/tools/gvisor2pcap/main.go b/tools/gvisor2pcap/main.go index a79965f3d..b0f492509 100644 --- a/tools/gvisor2pcap/main.go +++ b/tools/gvisor2pcap/main.go @@ -83,7 +83,7 @@ func run() error { if err != nil { return fmt.Errorf("failed to create sniffer: %w", err) } - // Supress text output. + // Suppress text output. sniffer.LogPackets.Store(0) scanner := bufio.NewScanner(input) diff --git a/tools/images.mk b/tools/images.mk index 4b51a2870..c9ca263e4 100644 --- a/tools/images.mk +++ b/tools/images.mk @@ -23,12 +23,12 @@ ## targets. ## ## (*) Note that you may provide an ARCH parameter in order to build -## and load images from an alternate archiecture (using qemu). When +## and load images from an alternate architecture (using qemu). When ## bazel is run as a server, this has the effect of running an full ## cross-architecture chain, and can produce cross-compiled binaries. ## -# ARCH is the architecture used for the build. This may be overriden at the +# ARCH is the architecture used for the build. This may be overridden at the # command line in order to perform a cross-build (in a limited capacity). ARCH := $(shell uname -m) ifneq ($(ARCH),$(shell uname -m)) diff --git a/tools/nogo/check/check.go b/tools/nogo/check/check.go index b00182f47..0d73f0cd5 100644 --- a/tools/nogo/check/check.go +++ b/tools/nogo/check/check.go @@ -338,7 +338,7 @@ func (i *errorImporter) Import(path string) (*types.Package, error) { // checkPackage is the backing implementation for CheckPackage and others. // -// The implementation was adapted from [1], which was in turn adpated from [2]. +// The implementation was adapted from [1], which was in turn adapted from [2]. // This returns a list of matching analysis issues, or an error if the analysis // could not be completed. // diff --git a/tools/nogo/cli/cli.go b/tools/nogo/cli/cli.go index 7f57e4f1f..d58a499bc 100644 --- a/tools/nogo/cli/cli.go +++ b/tools/nogo/cli/cli.go @@ -277,7 +277,7 @@ func (*Stdlib) Usage() string { return `stdlib Generates facts and findings for the standard library. This wraps - bundle with a mechansim that discovers the standard library source. + bundle with a mechanism that discovers the standard library source. ` } @@ -401,7 +401,7 @@ func loadConfigs(filenames []string) (*config.Config, error) { // Execute implements subcommands.Command.Execute. func (f *Filter) Execute(ctx context.Context, fs *flag.FlagSet, args ...any) subcommands.ExitStatus { - // Open and merge all configuations. + // Open and merge all configurations. config, err := loadConfigs(f.Configs) if err != nil { return failure("unable to load configurations: %v", err) diff --git a/tools/nogo/config/config.go b/tools/nogo/config/config.go index aab702741..6e76e2388 100644 --- a/tools/nogo/config/config.go +++ b/tools/nogo/config/config.go @@ -223,7 +223,7 @@ func (c *Config) Merge(other *Config) { // Merge all groups. // // Select the other first, as the order provided in the second will - // provide precendence over the same group defined in the first one. + // provide precedence over the same group defined in the first one. seenGroups := make(map[GroupName]struct{}) newGroups := make([]Group, 0, len(c.Groups)+len(other.Groups)) for _, g := range other.Groups { @@ -252,7 +252,7 @@ func (c *Config) Merge(other *Config) { } } -// Compile compiles a configuration to make it useable. +// Compile compiles a configuration to make it usable. func (c *Config) Compile() error { for i := 0; i < len(c.Groups); i++ { if err := c.Groups[i].compile(); err != nil { diff --git a/tools/stucktasks/stucktasks.go b/tools/stucktasks/stucktasks.go index fb155b08a..1f5582403 100644 --- a/tools/stucktasks/stucktasks.go +++ b/tools/stucktasks/stucktasks.go @@ -90,7 +90,7 @@ func analyze(in io.Reader, out io.Writer) error { } func analyzeStuckTasks(scanner *bufio.Scanner, out io.Writer) error { - // Look for stuck tasks goroutine. The output has the folowing format: + // Look for stuck tasks goroutine. The output has the following format: // Task tid: 123 (goroutine 45), entered RunSys state 3m28.77s ago. ids := make(map[uint]struct{}) for scanner.Scan() {