Commit Graph

9454 Commits

Author SHA1 Message Date
Stéphane Graber
823486c199
Merge pull request #3287 from brauner/2020-03-11/fixes
fixes
2020-03-10 22:23:35 -04:00
Christian Brauner
807d526dcd
commands_utils: fix command socket hashing
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-11 02:59:36 +01:00
Christian Brauner
0fb40573e5
af_unix: fix return value
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-11 02:35:51 +01:00
Christian Brauner
a783a4140c
start: cleanup file descriptor closing
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-11 01:56:44 +01:00
Stéphane Graber
85e9c763b1
Merge pull request #3286 from brauner/2020-03-10/fixes
commands: make sure to always close the client fd
2020-03-10 18:03:17 -04:00
Christian Brauner
cd5369b093
commands: make sure to always close the client fd
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 22:44:12 +01:00
Stéphane Graber
c2250e7584
Merge pull request #3285 from brauner/2020-03-10/fixes
bugfixes
2020-03-10 17:05:00 -04:00
Christian Brauner
39e2a438af
commands: improve state client cleanup
Improves: ebbca85297 ("commands_utils: fix socket leak when adding state client")
Cc: Matthias Hardt <matthias.hardt@gmail.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 21:46:25 +01:00
Christian Brauner
565eb353e0
commands: switch to pid_t to send around pid
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 21:35:25 +01:00
Stéphane Graber
bf7e2093b1
Merge pull request #3283 from brauner/2020-03-10/fixes
bugfixes
2020-03-10 15:21:09 -04:00
Christian Brauner
b41ec4d2ce
share_ns: improve error handling
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 19:51:38 +01:00
Christian Brauner
2580145fe9
share_ns: improve error handling
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 19:42:31 +01:00
Christian Brauner
7fa9063089
file_utils: handle libcs without fmemopen()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 17:44:56 +01:00
Christian Brauner
77c3e9a22d
cgroups: cleanup
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 17:07:33 +01:00
Christian Brauner
f761d24da6
cgfsng: use __do_free_string_list all over
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 16:39:04 +01:00
Christian Brauner
e1e08f3913
file_utils: include stdio.h for fmemopen()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 16:39:03 +01:00
Christian Brauner
1b9aca115e
tests/share_ns: always call pthread_exit()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 16:39:03 +01:00
Stéphane Graber
44512eeef1
Merge pull request #3282 from brauner/2020-03-10/fixes
memory_utils: remove unneeded inclusion of mntent.h
2020-03-10 11:23:36 -04:00
Christian Brauner
9b53e0b7d3
memory_utils: remove unneeded inclusion of mntent.h
Fixes: Android
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 16:08:06 +01:00
Stéphane Graber
208b3ee0e1
Merge pull request #3281 from brauner/2020-03-10/fixes
tree-wide: cleanup
2020-03-10 10:03:06 -04:00
Christian Brauner
bbba37f7b4
cgroups: fix memory leak and simplify code
Closes #3252.
Reported-by: LiFeng <lifeng68@huawei.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 14:44:59 +01:00
Christian Brauner
dab55f7798
tests/share_ns: bugfixes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 14:10:20 +01:00
Christian Brauner
5502253005
conf: cleanup
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 14:10:19 +01:00
Christian Brauner
cdd673140d
commands_utils: cleanup
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 11:40:06 +01:00
Christian Brauner
6c6497eab4
commands: cleanup
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-10 11:40:05 +01:00
Stéphane Graber
32a0f03300
Merge pull request #3279 from brauner/2020-03-04/improvements
bugfixes
2020-03-09 23:38:53 -04:00
Christian Brauner
b87ee3121b
tree-wide: more cleanup macros
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 22:22:12 +01:00
Christian Brauner
768e7ba266
lxccontainer: increase cleanup macro usage
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:47 +01:00
Christian Brauner
b816bdde0e
autotools: fix lxc-init build with clang-10
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:47 +01:00
Christian Brauner
818a57fc14
tree-wide: improve logging
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:47 +01:00
Christian Brauner
4110345b7a
tree-wide: make files cloexec whenever possible
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:47 +01:00
Christian Brauner
c2af3a1548
attach: cleanup various helpers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:47 +01:00
Christian Brauner
02d3b72b3f
attach: use logging helpers when handling no new privileges
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:47 +01:00
Christian Brauner
cca66e0694
attach: use cleanup macros and logging helpers when fetching seccomp
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:46 +01:00
Christian Brauner
a5d657d393
attach: use LXC_INVALID_{G,U}ID macros
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:46 +01:00
Christian Brauner
1b9c9f5bf1
attach: use cleanup macros in lxc_attach_getpwshell()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:46 +01:00
Christian Brauner
cf4026f1f5
attach: fix fd leak
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:46 +01:00
Christian Brauner
ffeeed8bc8
attach: cleanup
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:46 +01:00
Christian Brauner
874145c15c
cgroup2_devices: fix logic error
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:46 +01:00
Christian Brauner
07e1785904
commands: remove unused variables
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 21:47:46 +01:00
Christian Brauner
61e9751f43
Merge pull request #3280 from Piscolero/state_client_socket_leak_fix
commands_utils: fix socket leak when adding state client
2020-03-09 21:02:26 +01:00
Matthias Hardt
ebbca85297
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@gmail.com>
2020-03-09 19:58:22 +01:00
Matthias Hardt
2b3b8f65e3
Revert "commands_utils: fix socket leak in when adding state client"
This reverts commit d7aa555244.

Signed-off-by: Matthias Hardt <matthias.hardt@gmail.com>
2020-03-09 19:42:55 +01:00
Matthias Hardt
ee38ab3fe2
Revert "commands_utils: indicate taking ownership of state_client_fd in"
This reverts commit cd0dc360ce.

Signed-off-by: Matthias Hardt <matthias.hardt@gmail.com>
2020-03-09 19:42:53 +01:00
Matthias Hardt
cd0dc360ce
commands_utils: indicate taking ownership of state_client_fd in
lxc_add_state_client()

Signed-off-by: Matthias Hardt <matthias.hardt@gmail.com>
2020-03-09 16:12:28 +01:00
Matthias Hardt
d7aa555244
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@gmail.com>
2020-03-09 15:56:36 +01:00
Christian Brauner
2fb94e95e6
af_unix: cleanup
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-09 14:24:11 +01:00
Christian Brauner
d31059efa6
Merge pull request #3278 from tomponline/tp-proxy-sleep
network: Adds short sleep between veth setup and neighbour proxy add
2020-03-08 20:43:09 +01:00
Christian Brauner
e901a7a15c
Merge pull request #3277 from tomponline/tp-router-netlink
network: Uses netlink for IP neighbour proxy management
2020-03-08 20:31:43 +01:00
Thomas Parrott
954e36b490 network: Adds short sleep between veth setup and neighbour proxy add
There is an intermittent issue, experienced on at least Ubuntu 18.04 (5.3.0-40-generic) and Alpine 3.11 (5.4.12-1-virt) when using the router network interface type that causes the IP proxy neighbour entries on the host side of the veth pair to not be created.

The `ip neigh add proxy` command returns without an error, however by the time the network up hook has started the IP neighbour proxy entries are no longer there (if they ever were).

I've also tested this using netlink rather than the ip command to add and both are equally affected.

Adding a short sleep between setting up the veth pair and adding the proxy entries appears to fix it.

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2020-03-08 18:28:44 +00:00