Commit Graph

8713 Commits

Author SHA1 Message Date
qianfan Zhao
14aab2c733 lxc-create: check absoule path for param '--dir'
Fix: #3123

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2019-08-19 10:00:08 +08:00
Christian Brauner
942e193ef9
cgroups: support cgroup2 freezer
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-08-15 20:00:14 +02:00
Christian Brauner
faec88e5ac
Merge pull request #3119 from Blub/2019-08-13/fix_lxc_attach_getent_stderr
attach: don't close stdout of getent
2019-08-13 14:38:42 +02:00
Wolfgang Bumiller
59f0e209cc attach: don't close stdout of getent
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-08-13 14:24:30 +02:00
Christian Brauner
2ffda4c4f1
Merge pull request #3113 from jcfaracco/clang
utils: Fix wrong integer of a function parameter.
2019-08-03 10:33:30 -04:00
Julio Faracco
7c3d3976fa utils: Fix wrong integer of a function parameter.
If SSL is enabled, utils will include function `do_sha1_hash()` to
generate a sha1 encrypted buffer. Last function argument of
`EVP_DigestFinal_ex()` requires a `unsigned int` but the current
parameter is an `integer` type.

See error:
utils.c:350:38: error: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign
      [-Werror,-Wpointer-sign]
        EVP_DigestFinal_ex(mdctx, md_value, md_len);
                                            ^~~~~~
/usr/include/openssl/evp.h:549:49: note: passing argument to parameter 's' here
                                  unsigned int *s);

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
2019-08-03 02:16:13 -03:00
Alexander Kriventsov
9ed8c96ffb try to fix search user instead of search substring
Signed-off-by: Alexander Kriventsov <akriventsov@nic.ru>
2019-07-30 12:39:52 +03:00
Christian Brauner
df78878351
Merge pull request #3107 from tomponline/tp-wlan-detach
lxccontainer: do_lxcapi_detach_interface to support detaching wlan devs
2019-07-29 12:10:46 -04:00
Thomas Parrott
e4103cf63f lxccontainer: do_lxcapi_detach_interface to support detaching wlan devices
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2019-07-29 16:54:27 +01:00
Stéphane Graber
f9f15a7a76
Merge pull request #3109 from brauner/2019-07-28/bugfixes
cgroups: initialize cpuset properly
2019-07-28 23:43:24 -04:00
Christian Brauner
b31d62b847
cgroups: initialize cpuset properly
Closes #3108.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-28 23:13:26 +02:00
Wolfgang Bumiller
9af779ca32
Merge pull request #3102 from brauner/2019-07-22/bugfixes
tree-wide: initialize all auto-cleanup variables
2019-07-28 19:07:21 +02:00
Stéphane Graber
299d022db7
Merge pull request #3106 from brauner/2019-07-25/bugfixes
network: restore ability to move nl80211 devices
2019-07-26 09:36:24 -04:00
Christian Brauner
3dd7829433
network: restore ability to move nl80211 devices
Closes #3105.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-26 09:20:40 +02:00
Christian Brauner
d0b950440a
Merge pull request #3103 from tych0/info-on-enosys
pidfds: don't print a scary warning on ENOSYS
2019-07-23 17:48:12 +02:00
Tycho Andersen
9c57920566 pidfds: don't print a scary warning on ENOSYS
Most kernels don't have this functionality yet, and so the warning is
printed a lot. Our people are scared of warnings, so let's make it INFO
instead in this case.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2019-07-23 09:43:38 -06:00
Christian Brauner
6453ba565e
tree-wide: initialize all auto-cleanup variables
Closes: #3101.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-23 16:41:46 +02:00
Stéphane Graber
5c338ef44e
Re-enable devel flag
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2019-07-22 18:42:42 -04:00
Stéphane Graber
ad48c77c50
Release LXC 3.2.1
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2019-07-22 18:32:29 -04:00
Stéphane Graber
65123ff553
Release LXC 3.2.0
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2019-07-22 18:24:40 -04:00
Stéphane Graber
23f4d86859
lxc-download: Pre-release bump of compat
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2019-07-22 18:23:48 -04:00
Lukas Pirl
16a312e118
suppress false-negative error in templates and nvidia hook
``/proc`` might be mounted with ``hidepid=2``.
This makes ``/proc/1/…`` appear absent for non-root users.
When using the templates or the nvidia hook as a non-root user
(e.g., when creating unprivileged containers) the error
"/proc/1/uid_map: No such file or directory" is printed.
Since the script works correctly despite the error, this error
message might be confusing for users.

Signed-off-by: Lukas Pirl <git@lukas-pirl.de>
2019-07-22 14:39:23 +02:00
Christian Brauner
57c73b9f90
Merge pull request #3092 from Blub/seccomp-mem-rdwr
seccomp: open memfd read-write
2019-07-16 15:17:11 +02:00
Wolfgang Bumiller
aad859c42c seccomp: open memfd read-write
Makes it easier to implement syscalls which need to write to
a buffer passed by user space as a pointer.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-16 14:59:18 +02:00
Christian Brauner
8b4aaf8b53
Merge pull request #2921 from tomponline/tp-2019-03-26/routedveth
Adds veth router mode
2019-07-11 14:41:00 +02:00
tomponline
3e5c2e691b doc: Documents the lxc.net.[i].veth.mode option
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2019-07-11 12:37:23 +01:00
Thomas Parrott
6dfa9581af network: Adds veth router mode static routes and proxy entries
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2019-07-11 12:37:23 +01:00
Thomas Parrott
3f0ed090d6 network: Adds mode param (bridge, router) to veth network setting
Defaulting to bridge mode.

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2019-07-11 12:37:23 +01:00
Thomas Parrott
3e7d1bd171 lxc/log: Adds error_log_errno macro
Suggested usage:

	return error_log_errno(err, "Failed: %s", "some error");

It sets errno to the value of err, then calls SYSERROR with the format and remaining args.

It always returns -1.

Suggested-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2019-07-11 11:29:38 +01:00
Christian Brauner
bc554fdff9
Merge pull request #3090 from Rachid-Koucha/patch-3
Suppress hardcoded table sizes
2019-07-11 12:10:28 +02:00
Rachid Koucha
6da7363420
Suppress hardcoded table sizes
. Use sizeof() instead of hardcoded values
. snprintf(..., size, ""...) is in error if the return code is >= size (not sufficient to set only ">")

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-07-11 10:01:36 +02:00
Christian Brauner
9b01795886
Merge pull request #3089 from Rachid-Koucha/patch-2
Typo fix
2019-07-11 09:57:34 +02:00
Rachid Koucha
8332a09c96
Typo fix
Fixed a typo in error message

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-07-11 09:42:05 +02:00
Christian Brauner
6587d52bf6
Merge pull request #3088 from tenforward/japanese
doc: Add lxc.comp.notify.cookie to Japanese lxc.container.conf(5)
2019-07-11 08:28:11 +02:00
KATOH Yasufumi
5bc821d349 doc: Add lxc.comp.notify.cookie to Japanese lxc.container.conf(5)
update for commit 214008e

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2019-07-11 15:22:08 +09:00
Stéphane Graber
fd34369e10
Merge pull request #3087 from brauner/master
cgroup: check for non-empty conf
2019-07-10 10:53:45 -04:00
Christian Brauner
d926acfde0
cgroup: check for non-empty conf
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-10 16:34:29 +02:00
Stéphane Graber
d094c18024
Merge pull request #3086 from brauner/2019-07-09/seccomp_fixes
seccomp: coding style
2019-07-09 15:15:41 -04:00
Christian Brauner
cbbdd1dd35
seccomp: coding style
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-09 21:08:20 +02:00
Christian Brauner
26077e91db
Merge pull request #3080 from Blub/seccomp-notify-api
Seccomp notify api update
2019-07-09 17:50:44 +02:00
Christian Brauner
b9dab9ef8f
af_unix: remove unused variable
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-07-09 17:19:29 +02:00
Wolfgang Bumiller
637996a4c3 seccomp: send caller pidfd along with proxied requests
On the one hand this should close the race between the
process exiting until the proxy reads the request.
On the other hand it'll help the proxy quickly access info
from /proc (such as ./cwd, ./ns/mnt, ...)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-09 12:25:10 +02:00
Wolfgang Bumiller
87e547d9c7 seccomp: recvmsg with MSG_TRUNC
We only read the message without the cookie. For now assert
that the sender also didn't try to send more by letting
`recvmsg()` return the original size of the packet if it was
longer.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-09 12:25:10 +02:00
Wolfgang Bumiller
214008eeb2 doc: document lxc.seccomp.notify.cookie
and fix a minor typo

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-09 12:25:10 +02:00
Wolfgang Bumiller
651e63a719 seccomp: defer reconnecting to the proxy
With the previous commit we now attempt to reconnect to the
proxy in the beginning of the notify handler if we had no
connection.
If the connection fails later on, we now don't really need
to immediately try to reconnect if we send a default
response anyway (particularly if the recv() fails). (This
also gives the proxy more time, for instance if it was just
restarted.)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-09 12:25:10 +02:00
Wolfgang Bumiller
ed3a98c4c2 seccomp: keep retrying to reconnect to proxy
If a syscall happens after we already failed to communicate
with the proxy, proxy_fd was -1.
Before the previous commit we'd then be stuck in the state
where there was no proxy registered. With the previous
commit we'd send a default reply and only then try to
reconnect.
Improve this even further by trying to reconnect right at
the start.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-09 12:25:10 +02:00
Wolfgang Bumiller
1370a882bc seccomp: send default response when there's no proxy
Particularly, when there's no proxy registered (iow. none
configured but the seccomp profile still had a 'notify'
rule), we don't want to leave them hanging.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-09 12:25:10 +02:00
Wolfgang Bumiller
3745ee0ec7 seccomp: retry connecting to the proxy once
If the first sendmsg() fails, try to reconnect once before
failing. Otherwise if a proxy restarts while no syscall
happens, the next syscall always fails with ENOSYS.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-09 12:25:10 +02:00
Wolfgang Bumiller
5357b872f7 seccomp: don't ignore syscalls when there's no proxy
The container process would just hang.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-09 12:25:10 +02:00
Wolfgang Bumiller
8a99ab014a seccomp: remove reconnect-loop
When we fail to send a message, we send a default seccomp
response and try to reconnect to the proxy. It doesn't
really make much sense to retry to send the request over the
new connection as the syscall has already been answered. The
same goes for receiving the response - after reconnecting to
the proxy, we're a new client to a potentially new proxy
process, so awaiting a response without having sent a
request doesn't make all too much sense either.

In the future we should probably have a timeout or retry
count for the entire proxy _transaction_ before sending a
response to seccomp at all (and probably handle requests
asynchronously).

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-07-09 12:25:10 +02:00