Commit Graph

9144 Commits

Author SHA1 Message Date
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
Thomas Parrott
5fe147e974 network: Uses netlink for IP neighbour proxy management
Removes need for ip command when managing IP neighbour proxies.

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2020-03-08 17:58:37 +00:00
Stéphane Graber
1b3e427434
Merge pull request #3275 from brauner/2020-03-05/api_extension
utils: only move_fd() when fdopen() has been successful
2020-03-05 11:36:38 +01:00
Christian Brauner
92bdc5937e
utils: only move_fd() when fdopen() has been successful
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-05 11:14:24 +01:00
Stéphane Graber
4f31df9393
Merge pull request #3274 from brauner/2020-03-05/api_extension
fixes
2020-03-05 10:36:40 +01:00
Christian Brauner
c60ee0a929
api-extensions: document cgroup2_devices and cgroup2 api extensions
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-03-05 10:12:28 +01:00
Christian Brauner
382854fbd3
Merge pull request #3272 from ffontaine/master
src/lxc/raw_syscalls.c: fix sparc assembly
2020-02-29 03:35:04 +01:00
Fabrice Fontaine
5f7dd076fe src/lxc/raw_syscalls.c: fix sparc assembly
Build of lxc 3.2.1 fails with ultrasparc on:

raw_syscalls.c: In function ‘lxc_raw_clone’:
raw_syscalls.c:66:3: error: invalid 'asm': invalid operand output code
   asm volatile(
   ^~~

Issue has been added with commit
b52e8e68a6 which added %g1 instead of %%g1

Fixes:
 - http://autobuild.buildroot.org/results/17c2319850f02f24da6fbef9656c07f86fdc5a3a

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-02-28 17:45:10 +01:00
Stéphane Graber
67d54d09c2
Merge pull request #3271 from brauner/2020-02-28/support_cgroup_pattern_2
cgroups: honor lxc.cgroup.pattern if set explicitly II
2020-02-28 12:36:30 +01:00
Christian Brauner
d6bdd1823a
cgroups: honor lxc.cgroup.pattern if set explicitly II
Link: https://discuss.linuxcontainers.org/t/lxc-cgroup-pattern-is-not-being-honored
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2020-02-28 12:16:17 +01:00
Stéphane Graber
2bc4909886
Merge pull request #3270 from brauner/2020-02-27/support_cgroup_pattern
cgroups: honor lxc.cgroup.pattern if set explicitly
2020-02-28 12:08:13 +01:00