[Bug 1813003] Re: Invalid free while running docker build

Athos Ribeiro 1813003 at bugs.launchpad.net
Tue Aug 10 22:12:20 UTC 2021


Thanks for the review and upload, Sergio!

** Changed in: golang-github-docker-docker-credential-helpers (Ubuntu Bionic)
       Status: Confirmed => In Progress

-- 
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1813003

Title:
  Invalid free while running docker build

Status in golang-github-docker-docker-credential-helpers package in Ubuntu:
  Confirmed
Status in golang-github-docker-docker-credential-helpers source package in Bionic:
  In Progress

Bug description:
  [Impact]

  The bug results in an error being printed on the user screen when
  running docker builds.

  While the error will not cause the build to fail, the bug does prevent
  users to login on servers with no X11 installed.

  [Test Plan]

  - Install docker.io and golang-docker-credential-helpers
  - Run a simple docker build
  - Verify that the error occurs
  - Install the proposed fix
  - Run a simple docker build
  - Verify the error is no longer present

  - alternatively, try to run "docker login" and provide a correct
  username and password. By the end of the login process, an error will
  occur and the login will not succeed.

  ```
  apt-get update
  apt-get install -y docker.io golang-docker-credential-helpers
  mkdir /tmp/dummy-docker-build
  cd /tmp/dummy-docker-build
  cat <<EOF > Dockerfile
  FROM ubuntu:focal
  LABEL hello=label
  EOF
  docker build -t golang-docker-credential-helpers:test .
  # Verify the error is triggered.
  # update the package and try the build again with
  # docker build -t golang-docker-credential-helpers:test
  # from this directory
  ```

  [Where problems could occur]

  While the patch being applied is a simple, straightforward change,
  performing a rebuild of this package in bionic may pull newer versions
  of build dependencies which may cause unpredictable behavior in a
  stable package.

  [Other Info]

  This fix is already present upstream, in Debian, and in all following
  Ubuntu series.

  [Original message]

  Description of the problem:
  Running docker build generates a warning that an invalid free was performed.

  Steps to reproduce:
  sudo apt-get install docker-compose
  sudo docker build -f Dockerfile.build https://github.com/docker-library/hello-world.git

  Expected results:
  Docker container to be built without errors

  Actual results:
  An error is produced while the container is being built:

  free(): invalid pointer
  SIGABRT: abort
  PC=0x7f7027c42e97 m=0 sigcode=18446744073709551610
  signal arrived during cgo execution

  goroutine 1 [syscall, locked to thread]:
  runtime.cgocall(0x4afd50, 0xc420073cc0, 0xc420073ce8)
   /usr/lib/go-1.8/src/runtime/cgocall.go:131 +0xe2 fp=0xc420073c90 sp=0xc420073c50
  github.com/docker/docker-credential-helpers/secretservice._Cfunc_free(0x12c4da0)
   github.com/docker/docker-credential-helpers/secretservice/_obj/_cgo_gotypes.go:111 +0x41 fp=0xc420073cc0 sp=0xc420073c90
  github.com/docker/docker-credential-helpers/secretservice.Secretservice.List.func5(0x12c4da0)
   /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/secretservice/secretservice_linux.go:96 +0x60 fp=0xc420073cf8 sp=0xc420073cc0
  github.com/docker/docker-credential-helpers/secretservice.Secretservice.List(0x0, 0x756060, 0xc420014370)
   /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/secretservice/secretservice_linux.go:97 +0x217 fp=0xc420073da0 sp=0xc420073cf8
  github.com/docker/docker-credential-helpers/secretservice.(*Secretservice).List(0x77e548, 0xc420073e88, 0x410022, 0xc4200142d0)
   <autogenerated>:4 +0x46 fp=0xc420073de0 sp=0xc420073da0
  github.com/docker/docker-credential-helpers/credentials.List(0x756ba0, 0x77e548, 0x7560e0, 0xc42000e018, 0x0, 0x10)
   /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/credentials/credentials.go:145 +0x3e fp=0xc420073e68 sp=0xc420073de0
  github.com/docker/docker-credential-helpers/credentials.HandleCommand(0x756ba0, 0x77e548, 0x7fff8fa9e879, 0x4, 0x7560a0, 0xc42000e010, 0x7560e0, 0xc42000e018, 0x40e398, 0x4d35c0)
   /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/credentials/credentials.go:60 +0x16d fp=0xc420073ed8 sp=0xc420073e68
  github.com/docker/docker-credential-helpers/credentials.Serve(0x756ba0, 0x77e548)
   /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/obj-x86_64-linux-gnu/src/github.com/docker/docker-credential-helpers/credentials/credentials.go:41 +0x1cb fp=0xc420073f58 sp=0xc420073ed8
  main.main()
   /build/golang-github-docker-docker-credential-helpers-cMhSy1/golang-github-docker-docker-credential-helpers-0.5.0/secretservice/cmd/main_linux.go:9 +0x4f fp=0xc420073f88 sp=0xc420073f58
  runtime.main()
   /usr/lib/go-1.8/src/runtime/proc.go:185 +0x20a fp=0xc420073fe0 sp=0xc420073f88
  runtime.goexit()
   /usr/lib/go-1.8/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc420073fe8 sp=0xc420073fe0

  goroutine 17 [syscall, locked to thread]:
  runtime.goexit()
   /usr/lib/go-1.8/src/runtime/asm_amd64.s:2197 +0x1

  rax    0x0
  rbx    0x7fff8fa9e310
  rcx    0x7f7027c42e97
  rdx    0x0
  rdi    0x2
  rsi    0x7fff8fa9e0a0
  rbp    0x7fff8fa9e410
  rsp    0x7fff8fa9e0a0
  r8     0x0
  r9     0x7fff8fa9e0a0
  r10    0x8
  r11    0x246
  r12    0x7fff8fa9e310
  r13    0x1000
  r14    0x0
  r15    0x30
  rip    0x7f7027c42e97
  rflags 0x246
  cs     0x33
  fs     0x0
  gs     0x0

  How reproducible is the problem?
  Happens every time.

  Version information:
  Ubuntu 18.04.1 LTS
  docker.io 18.06.1-0ubuntu1~18.04.1
  docker-compose 1.17.1-2
  golang-docker-credential-helpers 0.5.0-2

  Additional information:
  It looks like there's a patch which will fix this issue in the docker-credential-helpers project (see the https://github.com/docker/docker-credential-helpers/commit/73e5f5dbfea31ee3b81111ebbf189785fa69731c commit) but it only landed on master on the 19th July 2018 and the last "release" was v0.6.1. The patch looks fairly self contained though so looks like a ready candidate for backporting (and given how widespread this issue is this is the course of action I would recommend).

  There are also a lot of issues elsewhere on the web describing this issue:
  https://github.com/moby/moby/issues/34048 ("Error in `docker-credential-secretservice': free(): invalid pointer: 0x00000000011b3150" which reports that you need to install gnome-keyring)
  https://github.com/docker/for-linux/issues/185 ("Docker-engine on Debian should have `accountsservice` and `gnome-keyring` as dependencies")
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884596 ("Please make golang-docker-credential-helpers depend on gnome-keyring")
  https://github.com/docker/docker-credential-helpers/issues/103 ("strange errors on docker build " where someone says they have both gnome-keyring and accountsservice installed but they still see a problem. https://github.com/docker/docker-credential-helpers/issues/104 and https://github.com/docker/docker-credential-helpers/issues/23 appear to be duplicates).
  https://bugs.launchpad.net/ubuntu/+source/docker-compose/+bug/1792824 ("Please remove golang-docker-credential-helpers dependency from the Ubuntu docker-compose package" got the reply "Please don't ask us (Ubuntu) - go and ask Debian")
  https://github.com/moby/moby/issues/37916 ("Error on build: double free or corruption (out) SIGABRT: abort PC=0x7f7464f01e97 m=0 sigcode=18446744073709551610 signal arrived during cgo execution", seems to be the same as the problem described in https://github.com/docker/docker-credential-helpers/issues/103 ).

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/golang-github-docker-docker-credential-helpers/+bug/1813003/+subscriptions




More information about the Ubuntu-sponsors mailing list