docker / cli

The Docker CLI
Apache License 2.0
4.89k stars 1.92k forks source link

Segfault when attempting to display help for docker login command #2977

Open testworksau opened 3 years ago

testworksau commented 3 years ago

Description

Segfault occurs if attempting to use the wrong command to display help for docker login

Steps to reproduce the issue:

  1. Type docker login /?

Describe the results you received:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0xa4ddce]

goroutine 1 [running]:
github.com/docker/cli/cli/command.ConfigureAuth(0x2168e40, 0xc00039c1a0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20cf300, 0xc000303e90, 0xc0003f3968)
        /go/src/github.com/docker/cli/cli/command/registry.go:128 +0x8e
github.com/docker/cli/cli/command/registry.runLogin(0x2168e40, 0xc00039c1a0, 0xc0000540b8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /go/src/github.com/docker/cli/cli/command/registry/login.go:123 +0x228
github.com/docker/cli/cli/command/registry.NewLoginCommand.func1(0xc000254840, 0xc000302c00, 0x1, 0x1, 0x0, 0x0)
        /go/src/github.com/docker/cli/cli/command/registry/login.go:45 +0xd1
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc000254840, 0xc0001ed810, 0x1, 0x1, 0xc000254840, 0xc0001ed810)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:850 +0x467
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc0001ba2c0, 0xc0001ed800, 0x2, 0x2)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:958 +0x350
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:895
main.runDocker(0xc00039c1a0, 0x20d2060, 0xc000006020)
        /go/src/github.com/docker/cli/cmd/docker/docker.go:287 +0x1d8
main.main()
        /go/src/github.com/docker/cli/cmd/docker/docker.go:298 +0xf8

Describe the results you expected: A message telling me the command I entered is invalid.

Additional information you deem important (e.g. issue happens only occasionally): N/A

Output of docker version:

Client: Docker Engine - Community
 Cloud integration: 1.0.7
 Version:           20.10.2
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        2291f61
 Built:             Mon Dec 28 16:14:16 2020
 OS/Arch:           windows/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.2
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8891c58
  Built:            Mon Dec 28 16:15:28 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.3
  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc:
  Version:          1.0.0-rc92
  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  scan: Docker Scan (Docker Inc., v0.5.0)

Server:
 Containers: 49
  Running: 34
  Paused: 0
  Stopped: 15
 Images: 11
 Server Version: 20.10.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.128-microsoft-standard
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 24.94GiB
 Name: docker-desktop
 ID: MYBC:A6OR:CDKE:YL52:5KIP:K63D:RCID:6PTB:JIA7:7EPF:O5HF:U6S7
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 10.213.1.0/16, Size: 24

WARNING: No blkio weight support
WARNING: No blkio weight_device support
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Additional environment details (AWS, VirtualBox, physical, etc.): Physical machine running on Windows 10 20H2

daweim0 commented 3 years ago

Adding to this, sudo docker login segfaults

david@WIN-*************:~/Docker-Provider-log-scale/kubernetes/linux/dockerbuild$ sudo docker login
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x55eb449b1406]

goroutine 1 [running]:
github.com/docker/cli/cli/command.ConfigureAuth(0x**********, 0x**********, 0x0, 0x0, 0x0, 0x0, 0x0, 0x**********, 0x**********, 0x**********)
        /go/src/github.com/docker/cli/cli/command/registry.go:128 +0x46
github.com/docker/cli/cli/command/registry.runLogin(0x**********, 0x**********, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /go/src/github.com/docker/cli/cli/command/registry/login.go:123 +0x223
github.com/docker/cli/cli/command/registry.NewLoginCommand.func1(0x**********, 0x**********, 0x0, 0x0, 0x0, 0x0)
        /go/src/github.com/docker/cli/cli/command/registry/login.go:45 +0xcc
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0x**********, 0x**********, 0x0, 0x0, 0x**********, 0x**********)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:850 +0x462
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x**********, 0x**********, 0x1, 0x1)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:958 +0x34b
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:895
main.runDocker(0x**********, 0x**********, 0x**********)
        /go/src/github.com/docker/cli/cmd/docker/docker.go:287 +0x1d3
main.main()
        /go/src/github.com/docker/cli/cmd/docker/docker.go:298 +0xf3

(hex values cencored in case they contain login information) ran on WSL 2 Ubuntu 18.04

belohnung commented 3 years ago

[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x560bdefc9406]

goroutine 1 [running]:
github.com/docker/cli/cli/command.ConfigureAuth(0x560be0a0bfe0, 0xc0005125b0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x560be097b401, 0xc0002e3630, 0xc0005af968)
        /go/src/github.com/docker/cli/cli/command/registry.go:128 +0x46
github.com/docker/cli/cli/command/registry.runLogin(0x560be0a0bfe0, 0xc0005125b0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /go/src/github.com/docker/cli/cli/command/registry/login.go:123 +0x223
github.com/docker/cli/cli/command/registry.NewLoginCommand.func1(0xc0002bcb00, 0x560be1a165c8, 0x0, 0x0, 0x0, 0x0)
        /go/src/github.com/docker/cli/cli/command/registry/login.go:45 +0xcc
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc0002bcb00, 0xc0002e2990, 0x0, 0x0, 0xc0002bcb00, 0xc0002e2990)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:850 +0x462
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc0004002c0, 0xc0002e2990, 0x1, 0x1)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:958 +0x34b
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:895
main.runDocker(0xc0005125b0, 0x560be097e120, 0xc000010020)
        /go/src/github.com/docker/cli/cmd/docker/docker.go:287 +0x1d3
main.main()
        /go/src/github.com/docker/cli/cmd/docker/docker.go:298 +0xf3```