[lxc-devel] [lxc/lxc] d7aa55: commands_utils: fix socket leak in when adding sta...

Christian Brauner noreply at github.com
Mon Mar 9 20:02:28 UTC 2020


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: d7aa5552448680c8ff7c4af8c19ea5dbd678e946
      https://github.com/lxc/lxc/commit/d7aa5552448680c8ff7c4af8c19ea5dbd678e946
  Author: Matthias Hardt <matthias.hardt at gmail.com>
  Date:   2020-03-09 (Mon, 09 Mar 2020)

  Changed paths:
    M src/lxc/commands_utils.c

  Log Message:
  -----------
  commands_utils: fix socket leak in when adding state client

If lxc_add_state_client() is called with the container already being in
the desired state the client fd will never be closed and is leaking.
This due to setting stay_connected in lxc_cmd for
LXC_CMD_ADD_STATE_CLIENT. If the desired state isn't already achieved
the client fd will later be closed by calling lxc_cmd_fd_cleanup() but
in the other case the client configuration isn't added to the handlers
state clients. So the client fd has to be closed explicitely.

This is simply tested by starting container A and calling lxc-wait -n A
-s RUNNING.

Signed-off-by: Matthias Hardt <matthias.hardt at gmail.com>


  Commit: cd0dc360ce740ba302dacc3dc70c6b20b2a5f794
      https://github.com/lxc/lxc/commit/cd0dc360ce740ba302dacc3dc70c6b20b2a5f794
  Author: Matthias Hardt <matthias.hardt at gmail.com>
  Date:   2020-03-09 (Mon, 09 Mar 2020)

  Changed paths:
    M src/lxc/commands_utils.c
    M src/lxc/compiler.h

  Log Message:
  -----------
  commands_utils: indicate taking ownership of state_client_fd in
lxc_add_state_client()

Signed-off-by: Matthias Hardt <matthias.hardt at gmail.com>


  Commit: ee38ab3fe2ddf7c5b44b60efaf44a81cb1be891c
      https://github.com/lxc/lxc/commit/ee38ab3fe2ddf7c5b44b60efaf44a81cb1be891c
  Author: Matthias Hardt <matthias.hardt at gmail.com>
  Date:   2020-03-09 (Mon, 09 Mar 2020)

  Changed paths:
    M src/lxc/commands_utils.c
    M src/lxc/compiler.h

  Log Message:
  -----------
  Revert "commands_utils: indicate taking ownership of state_client_fd in"

This reverts commit cd0dc360ce740ba302dacc3dc70c6b20b2a5f794.

Signed-off-by: Matthias Hardt <matthias.hardt at gmail.com>


  Commit: 2b3b8f65e3b6dd8cb51d916d60b72da7c2532515
      https://github.com/lxc/lxc/commit/2b3b8f65e3b6dd8cb51d916d60b72da7c2532515
  Author: Matthias Hardt <matthias.hardt at gmail.com>
  Date:   2020-03-09 (Mon, 09 Mar 2020)

  Changed paths:
    M src/lxc/commands_utils.c

  Log Message:
  -----------
  Revert "commands_utils: fix socket leak in when adding state client"

This reverts commit d7aa5552448680c8ff7c4af8c19ea5dbd678e946.

Signed-off-by: Matthias Hardt <matthias.hardt at gmail.com>


  Commit: ebbca852973219065505d5c6d486eb0b6b2ea3b3
      https://github.com/lxc/lxc/commit/ebbca852973219065505d5c6d486eb0b6b2ea3b3
  Author: Matthias Hardt <matthias.hardt at gmail.com>
  Date:   2020-03-09 (Mon, 09 Mar 2020)

  Changed paths:
    M src/lxc/commands.c
    M src/lxc/compiler.h

  Log Message:
  -----------
  commands_utils: fix socket leak when adding state client

If lxc_add_state_client() is called with the container already being in the desired state the client fd will never be closed and is leaking. This is due to setting stay_connected in lxc_cmd for LXC_CMD_ADD_STATE_CLIENT. If the desired state isn't already achieved the client fd will later be closed by calling lxc_cmd_fd_cleanup() but in the other case the client configuration isn't added to the handlers
state clients. So the client fd has to be closed explicitely.

This is simply tested by starting container A and calling lxc-wait -n A -s RUNNING.

Signed-off-by: Matthias Hardt <matthias.hardt at gmail.com>


  Commit: 61e9751f4364235b680dbf2247f352a5a4cb2c31
      https://github.com/lxc/lxc/commit/61e9751f4364235b680dbf2247f352a5a4cb2c31
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2020-03-09 (Mon, 09 Mar 2020)

  Changed paths:
    M src/lxc/commands.c
    M src/lxc/compiler.h

  Log Message:
  -----------
  Merge pull request #3280 from Piscolero/state_client_socket_leak_fix

commands_utils: fix socket leak when adding state client


Compare: https://github.com/lxc/lxc/compare/d31059efa647...61e9751f4364


More information about the lxc-devel mailing list