Commit Graph

8599 Commits

Author SHA1 Message Date
Christian Brauner
9c238bc6bf
Merge pull request #3081 from brauner/2019-07-05/network_unification_fixes
start: call lxc_find_gateway_addresses early
2019-07-05 11:44:45 +02:00
Thomas Parrott
03ca4af8fa
start: call lxc_find_gateway_addresses early
This restores the lxc.net.x.ipv4.gateway = auto and
lxc.net.x.ipv6.gateway = auto functionality.

When the child is created the parent and child have different views of
struct lxc_handler since - obviously - virtual memory is duplicated. So any
changes to done by the parent that the child should see need to be IPCed to it.
For any non-actual device creation stuff this does not make much sense. This
includes finding gateway addresses. Move it back prior to clone().

Fixes #3078

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
[christian.brauner@ubuntu.com: non-functional changes and update commit message]
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-05 11:05:38 +02:00
Stéphane Graber
306ca14a29
Merge pull request #3077 from brauner/2019-07-03/network_fixes
network: simplify lxc_network_move_created_netdev_priv()
2019-07-03 18:13:20 -04:00
Christian Brauner
24190194c1
network: simplify lxc_network_move_created_netdev_priv()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 23:55:57 +02:00
Stéphane Graber
a70d78cdc8
Merge pull request #3076 from brauner/2019-07-03/network_fixes
network: fixes after unifying network creation
2019-07-03 17:43:54 -04:00
Christian Brauner
3c09b97cd5
network: send names for all non-trivial network types
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 23:28:58 +02:00
Christian Brauner
61302ef7dc
network: record created_name for instantiate_phys()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 21:48:20 +02:00
Christian Brauner
75b074eea0
network: simplify instantiate_phys()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 21:46:37 +02:00
Christian Brauner
83530dba89
network: record created_name for instantiate_vlan()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 21:44:52 +02:00
Christian Brauner
d4d684109c
network: simplify instantiate_vlan()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 21:44:19 +02:00
Christian Brauner
e7fdd504e9
network: record created_name for instantiate_ipvlan()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 21:43:19 +02:00
Christian Brauner
dd1192068d
network: simplify instantiate_ipvlan()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 21:42:59 +02:00
Christian Brauner
a9704f0521
network: stash created_name in instantiate_macvlan()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 21:39:54 +02:00
Christian Brauner
8021de2564
network: simplify instantiate_macvlan()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 21:39:24 +02:00
Christian Brauner
3ebffb9896
network: s/loDev/loop_device/g
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 21:37:37 +02:00
Stéphane Graber
113ca42933
Merge pull request #3075 from brauner/2019-07-03/cgroups
cgroups: hande cpuset initialization race
2019-07-03 12:23:50 -04:00
Christian Brauner
b28c281086
cgroups: hande cpuset initialization race
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 17:57:48 +02:00
Stéphane Graber
0f03b15592
Merge pull request #3074 from brauner/2019-07-03/fix_phys_network_creation
network: remove faulty restriction
2019-07-03 11:44:25 -04:00
Christian Brauner
e318f2c1a3
network: remove faulty restriction
Reported-by: Thomas Parrott <thomas.parrott@canonical.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-03 15:48:09 +02:00
Stéphane Graber
4f71ecb85e
Merge pull request #3069 from brauner/2019-07-01/network_creation
start: unify network creation
2019-07-02 11:46:55 -04:00
Christian Brauner
1871e6465b
start: expose LXC_PID to network hooks too
Closes #3066.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-02 13:49:33 +02:00
Christian Brauner
e389f2afd8
start: unify and simplify network creation
Make sure that network creation happens at the same time for containers started
by privileged and unprivileged users. The only reason we didn't do this so far
was to avoid sending network device ifindices around in the privileged case.

Link: https://github.com/lxc/lxc/issues/3066
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-02 13:49:27 +02:00
Stéphane Graber
c83ad424ab
Merge pull request #3064 from brauner/2019-06-27/cleanup_macros
bugfixes
2019-07-01 22:06:23 -04:00
Stéphane Graber
dfce2c76be
Merge pull request #3059 from brauner/2019-06-21/seccomp_notify
lxccontainer: rework seccomp notify api function
2019-07-01 22:04:20 -04:00
Christian Brauner
33d7d28f45
Merge pull request #3067 from Rachid-Koucha/patch-1
Move code/variable in smaller scope
2019-06-30 18:13:30 +02:00
Rachid Koucha
2806a87dcc
Move code/variable in smaller scope
In start.c, do not fill path[] table if not necessary

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-06-29 23:21:14 +02:00
Christian Brauner
9752e3a9e7
Merge pull request #3065 from lifeng68/fix_memory_leak
fix memory leak in do_storage_create
2019-06-28 11:53:52 +02:00
LiFeng
8ea91347b8 fix memory leak in do_storage_create
Signed-off-by: LiFeng <lifeng68@huawei.com>
2019-06-27 23:49:08 -04:00
Christian Brauner
6a720d7480
cgroups: move variable into tighter scope
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-27 16:08:21 +02:00
Christian Brauner
f6b54668ef
cgroups: correctly order variables
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-27 16:08:21 +02:00
Christian Brauner
dfa835ac21
cgroups: move variable into tighter scope
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-27 16:08:21 +02:00
Christian Brauner
3312a94ff4
cgroups: simplify cgfsng_nrtasks()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-27 16:08:21 +02:00
Christian Brauner
779b3d82e6
cgroups: move variable into tighter scope
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-27 16:08:18 +02:00
Christian Brauner
81b5d48a34
cgroups: move variable into tighter scope
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-27 14:27:58 +02:00
Christian Brauner
c05b17bd66
cgroups: use __do_free in cgfsng_attach()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-27 14:27:39 +02:00
Christian Brauner
6280d4c97d
cgroups: simplify cgfsng_setup_limits()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-27 14:26:38 +02:00
Christian Brauner
431e2c547f
cgroups: move variables into tighter scope
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-27 14:26:14 +02:00
Christian Brauner
a64edc1c8d
cgroups: use __do_free
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-27 14:25:53 +02:00
Christian Brauner
c121b3000f
Merge pull request #3063 from lifeng68/fix_memory_leak
cgfsng: fix memory leak in lxc_cpumask_to_cpulist
2019-06-27 09:40:55 +02:00
LiFeng
24cac6aff1 cgfsng: fix memory leak in lxc_cpumask_to_cpulist
Signed-off-by: LiFeng <lifeng68@huawei.com>
2019-06-27 00:00:09 -04:00
Christian Brauner
679289bf5f
lxccontainer: rework seccomp notify api function
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-21 12:59:36 +02:00
Stéphane Graber
daf6a727aa
Merge pull request #3056 from brauner/2019-06-20/cpuset
cgfsng: write cpuset.mems of correct ancestor
2019-06-20 13:54:12 -04:00
Christian Brauner
f68ea354f4
cgfsng: write cpuset.mems of correct ancestor
Reported-by: Free Ekanayaka <free.ekanayaka@canonical.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-06-20 19:37:09 +02:00
Christian Brauner
23852ec4d0
Merge pull request #3052 from tanyifeng/fd_leak
parse.c: fix fd leak from memfd_create
2019-06-20 11:33:41 +02:00
t00416110
22c8ac96f6 parse.c: fix fd leak from memfd_create
Signed-off-by: t00416110 <tanyifeng1@huawei.com>
2019-06-20 16:26:59 -04:00
Christian Brauner
2fea2116c9
Merge pull request #3050 from hallyn/pkgconfig
lxc.pc.in: add libs.private for static linking
2019-06-18 21:09:28 +02:00
Serge Hallyn
a65cce2f9d lxc.pc.in: add libs.private for static linking
None of them seem to support pkg-config themselves, else we could add
them to Requires.private.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
2019-06-18 13:13:34 -05:00
Christian Brauner
52ac245b52
Merge pull request #3047 from Rachid-Koucha/patch-11
Fixed file descriptor leak for network namespace
2019-06-16 04:11:35 +02:00
Rachid Koucha
aa0c0e7b8a
Fixed file descriptor leak for network namespace
In privileged mode, the container startup looses a file descriptor for "handler->nsfd[LX_NS_NET]". At line 1782, we preserve the namespaces file descriptor (in privileged mode, the network namespace is also preserved) :
	for (i = 0; i < LXC_NS_MAX; i++)
		if (handler->ns_on_clone_flags & ns_info[i].clone_flag)
			INFO("Cloned %s", ns_info[i].flag_name);

	if (!lxc_try_preserve_namespaces(handler, handler->ns_on_clone_flags, handler->pid)) {
		ERROR("Failed to preserve cloned namespaces for lxc.hook.stop");
		goto out_delete_net;
	}

Then at line 1830, we preserve one more time the network namespace :
		ret = lxc_try_preserve_ns(handler->pid, "net");
		if (ret < 0) {
			if (ret != -EOPNOTSUPP) {
				SYSERROR("Failed to preserve net namespace");
				goto out_delete_net;
			}
The latter overwrites the file descriptor already stored in handler->nsfd[LXC_NS_NET] at line 1786.

So, this fix checks that the entry is not already filled.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-06-15 15:17:50 +02:00
Serge Hallyn
3d43f6113b
Merge pull request #3045 from hallyn/2019-06-13/openssl
[RFC\ Switch from gnutls to openssl for sha1
2019-06-14 23:00:48 -05:00