]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
5 years agocgroups/cgfsng: rework cgfsng_chown()
Christian Brauner [Sat, 7 Dec 2019 23:38:16 +0000 (00:38 +0100)] 
cgroups/cgfsng: rework cgfsng_chown()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_attach()
Christian Brauner [Sat, 7 Dec 2019 23:35:19 +0000 (00:35 +0100)] 
cgroups/cgfsng: rework cgfsng_attach()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_setup_limits()
Christian Brauner [Sat, 7 Dec 2019 23:33:24 +0000 (00:33 +0100)] 
cgroups/cgfsng: rework cgfsng_setup_limits()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_setup_limits_legacy()
Christian Brauner [Sat, 7 Dec 2019 23:27:22 +0000 (00:27 +0100)] 
cgroups/cgfsng: rework cgfsng_setup_limits_legacy()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_{get,set}()
Christian Brauner [Sat, 7 Dec 2019 23:24:20 +0000 (00:24 +0100)] 
cgroups/cgfsng: rework cgfsng_{get,set}()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_unfreeze()
Christian Brauner [Sat, 7 Dec 2019 23:20:02 +0000 (00:20 +0100)] 
cgroups/cgfsng: rework cgfsng_unfreeze()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_get_hierarchies()
Christian Brauner [Sat, 7 Dec 2019 23:18:52 +0000 (00:18 +0100)] 
cgroups/cgfsng: rework cgfsng_get_hierarchies()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_num_hierarchies()
Christian Brauner [Sat, 7 Dec 2019 23:17:58 +0000 (00:17 +0100)] 
cgroups/cgfsng: rework cgfsng_num_hierarchies()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_escape()
Christian Brauner [Sat, 7 Dec 2019 23:16:59 +0000 (00:16 +0100)] 
cgroups/cgfsng: rework cgfsng_escape()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_payload_enter()
Christian Brauner [Sat, 7 Dec 2019 23:13:14 +0000 (00:13 +0100)] 
cgroups/cgfsng: rework cgfsng_payload_enter()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_payload_create()
Christian Brauner [Sat, 7 Dec 2019 23:06:59 +0000 (00:06 +0100)] 
cgroups/cgfsng: rework cgfsng_payload_create()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agotree-wide: s/__unused/__lxc_unused/g
Christian Brauner [Sat, 7 Dec 2019 22:47:16 +0000 (23:47 +0100)] 
tree-wide: s/__unused/__lxc_unused/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgroup attach
Christian Brauner [Sat, 7 Dec 2019 21:19:20 +0000 (22:19 +0100)] 
cgroups/cgfsng: rework cgroup attach

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: don't dereference NULL-pointer
Christian Brauner [Sat, 7 Dec 2019 21:12:00 +0000 (22:12 +0100)] 
cgroups/cgfsng: don't dereference NULL-pointer

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: log chown_cgroup_wrapper()
Christian Brauner [Sat, 7 Dec 2019 21:04:04 +0000 (22:04 +0100)] 
cgroups/cgfsng: log chown_cgroup_wrapper()

It's becoming more important on cgroup2 to properly delegate cgroups.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgroup2 unprivileged delegation
Christian Brauner [Sat, 7 Dec 2019 20:51:58 +0000 (21:51 +0100)] 
cgroups/cgfsng: rework cgroup2 unprivileged delegation

We accidently checked files to delegate for privileged container and not for
unprivileged containers in the pure unified case. Fix that and clean up the
delegation file parsing.

Closes #3206.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_{monitor,payload}_delegate_controllers()
Christian Brauner [Sat, 7 Dec 2019 17:17:48 +0000 (18:17 +0100)] 
cgroups/cgfsng: rework cgfsng_{monitor,payload}_delegate_controllers()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_monitor_enter()
Christian Brauner [Sat, 7 Dec 2019 17:13:54 +0000 (18:13 +0100)] 
cgroups/cgfsng: rework cgfsng_monitor_enter()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_monitor_create()
Christian Brauner [Sat, 7 Dec 2019 17:12:30 +0000 (18:12 +0100)] 
cgroups/cgfsng: rework cgfsng_monitor_create()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_monitor_destroy()
Christian Brauner [Sat, 7 Dec 2019 17:08:25 +0000 (18:08 +0100)] 
cgroups/cgfsng: rework cgfsng_monitor_destroy()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: rework cgfsng_payload_destroy()
Christian Brauner [Sat, 7 Dec 2019 17:04:17 +0000 (18:04 +0100)] 
cgroups/cgfsng: rework cgfsng_payload_destroy()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agolog: remove unused compiler attribute
Christian Brauner [Sat, 7 Dec 2019 16:40:32 +0000 (17:40 +0100)] 
log: remove unused compiler attribute

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agostart: replace compiler attributes
Christian Brauner [Sat, 7 Dec 2019 16:40:05 +0000 (17:40 +0100)] 
start: replace compiler attributes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agolog: replace compiler attributes
Christian Brauner [Sat, 7 Dec 2019 16:39:49 +0000 (17:39 +0100)] 
log: replace compiler attributes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoattach: replace closing helpers
Christian Brauner [Sat, 7 Dec 2019 16:39:03 +0000 (17:39 +0100)] 
attach: replace closing helpers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocompiler: add __unused attribute
Christian Brauner [Sat, 7 Dec 2019 16:38:42 +0000 (17:38 +0100)] 
compiler: add __unused attribute

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years ago{log, macro}: remove unused logging functions
Christian Brauner [Sat, 7 Dec 2019 16:31:50 +0000 (17:31 +0100)] 
{log, macro}: remove unused logging functions

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups: rework return values of some functions
Christian Brauner [Sat, 7 Dec 2019 16:30:57 +0000 (17:30 +0100)] 
cgroups: rework return values of some functions

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgroup2_devices: replace logging functions
Christian Brauner [Sat, 7 Dec 2019 16:30:07 +0000 (17:30 +0100)] 
cgroups/cgroup2_devices: replace logging functions

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgroup: replace logging functions
Christian Brauner [Sat, 7 Dec 2019 16:29:12 +0000 (17:29 +0100)] 
cgroups/cgroup: replace logging functions

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: replace logging functions
Christian Brauner [Sat, 7 Dec 2019 16:28:06 +0000 (17:28 +0100)] 
cgroups/cgfsng: replace logging functions

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoconfile: replace logging helpers
Christian Brauner [Sat, 7 Dec 2019 16:25:28 +0000 (17:25 +0100)] 
confile: replace logging helpers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agonetwork: replace logging helpers
Christian Brauner [Sat, 7 Dec 2019 16:24:29 +0000 (17:24 +0100)] 
network: replace logging helpers

s/error_log_errno(/log_error_errno(-1, /g
s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocommands: replace logging helpers
Christian Brauner [Sat, 7 Dec 2019 16:23:24 +0000 (17:23 +0100)] 
commands: replace logging helpers

s/error_log_errno(/log_error_errno(-1, /g
s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoattach: s/minus_one_set_errno(/ret_set_errno(-1, /g
Christian Brauner [Sat, 7 Dec 2019 16:22:53 +0000 (17:22 +0100)] 
attach: s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoaf_unix: s/minus_one_set_errno(/ret_set_errno(-1, /g
Christian Brauner [Sat, 7 Dec 2019 16:22:14 +0000 (17:22 +0100)] 
af_unix: s/minus_one_set_errno(/ret_set_errno(-1, /g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agomacro: add ret_errno()
Christian Brauner [Sat, 7 Dec 2019 16:21:53 +0000 (17:21 +0100)] 
macro: add ret_errno()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agolog: rearrange
Christian Brauner [Sat, 7 Dec 2019 16:21:18 +0000 (17:21 +0100)] 
log: rearrange

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroup2: rework controller delegation
Christian Brauner [Fri, 6 Dec 2019 08:42:47 +0000 (09:42 +0100)] 
cgroup2: rework controller delegation

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years ago"busy" field set to -1 instead of 0
Rachid Koucha [Fri, 6 Dec 2019 14:07:47 +0000 (15:07 +0100)] 
"busy" field set to -1 instead of 0

"busy" field is assigned with the command socket descriptor when the terminal is in use. So, use "-1" to disable it.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
5 years ago"busy" field set to 1 instead of 0
Rachid Koucha [Fri, 6 Dec 2019 14:04:31 +0000 (15:04 +0100)] 
"busy" field set to 1 instead of 0

"busy" field is assigned with the command socket descriptor when the terminal is in use. So, use "-1" to disable it.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
5 years agoInit "busy" field to -1 as 0 is valid fd
Rachid Koucha [Fri, 6 Dec 2019 13:59:52 +0000 (14:59 +0100)] 
Init "busy" field to -1 as 0 is valid fd

"busy" field is assigned with the command socket descriptor when the terminal is in use. So, use "-1" to disable it.
Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
5 years agoconfig: Fix parsing of mount options
Maximilian Blenk [Thu, 5 Dec 2019 15:44:41 +0000 (16:44 +0100)] 
config: Fix parsing of mount options

When parsing mount options e.g. from lxc.mount.entry the specified
options are mapped to the flags constants. To do so, the strings
are compared to the options contained in mount_opt. However,
when comparing the strings, the length of the string is not
checked. That entails that the option "rootcontext=selinux-context"
is mapped to the mount option read-only (ro). This commit fixes
this issue by checking if a '=' is contained in the specified option
and additionally comparing the length of the strings.

Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
5 years agocgroups/devices: correctly verify bpf device useability in cgfsng_devices_activate()
Christian Brauner [Wed, 4 Dec 2019 13:03:48 +0000 (14:03 +0100)] 
cgroups/devices: correctly verify bpf device useability in cgfsng_devices_activate()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups: improve container cgroup attaching
Christian Brauner [Wed, 4 Dec 2019 12:26:54 +0000 (13:26 +0100)] 
cgroups: improve container cgroup attaching

The current attach.c codepath which handles moving the attaching process into
the container's cgroups allocates a whole new struct cgroup_ops and goes
through the trouble of reparsing the whole cgroup layout.
That's costly and wasteful. My plan has always been to move this into the
command api by getting fds for attaching back but but it's not worth going
through that hazzle for non-unified hosts. On pure unified hosts however -
being the future - we can just attach through a single fd so there's no need to
allocate and setup struct cgroup_ops.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agolxc: switch to SPDX
Christian Brauner [Tue, 3 Dec 2019 21:04:14 +0000 (22:04 +0100)] 
lxc: switch to SPDX

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocommands: use logging return helpers
Christian Brauner [Wed, 4 Dec 2019 12:26:23 +0000 (13:26 +0100)] 
commands: use logging return helpers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoRevert "cgroups/freezer: fix and improve cgroup2 freezer implementation"
Christian Brauner [Wed, 4 Dec 2019 12:44:22 +0000 (13:44 +0100)] 
Revert "cgroups/freezer: fix and improve cgroup2 freezer implementation"

This reverts commit ecaf0c7bfc1baee74ff38dbdbc65bf4bec2361d4. I somehow
accidently did a double-backport.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgfsng: rework cgroup2 attach
Christian Brauner [Wed, 4 Dec 2019 00:39:20 +0000 (01:39 +0100)] 
cgfsng: rework cgroup2 attach

On pure unified systemd we can use a single file descriptor to interact with
the cgroup filesystem. Add a method to retrieve it and as a start use it in our
unified attach codepath.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/devices: do not log error when bpf device feature is not available
Christian Brauner [Tue, 3 Dec 2019 23:55:42 +0000 (00:55 +0100)] 
cgroups/devices: do not log error when bpf device feature is not available

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agofreezer: cleanup
Christian Brauner [Tue, 3 Dec 2019 16:33:11 +0000 (17:33 +0100)] 
freezer: cleanup

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/freezer: fix and improve cgroup2 freezer implementation
Christian Brauner [Tue, 3 Dec 2019 01:23:34 +0000 (02:23 +0100)] 
cgroups/freezer: fix and improve cgroup2 freezer implementation

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoconf: fix memory leak for set config rootfs options
dongxinhua [Thu, 21 Nov 2019 14:20:20 +0000 (22:20 +0800)] 
conf: fix memory leak for set config rootfs options

Signed-off-by: dongxinhua <dongxinhua@huawei.com>
5 years agotree-wide: fix wrong copy-paste for licenses
Christian Brauner [Mon, 11 Feb 2019 15:34:54 +0000 (16:34 +0100)] 
tree-wide: fix wrong copy-paste for licenses

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/freezer: fix and improve cgroup2 freezer implementation
Christian Brauner [Tue, 3 Dec 2019 01:23:34 +0000 (02:23 +0100)] 
cgroups/freezer: fix and improve cgroup2 freezer implementation

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups: add DEFAULT_MOUNTPOINT #define
Christian Brauner [Tue, 3 Dec 2019 00:24:55 +0000 (01:24 +0100)] 
cgroups: add DEFAULT_MOUNTPOINT #define

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agostart: remove monitor_signal_pdeath codepath
Christian Brauner [Mon, 2 Dec 2019 13:13:02 +0000 (14:13 +0100)] 
start: remove monitor_signal_pdeath codepath

This causes compilation failures due to a bad cherry-pick.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/devices: use dedicated enums
Christian Brauner [Sun, 1 Dec 2019 23:50:06 +0000 (00:50 +0100)] 
cgroups/devices: use dedicated enums

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/devices: introduce ebpf device cgroup global rule types
Christian Brauner [Sun, 1 Dec 2019 18:39:48 +0000 (19:39 +0100)] 
cgroups/devices: introduce ebpf device cgroup global rule types

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/devices: handle NULL
Christian Brauner [Sun, 1 Dec 2019 17:25:00 +0000 (18:25 +0100)] 
cgroups/devices: handle NULL

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoconfigure: enable -Wunused-but-set-variable
Christian Brauner [Sun, 1 Dec 2019 16:04:43 +0000 (17:04 +0100)] 
configure: enable -Wunused-but-set-variable

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: implement cgroup2 device controller live update
Christian Brauner [Sat, 30 Nov 2019 18:33:19 +0000 (19:33 +0100)] 
cgroups/cgfsng: implement cgroup2 device controller live update

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoconf: record cgroup2 devices in parsed format
Christian Brauner [Sat, 30 Nov 2019 15:05:44 +0000 (16:05 +0100)] 
conf: record cgroup2 devices in parsed format

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups/cgfsng: "atomically" replace bpf device programs
Christian Brauner [Sat, 30 Nov 2019 14:21:00 +0000 (15:21 +0100)] 
cgroups/cgfsng: "atomically" replace bpf device programs

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agomacro: remove unused macros
Christian Brauner [Sat, 30 Nov 2019 14:00:29 +0000 (15:00 +0100)] 
macro: remove unused macros

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups: add cgroup2 device controller support
Christian Brauner [Thu, 28 Nov 2019 15:22:36 +0000 (16:22 +0100)] 
cgroups: add cgroup2 device controller support

Add a bpf-based device controller implementation.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgfsng: return attach fail if container stopped
LiFeng [Wed, 27 Nov 2019 08:59:23 +0000 (03:59 -0500)] 
cgfsng: return attach fail if container stopped

Signed-off-by: LiFeng <lifeng68@huawei.com>
5 years agofix wrong order of bridge/nic in error message
Balázs Póka [Wed, 20 Nov 2019 19:57:28 +0000 (20:57 +0100)] 
fix wrong order of bridge/nic in error message

Signed-off-by: Balázs Póka <poka@idata.hu>
5 years agoTypo in a comment
Rachid Koucha [Wed, 20 Nov 2019 12:03:47 +0000 (13:03 +0100)] 
Typo in a comment

"above" was used instead of "below"

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
5 years agotests: use /dev/loop-control instead of /dev/network_latency
Christian Brauner [Mon, 18 Nov 2019 14:08:22 +0000 (15:08 +0100)] 
tests: use /dev/loop-control instead of /dev/network_latency

BugLink: https://bugs.launchpad.net/bugs/1848587
The latter device has been removed apparently.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoconfigure.ac: fix build on toolchain without SSP
Fabrice Fontaine [Mon, 11 Nov 2019 21:55:36 +0000 (22:55 +0100)] 
configure.ac: fix build on toolchain without SSP

Commit 3b5a0eebd4d2efdaa03c6fb11950abfcf081fab8 reverted
3aa7271157d3c815a4426c1f8eaea2f3b6dafa6a resulting in lxc being unable
to be built on toolchain without SSP support

Fixes:
 - http://autobuild.buildroot.org/results/57945f54ffbc5c8764b6891a4516c4907e56ab97

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
5 years agoUpdate cgroup.h
Aaditya Murthy [Sat, 9 Nov 2019 18:17:08 +0000 (12:17 -0600)] 
Update cgroup.h

Fixed the documentation to say that cgroupv2 uses a unified hierarchy
Signed-off-by: Aaditya Murthy <amurthy123@utexas.edu>
5 years agoterminal: prevent returning invalid pointer
Christian Brauner [Wed, 6 Nov 2019 13:08:55 +0000 (14:08 +0100)] 
terminal: prevent returning invalid pointer

Closes: https://github.com/lxc/lxd/issues/6408
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoterminal: make lxc_terminal_signal_fini() static
Christian Brauner [Wed, 6 Nov 2019 13:03:43 +0000 (14:03 +0100)] 
terminal: make lxc_terminal_signal_fini() static

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agolxc-usernsexec: support easily mapping own uid
Serge Hallyn [Fri, 1 Nov 2019 05:34:02 +0000 (00:34 -0500)] 
lxc-usernsexec: support easily mapping own uid

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
5 years agotests: add tests making sure the exit code is appropriate.
Florian Margaine [Tue, 29 Oct 2019 09:53:17 +0000 (10:53 +0100)] 
tests: add tests making sure the exit code is appropriate.

lxc2 broke this feature for lxc-execute, and lxc3 broke it for
lxc-attach. This adds a test making sure we don't do the same mistake
a third time.

Signed-off-by: Florian Margaine <florian@platform.sh>
5 years agoterminal: return NULL on error in terminal_signal_init
Wolfgang Bumiller [Tue, 29 Oct 2019 07:42:59 +0000 (08:42 +0100)] 
terminal: return NULL on error in terminal_signal_init

Callers expect a NULL on error, and with PR #3171 marking
the pointer as __do_free, we now return a pointer to freed
memory here otherwise.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
5 years agoterminal: prevent memory leak for lxc_terminal_state
Christian Brauner [Fri, 25 Oct 2019 09:45:55 +0000 (11:45 +0200)] 
terminal: prevent memory leak for lxc_terminal_state

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agosyscall_wrappers: rename internal memfd_create to memfd_create_lxc
Patrick Havelange [Tue, 22 Oct 2019 10:29:54 +0000 (12:29 +0200)] 
syscall_wrappers: rename internal memfd_create to memfd_create_lxc

In case the internal memfd_create has to be used, make sure we don't
clash with the already existing memfd_create function from glibc.

This can happen if this glibc function is a stub. In this case, at
./configure time, the test for this function will return false, however
the declaration of that function is still available. This leads to
compilation errors.

Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
5 years agolxc/tools/lxc/destroy: Restores error message on container destroy
Thomas Parrott [Mon, 14 Oct 2019 09:10:21 +0000 (10:10 +0100)] 
lxc/tools/lxc/destroy: Restores error message on container destroy

Partially reverts 65b92ea5fcab559fd21be2685bd2f15ef6d33532 so that trying to destroy a non-existent container gives an error message.

Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
5 years agoUpdate lxc.containers.conf(5) in Japanese
KATOH Yasufumi [Sat, 12 Oct 2019 16:39:52 +0000 (01:39 +0900)] 
Update lxc.containers.conf(5) in Japanese

Update for commit 767bd70

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
5 years agoBad sgml/man translation
Rachid Koucha [Sat, 12 Oct 2019 11:05:50 +0000 (13:05 +0200)] 
Bad sgml/man translation

When calling "man lxc.container.conf", an internal "man" keyword is displayed :

$ man lxc.container.conf
[...]
lxc.mount.entry
              Specify a mount point corresponding to a line in the fstab format.  Moreover lxc supports mount  propagation,  such  as
              rslave  or  rprivate, and adds three additional mount options.  optional don't fail if mount does not work.  create=dir
              or create=file to create dir (or file) when the point will be mounted.  relative source path is taken to be relative to
              the mounted container root. For instance,

dev/null proc/kcore none bind,relative 0 0
              .fi     <-----------------------------------UNEXPECTED KEYWORD !!!!

The problem seems to come from the missing blanks before "dev/null proc/kcore none bind,relative 0 0"

Moreover, for homogeneity purposes, it is better to use the "programlisting" tag used in the rest of the text instead of  "screen".

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
5 years agoAdd more info about lxc.start.order in Japanese man
KATOH Yasufumi [Fri, 11 Oct 2019 07:06:20 +0000 (16:06 +0900)] 
Add more info about lxc.start.order in Japanese man

Update for commit 0684250

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
5 years agolxc-destroy: send successful output messages to log info instead of error.
Caio B. Silva [Wed, 9 Oct 2019 19:00:58 +0000 (16:00 -0300)] 
lxc-destroy: send successful output messages to log info instead of error.

Signed-off-by: Caio B. Silva <caioboffo@gmail.com>
5 years agodoc: Add more info about 'lxc.start.order'
Lukas Jelinek [Wed, 9 Oct 2019 10:15:48 +0000 (12:15 +0200)] 
doc: Add more info about 'lxc.start.order'

Signed-off-by: Lukas Jelinek <lukas.jelinek@nic.cz>
5 years agoupdate obsolete functions
Caio B. Silva [Tue, 1 Oct 2019 14:36:05 +0000 (11:36 -0300)] 
update obsolete functions

Signed-off-by: Caio B. Silva <caioboffo@gmail.com>
5 years agostart: handle setting pdeath signal in new pidns
Christian Brauner [Sat, 13 Apr 2019 14:41:30 +0000 (16:41 +0200)] 
start: handle setting pdeath signal in new pidns

In the usual case the child runs in a separate pid namespace. So far we haven't
been able to reliably set the pdeath signal. When we set the pdeath signal we
need to verify that we haven't lost a race whereby we have been orphaned and
though we have set a pdeath signal it won't help us since, well, the parent is
dead.
We were able to correctly handle this case when we were in the same pidns since
getppid() will return a valid pid. When we are in a separate pidns 0 will be
returned since the parent doesn't exist in our pidns.
A while back, while Jann and I were discussing other things he came up with a
nifty idea: simply pass an fd for the parent's status file and check the
"State:" field. This is the implementation of that idea.

Suggested-by: Jann Horn <jann@thejh.net>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agostart: pidfds obviously start - like any fd - at 0
Christian Brauner [Fri, 4 Oct 2019 08:31:41 +0000 (10:31 +0200)] 
start: pidfds obviously start - like any fd - at 0

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoFix lxc-update-config in network.address
Alban VIDAL [Thu, 3 Oct 2019 16:32:47 +0000 (18:32 +0200)] 
Fix lxc-update-config in network.address

Signed-off-by: Alban VIDAL <zordhak@debian.org>
5 years agoallow users to configure the option --enable-feature or --with-package, if an option...
Caio B. Silva [Mon, 30 Sep 2019 12:25:00 +0000 (09:25 -0300)] 
allow users to configure the option --enable-feature or --with-package, if an option is given run shell commands action-if-given

Signed-off-by: Caio B. Silva <caioboffo@gmail.com>
5 years agoSet minimun autoconf version to 2.69 and change obsolete function AC_HELP_STRING...
Caio B. Silva [Fri, 27 Sep 2019 16:35:43 +0000 (13:35 -0300)] 
Set minimun autoconf version to 2.69 and change obsolete function AC_HELP_STRING for AS_HELP_STRING

Signed-off-by: Caio B. Silva <caioboffo@gmail.com>
5 years agodoc: Add Japanese pam_cgfs(8) man page
KATOH Yasufumi [Thu, 19 Sep 2019 16:15:12 +0000 (01:15 +0900)] 
doc: Add Japanese pam_cgfs(8) man page

* translate pam_cgfs(8)
* support --{enable,disable}-{commands,tools} in doc/ja

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
5 years agodoc: add man page for pam_cgfs
Venkata Harshavardhan Reddy Allu [Wed, 18 Sep 2019 13:08:23 +0000 (18:38 +0530)] 
doc: add man page for pam_cgfs

Signed-off-by: Venkata Harshavardhan Reddy Allu <venkataharshavardhan_ven@srmuniv.edu.in>
5 years agoEnsures OpenSSL compatibility with older versions of EVP API.
Caio B. Silva [Mon, 16 Sep 2019 17:22:33 +0000 (14:22 -0300)] 
Ensures OpenSSL compatibility with older versions of EVP API.

Signed-off-by: Caio B. Silva <caioboffo@gmail.com>
5 years agoutils: Copying source filename to avoid missing info.
Julio Faracco [Thu, 5 Sep 2019 04:43:21 +0000 (01:43 -0300)] 
utils: Copying source filename to avoid missing info.

Some applications use information from LOOP_GET_STATUS64. The file
associated with loop device is pointed inside structure field
`lo_file_name`. The current code is setting up a loop device without
this information. A legacy example of code checking this is cryptsetup:

    static char *_ioctl_backing_file(const char *loop)
    {
        struct loop_info64 lo64 = {0};
        int loop_fd;

        loop_fd = open(loop, O_RDONLY);
        if (loop_fd < 0)
            return NULL;

        if (ioctl(loop_fd, LOOP_GET_STATUS64, &lo64) < 0) {
            close(loop_fd);
            return NULL;
        }

        lo64.lo_file_name[LO_NAME_SIZE-2] = '*';
        lo64.lo_file_name[LO_NAME_SIZE-1] = 0;

        close(loop_fd);
        return strdup((char*)lo64.lo_file_name);
    }

It will return an empty string because lo_file_name was not set.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
5 years agocgroups: unify cgfsng_{un}freeze()
Christian Brauner [Mon, 2 Sep 2019 21:51:19 +0000 (23:51 +0200)] 
cgroups: unify cgfsng_{un}freeze()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups: initialize cgroup root directory - encore
Christian Brauner [Thu, 29 Aug 2019 12:05:17 +0000 (14:05 +0200)] 
cgroups: initialize cgroup root directory - encore

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups: check for empty cgroups on freeze/unfreeze
Christian Brauner [Thu, 29 Aug 2019 11:56:56 +0000 (13:56 +0200)] 
cgroups: check for empty cgroups on freeze/unfreeze

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups: initialize cgroup root directory
Christian Brauner [Wed, 28 Aug 2019 18:33:39 +0000 (20:33 +0200)] 
cgroups: initialize cgroup root directory

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years ago[aa-profile] Deny access to /proc/acpi/**
Pierre-Elliott Bécue [Sat, 10 Aug 2019 20:07:42 +0000 (22:07 +0200)] 
[aa-profile] Deny access to /proc/acpi/**

Signed-off-by: Pierre-Elliott Bécue <becue@crans.org>