Commit Graph

8686 Commits

Author SHA1 Message Date
Christian Brauner
7d4188ce71
Merge pull request #2998 from rikardfalkeborn/fix-returning-non-bool
Fix returning -1 in functions with return type bool
2019-05-13 13:19:22 +02:00
Christian Brauner
fa9aa1fabb
Merge pull request #3000 from Rachid-Koucha/patch-11
Config: check for %m availability
2019-05-13 13:18:54 +02:00
Rachid Koucha
720bbb3118
Config: check for %m availability
GLIBC supports %m to avoid calling strerror(). Using it saves some code space.
==> This check will define HAVE_M_FORMAT to be use wherever possible (e.g. log.h)

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-05-13 13:13:18 +02:00
Rikard Falkeborn
e1d4305384 initutils: Fix memleak on realloc failure
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
2019-05-12 03:16:39 +02:00
Rikard Falkeborn
cdcaad4868 zfs: Fix return value on zfs_snapshot error
Returning -1 in a function with return type bool is the same as
returning true. Change to return false to indicate error properly.

Detected with cppcheck.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
2019-05-12 01:55:34 +02:00
Rikard Falkeborn
4d927e7f42 lvm: Fix return value if lvm_create_clone fails
Returning -1 in a function with return type bool is the same as
returning true. Change to return false to indicate error properly.

Detected with cppcheck.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
2019-05-12 01:55:34 +02:00
Rikard Falkeborn
17e68c49cf criu: Remove unnecessary return after _exit()
Since _exit() will terminate, the return statement is dead code. Also,
returning -1 from a function with bool as return type is confusing.

Detected with cppcheck.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
2019-05-12 01:55:34 +02:00
Christian Brauner
ad4dddd85e
Merge pull request #2997 from rst0git/criu-v-option
criu: Use -v4 instead of -vvvvvv
2019-05-10 23:47:28 +02:00
Radostin Stoyanov
582cb4785a criu: Use -v4 instead of -vvvvvv
CRIU has only 4 levels of verbosity (errors, warnings, info, debug).
Thus, using `-v4` is more appropriate.

https://criu.org/Logging

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2019-05-10 22:39:15 +01:00
Christian Brauner
da161bc1a2
Merge pull request #2993 from Rachid-Koucha/patch-9
New --bbpath option and unecessary --rootfs checks
2019-05-10 21:35:56 +02:00
Rachid Koucha
5f0fb855f8
Option --busybox-path instead of --bbpath
As suggested during the review.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-05-10 21:28:35 +02:00
Christian Brauner
e269d99b02
Merge pull request #2996 from brauner/Rachid-Koucha-patch-10
lxccontainer: do not display if missing privileges
2019-05-10 21:20:20 +02:00
Rachid Koucha
9fbe07f68d
lxccontainer: do not display if missing privileges
lxc-ls without root privileges on privileged containers should not display
information. In lxc_container_new(), ongoing_create()'s result is not checked
for all possible returned values. Hence, an unprivileged user can send command
messages to the container's monitor. For example:

$ lxc-ls -P /.../tests -f
NAME     STATE AUTOSTART GROUPS IPV4 IPV6 UNPRIVILEGED
ctr -     0         -      -    -    false
$ sudo lxc-ls -P /.../tests -f
NAME     STATE   AUTOSTART GROUPS IPV4      IPV6 UNPRIVILEGED
ctr RUNNING 0         -      10.0.3.51 -    false

After this change:

$ lxc-ls -P /.../tests -f      <-------- No more display without root privileges
$ sudo lxc-ls -P /.../tests -f
NAME     STATE   AUTOSTART GROUPS IPV4      IPV6 UNPRIVILEGED
ctr RUNNING 0         -      10.0.3.37 -    false
$

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-05-10 21:02:17 +02:00
Rachid Koucha
e796239406
New --bbpath option and unecessary --rootfs checks
. Add the "--bbpath" option to pass an alternate busybox pathname instead of the one found from ${PATH}.
. Take this opportunity to add some formatting in the usage display
. As a try is done to pick rootfs from the config file and set it to ${path}/rootfs, it is unnecessary to make it mandatory

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-05-10 17:01:13 +02:00
Stéphane Graber
792ea40042
Merge pull request #2992 from brauner/2019-05-10/coding_style_update
coding style: update
2019-05-10 08:36:56 -04:00
Christian Brauner
a8e63d6904
coding style: update
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-05-10 13:35:13 +02:00
Christian Brauner
9e19503641
Merge pull request #2985 from tomponline/tp-mtu
network: Adds mtu support for phys and macvlan types
2019-05-10 09:30:35 +02:00
Christian Brauner
70aa3c7f58
Merge pull request #2989 from Rachid-Koucha/patch-8
Redirect error messages to stderr
2019-05-10 08:48:59 +02:00
Rachid Koucha
634ad9358e
Redirect error messages to stderr
Some error messages were not redirected to stderr.
Moreover, do "exit 0" instead of "exit 1" when "help" option is passed.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-05-10 07:39:03 +02:00
Stéphane Graber
3e860bdac0
Merge pull request #2986 from brauner/2019-05-09/clone_pidfd
start: use CLONE_PIDFD
2019-05-09 15:19:58 -04:00
Christian Brauner
33942046c5
start: use CLONE_PIDFD
Use CLONE_PIDFD when possible.

Note the clone() syscall ignores unknown flags which is usually a design
mistake. However, for us this bug is a feature since we can just pass the flag
along and see whether the kernel has given us a pidfd.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-05-09 19:40:23 +02:00
Thomas Parrott
bc99910758 api: Adds the network_phys_macvlan_mtu extension
This will allow LXD to check for custom MTU support for phys and macvlan devices.

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2019-05-09 16:55:51 +01:00
Thomas Parrott
0b15498976 network: Restores phys device MTU on container shutdown
The phys devices will now have their original MTUs recorded at start and restored at shutdown.

This is to protect the original phys device from having any container level MTU customisation being applied to the device once it is restored to the host.

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2019-05-09 16:55:45 +01:00
Christian Brauner
33258b95fc
namespace: support CLONE_PIDFD with lxc_clone()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-05-09 17:09:51 +02:00
Thomas Parrott
3bef7b7b50 network: Adds mtu support for phys and macvlan types
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2019-05-09 15:34:20 +01:00
Stéphane Graber
1ab73d3800
Merge pull request #2984 from brauner/2019-05-09/clone_pidfd
clone: add infrastructure for CLONE_PIDFD
2019-05-09 09:37:51 -04:00
Christian Brauner
a59440be09
clone: add infrastructure for CLONE_PIDFD
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eac7078a0fff1e72cf2b641721e3f55ec7e5e21e

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-05-09 15:01:27 +02:00
Christian Brauner
b52e8e68a6
raw_syscalls: simplify assembly
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Co-developed-by: David Howells <dhowells@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
2019-05-09 15:00:32 +02:00
Stéphane Graber
af1893bfce
Merge pull request #2906 from brauner/2019-03-12/namespace_switching
utils: improve switch_to_ns()
2019-05-09 08:47:34 -04:00
Christian Brauner
b280bc380c
utils: improve switch_to_ns()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-05-09 12:20:14 +02:00
Christian Brauner
c6494c4b88
Merge pull request #2983 from tenforward/japanese
Update Japanese lxc.container.conf(5)
2019-05-09 11:09:45 +02:00
KATOH Yasufumi
c425edc661 doc: Fix and improve Japanese translation
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Reviewed-by: Hiroaki Nakamura <hnakamur@gmail.com>
2019-05-09 15:47:16 +09:00
KATOH Yasufumi
7dd6ead904 doc: Update Japanese lxc.container.conf(5)
This is the translation for the following description:
  - lxc.seccomp.notify.proxy (commit 8a64375)
  - host side veth device static routes (commit d4a7da4)
  - IPVLAN (commit c9f5238)
  - Layer 2 proxy mode (commit 6509154)
  - gateway device route mode (commit a2f9a67)

and fix typo in English man page.

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2019-05-08 21:48:15 +09:00
Christian Brauner
b1045fd37b
Merge pull request #2982 from Rachid-Koucha/patch-5
Devices created in rootfs instead of rootfs/dev
2019-05-07 16:14:51 +02:00
Rachid Koucha
28eb86bd43
Devices created in rootfs instead of rootfs/dev
Added /dev in the mknod commands.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
2019-05-07 16:03:02 +02:00
Christian Brauner
668084bb25
Merge pull request #2981 from tomponline/tp-veth-gateway
network: Re-works veth gateway logic
2019-05-07 15:50:43 +02:00
tomponline
009d612748 network: Re-works veth gateway logic
Handles more errors and gives better error messages.

Signed-off-by: tomponline <thomas.parrott@canonical.com>
2019-05-07 14:38:23 +01:00
Christian Brauner
1732294cab
Merge pull request #2979 from tomponline/tp-vlan-mtu
network: Makes vlan network interfaces set mtu before upscript called
2019-05-07 14:03:52 +02:00
Christian Brauner
2c07c966f9
Merge pull request #2978 from tomponline/tp-ipvlan-mtu
network: Adds custom mtu support for ipvlan interfaces
2019-05-07 13:37:38 +02:00
tomponline
3e2a7b083b network: Makes vlan network interfaces set mtu before upscript called
This is consistent with veth and ipvlan types.

Also makes the debug message for success occur after up script has run.

Also makes device clean up on error more thorough and consistent.

Signed-off-by: tomponline <thomas.parrott@canonical.com>
2019-05-07 12:34:34 +01:00
tomponline
006e135e22 network: Adds custom mtu support for ipvlan interfaces
Signed-off-by: tomponline <thomas.parrott@canonical.com>
2019-05-07 12:13:46 +01:00
Stéphane Graber
19a503200d
Merge pull request #2976 from brauner/2019-05-06/bugfixes
seccomp: document path calculation
2019-05-06 15:10:20 -04:00
Stéphane Graber
7e30d659c3
Merge pull request #2977 from brauner/2019-05-06/pidfd_send_signal
raw_syscalls: add initial support for pidfd_send_signal()
2019-05-06 14:36:50 -04:00
Christian Brauner
d9bb2fbab6
raw_syscalls: add initial support for pidfd_send_signal()
Well, I added this syscall so we better use it. :)

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-05-06 10:49:31 +02:00
Christian Brauner
18847d37dd
seccomp: document path calculation
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-05-06 09:39:40 +02:00
Stéphane Graber
192023dd5a
Merge pull request #2974 from brauner/master
tree-wide: make socket SOCK_CLOEXEC
2019-05-05 00:20:06 -04:00
Stéphane Graber
3ade816713
Merge pull request #2975 from brauner/2019-05-04/returns_twice
compiler: add __returns_twice attribute
2019-05-05 00:19:51 -04:00
Christian Brauner
633cb8bee3
compiler: add __returns_twice attribute
The returns_twice attribute tells the compiler that a function may return more
than one time. The compiler will ensure that all registers are dead before
calling such a function and will emit a warning about the variables that may be
clobbered after the second return from the function. Examples of such functions
are setjmp and vfork. The longjmp-like counterpart of such function, if any,
might need to be marked with the noreturn attribute.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2019-05-04 13:35:51 +02:00
Christian Brauner
0854538f13
Merge pull request #2973 from tomponline/tp-gw-dev
network: Adds gateway device route mode
2019-05-04 12:56:45 +02:00
Christian Brauner
9e8c3ebeb5
Merge pull request #2968 from tomponline/tp-ipvlan-l2proxy
network: Static routes for IPVLAN with L2PROXY
2019-05-03 21:09:37 +02:00