]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
6 years agoparse: handle \r 2839/head
Christian Brauner [Sun, 10 Feb 2019 22:55:17 +0000 (23:55 +0100)] 
parse: handle \r

Closes #2838.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2836 from brauner/2019-02-10/fix_cgfsng_driver
Wolfgang Bumiller [Sun, 10 Feb 2019 10:34:41 +0000 (11:34 +0100)] 
Merge pull request #2836 from brauner/2019-02-10/fix_cgfsng_driver

cgroup: bugfixes

6 years agocgfsng: fix cgroup creation 2836/head
Christian Brauner [Sun, 10 Feb 2019 09:53:06 +0000 (10:53 +0100)] 
cgfsng: fix cgroup creation

When cgroup creation failed we reset container_cgroup to NULL to avoid
issues with __cleanup__. Fix that logic:
- add steal_ptr() based on take_ptr()
- move stealing the pointer out of the loop

lxc ctImport 20190210050705.858 DEBUG    network - network.c:instantiate_veth:202 - Instantiated veth "vethGQMH7I/vethSPXNL3", index is "272"
lxc ctImport 20190210050705.858 ERROR    cgfsng - cgroups/cgfsng.c:mkdir_eexist_on_last:1262 - File exists - Failed to create directory "/sys/fs/cgroup/unified//lxc.payload/ctImport-0"
lxc ctImport 20190210050705.858 ERROR    cgfsng - cgroups/cgfsng.c:container_create_path_for_hierarchy:1302 - Failed to create cgroup "/sys/fs/cgroup/unified//lxc.payload/ctImport-0"
lxc ctImport 20190210050705.858 ERROR    cgfsng - cgroups/cgfsng.c:cgfsng_payload_create:1431 - Failed to create cgroup "/sys/fs/cgroup/unified//lxc.payload/ctImport-0"
lxc ctImport 20190210050705.858 INFO     cgfsng - cgroups/cgfsng.c:cgfsng_payload_create:1441 - The container uses "lxc.payload/ctImport-0" as cgroup
lxc ctImport 20190210050705.858 ERROR    cgfsng - cgroups/cgfsng.c:mkdir_eexist_on_last:1262 - File exists - Failed to create directory "/sys/fs/cgroup/unified/"
lxc ctImport 20190210050705.858 ERROR    cgfsng - cgroups/cgfsng.c:container_create_path_for_hierarchy:1302 - Failed to create cgroup "/sys/fs/cgroup/unified/"
lxc ctImport 20190210050705.858 ERROR    cgfsng - cgroups/cgfsng.c:cgfsng_payload_create:1431 - Failed to create cgroup "/sys/fs/cgroup/unified/"
lxc ctImport 20190210050705.858 INFO     cgfsng - cgroups/cgfsng.c:cgfsng_payload_create:1441 - The container uses "(null)" as cgroup

Fixes: d97919abf22 ("cgroups: partially switch to cleanup macros")
Reported-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgfsng: coding style for cgfsng_payload_create()
Christian Brauner [Sun, 10 Feb 2019 09:52:45 +0000 (10:52 +0100)] 
cgfsng: coding style for cgfsng_payload_create()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgfsng: coding style for cgfsng_monitor_create()
Christian Brauner [Sun, 10 Feb 2019 09:51:43 +0000 (10:51 +0100)] 
cgfsng: coding style for cgfsng_monitor_create()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2832 from brauner/2019-02-08/add_coccinelle
Stéphane Graber [Sat, 9 Feb 2019 21:58:36 +0000 (16:58 -0500)] 
Merge pull request #2832 from brauner/2019-02-08/add_coccinelle

coccinelle support

6 years agoMerge pull request #2829 from brauner/2019-02-08/capabilities
Stéphane Graber [Sat, 9 Feb 2019 21:57:01 +0000 (16:57 -0500)] 
Merge pull request #2829 from brauner/2019-02-08/capabilities

caps: check uid and euid

6 years agococcinelle: use standard exit identifiers 2832/head
Christian Brauner [Sat, 9 Feb 2019 10:23:54 +0000 (11:23 +0100)] 
coccinelle: use standard exit identifiers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agococcinelle: s/while({1,true})/for(;;)/
Christian Brauner [Fri, 8 Feb 2019 22:57:06 +0000 (23:57 +0100)] 
coccinelle: s/while({1,true})/for(;;)/

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agococcinelle: add coccinelle support
Christian Brauner [Fri, 8 Feb 2019 22:56:51 +0000 (23:56 +0100)] 
coccinelle: add coccinelle support

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2833 from brauner/2019-02-09/bugfixes
Christian Brauner [Sat, 9 Feb 2019 10:03:42 +0000 (11:03 +0100)] 
Merge pull request #2833 from brauner/2019-02-09/bugfixes

bugfixes

6 years agolxc-init: exit with error on wait failure 2833/head
Christian Brauner [Sat, 9 Feb 2019 00:35:44 +0000 (01:35 +0100)] 
lxc-init: exit with error on wait failure

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: prevent signed-issues
Christian Brauner [Sat, 9 Feb 2019 00:33:18 +0000 (01:33 +0100)] 
start: prevent signed-issues

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgfsng: remove unnecessary check
Christian Brauner [Sat, 9 Feb 2019 00:31:52 +0000 (01:31 +0100)] 
cgfsng: remove unnecessary check

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocommands: remove unnecessary check
Christian Brauner [Sat, 9 Feb 2019 00:28:52 +0000 (01:28 +0100)] 
commands: remove unnecessary check

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2827 from brauner/2019-02-07/auto_cleanup
Serge Hallyn [Fri, 8 Feb 2019 21:57:37 +0000 (15:57 -0600)] 
Merge pull request #2827 from brauner/2019-02-07/auto_cleanup

cgroups: partially switch to cleanup macros

6 years agocaps: check uid and euid 2829/head
Christian Brauner [Fri, 8 Feb 2019 14:11:46 +0000 (15:11 +0100)] 
caps: check uid and euid

When we are running inside of a user namespace getuid() will return a
non-zero uid. So let's check euid as well to make sure we correctly drop
capabilities

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgroups: partially switch to cleanup macros 2827/head
Christian Brauner [Thu, 7 Feb 2019 08:15:09 +0000 (09:15 +0100)] 
cgroups: partially switch to cleanup macros

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2825 from brauner/lxc/master
Christian Brauner [Wed, 6 Feb 2019 11:24:48 +0000 (12:24 +0100)] 
Merge pull request #2825 from brauner/lxc/master

README: add LGTM

6 years agoREADME: add LGTM 2825/head
Christian Brauner [Wed, 6 Feb 2019 11:23:17 +0000 (12:23 +0100)] 
README: add LGTM

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2821 from brauner/2019-02-05/remove_stack_allocation
Wolfgang Bumiller [Wed, 6 Feb 2019 11:10:48 +0000 (12:10 +0100)] 
Merge pull request #2821 from brauner/2019-02-05/remove_stack_allocation

tree-wide: wipe alloca() from the codebase

6 years agolxc-unshare: remove stack allocations 2821/head
Christian Brauner [Tue, 5 Feb 2019 06:47:18 +0000 (07:47 +0100)] 
lxc-unshare: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agooverlay: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:46:13 +0000 (07:46 +0100)] 
overlay: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agorbd: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:44:13 +0000 (07:44 +0100)] 
rbd: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agonbd: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:42:50 +0000 (07:42 +0100)] 
nbd: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolvm: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:39:51 +0000 (07:39 +0100)] 
lvm: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoloop: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:38:02 +0000 (07:38 +0100)] 
loop: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoterminal: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:26:19 +0000 (07:26 +0100)] 
terminal: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostring_utils: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:30:00 +0000 (07:30 +0100)] 
string_utils: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:32:21 +0000 (07:32 +0100)] 
storage: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:25:12 +0000 (07:25 +0100)] 
start: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agopam_cgfs: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:33:48 +0000 (07:33 +0100)] 
pam_cgfs: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agonetwork: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:27:29 +0000 (07:27 +0100)] 
network: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agonamespace: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:23:19 +0000 (07:23 +0100)] 
namespace: remove stack allocations

Switch to a static stack instead of allocating a new one. There's really
no point in doing all of the dance to get the current pagesize.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agomonitor: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:31:16 +0000 (07:31 +0100)] 
monitor: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxccontainer: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:19:56 +0000 (07:19 +0100)] 
lxccontainer: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconfile: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:12:17 +0000 (07:12 +0100)] 
confile: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:08:44 +0000 (07:08 +0100)] 
conf: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocommands_utils: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:06:02 +0000 (07:06 +0100)] 
commands_utils: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocommands: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:02:07 +0000 (07:02 +0100)] 
commands: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxc_user_nic: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:01:50 +0000 (07:01 +0100)] 
lxc_user_nic: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgroups: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:01:33 +0000 (07:01 +0100)] 
cgroups: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxcmntent: remove stack allocations
Christian Brauner [Tue, 5 Feb 2019 06:00:58 +0000 (07:00 +0100)] 
lxcmntent: remove stack allocations

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agomemory_utils: add memory_utils.h
Christian Brauner [Tue, 5 Feb 2019 05:51:55 +0000 (06:51 +0100)] 
memory_utils: add memory_utils.h

The header defines a simple wrapper for free() that can be used with
gcc's and clang's __attribute__((__cleanup__(<cleanup-fun>))) macro.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2824 from brauner/2019-02-05/compiler_based_hardening
Stéphane Graber [Tue, 5 Feb 2019 23:24:46 +0000 (18:24 -0500)] 
Merge pull request #2824 from brauner/2019-02-05/compiler_based_hardening

compiler: hardening

6 years agocompiler: -Wnested-externs hardening 2824/head
Christian Brauner [Tue, 5 Feb 2019 22:50:43 +0000 (23:50 +0100)] 
compiler: -Wnested-externs hardening

Warn if an extern declaration is encountered within a function.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Wdate-time hardening
Christian Brauner [Tue, 5 Feb 2019 22:49:48 +0000 (23:49 +0100)] 
compiler: -Wdate-time hardening

Warn when macros __TIME__, __DATE__ or __TIMESTAMP__ are encountered as
they might prevent bit-wise-identical reproducible compilations.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Werror=shift-overflow=2 hardening
Christian Brauner [Tue, 5 Feb 2019 22:48:32 +0000 (23:48 +0100)] 
compiler: -Werror=shift-overflow=2 hardening

Warn about left shift overflows. This warning is enabled by default in
C99 and C++11 modes (and newer).

-Wshift-overflow=2
This warning level also warns about left-shifting 1 into the sign bit,
unless C++14 mode (or newer) is active.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Werror=shift-count-overflow hardening
Christian Brauner [Tue, 5 Feb 2019 22:47:31 +0000 (23:47 +0100)] 
compiler: -Werror=shift-count-overflow hardening

Warn if shift count >= width of type.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: fix -fstack-protector-strong
Christian Brauner [Tue, 5 Feb 2019 22:44:20 +0000 (23:44 +0100)] 
compiler: fix -fstack-protector-strong

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -fdiagnostics-show-option
Christian Brauner [Tue, 5 Feb 2019 22:25:19 +0000 (23:25 +0100)] 
compiler: -fdiagnostics-show-option

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Werror=overflow hardening
Christian Brauner [Tue, 5 Feb 2019 22:21:43 +0000 (23:21 +0100)] 
compiler: -Werror=overflow hardening

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Wendif-labels hardening
Christian Brauner [Tue, 5 Feb 2019 22:15:05 +0000 (23:15 +0100)] 
compiler: -Wendif-labels hardening

Do not warn whenever an #else or an #endif are followed by text.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2823 from brauner/2019-02-05/compiler_based_hardening
Stéphane Graber [Tue, 5 Feb 2019 21:55:36 +0000 (16:55 -0500)] 
Merge pull request #2823 from brauner/2019-02-05/compiler_based_hardening

compiler: hardening

6 years agocompiler: -Wshadow hardening 2823/head
Christian Brauner [Tue, 5 Feb 2019 19:56:08 +0000 (20:56 +0100)] 
compiler: -Wshadow hardening

Warn whenever a local variable or type declaration shadows another
variable, parameter, type, class member (in C++), or instance variable
(in Objective-C) or whenever a built-in function is shadowed.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: set -Wimplicit-fallthrough to 5
Christian Brauner [Tue, 5 Feb 2019 19:54:33 +0000 (20:54 +0100)] 
compiler: set -Wimplicit-fallthrough to 5

-Wimplicit-fallthrough=5 doesn’t recognize any comments as fallthrough
comments, only attributes disable the warning.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Wformat=2 hardening
Christian Brauner [Tue, 5 Feb 2019 19:51:50 +0000 (20:51 +0100)] 
compiler: -Wformat=2 hardening

Enable -Wformat plus additional format checks. Currently equivalent to
-Wformat -Wformat-nonliteral -Wformat-security -Wformat-y2k.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Werror=incompatible-pointer-types
Christian Brauner [Tue, 5 Feb 2019 19:49:59 +0000 (20:49 +0100)] 
compiler: -Werror=incompatible-pointer-types

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Werror=return-type hardening
Christian Brauner [Tue, 5 Feb 2019 19:48:45 +0000 (20:48 +0100)] 
compiler: -Werror=return-type hardening

Warn whenever a function is defined with a return type that defaults to
int. Also warn about any return statement with no return value in a
function whose return type is not void (falling off the end of the
function body is considered returning without a value).

For C only, warn about a return statement with an expression in a
function whose return type is void, unless the expression type is also
void. As a GNU extension, the latter case is accepted without a warning
unless -Wpedantic is used.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Wsuggest-attribute=noreturn hardening
Christian Brauner [Tue, 5 Feb 2019 19:44:57 +0000 (20:44 +0100)] 
compiler: -Wsuggest-attribute=noreturn hardening

Warn about functions that might be candidates for attributes pure, const
or noreturn or malloc.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Wfloat-equal hardening
Christian Brauner [Tue, 5 Feb 2019 19:43:52 +0000 (20:43 +0100)] 
compiler: -Wfloat-equal hardening

Warn if floating-point values are used in equality comparisons.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Winit-self hardening
Christian Brauner [Tue, 5 Feb 2019 19:43:00 +0000 (20:43 +0100)] 
compiler: -Winit-self hardening

Warn about uninitialized variables that are initialized with themselves.
Note this option can only be used with the -Wuninitialized option.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Wold-style-definition hardening
Christian Brauner [Tue, 5 Feb 2019 19:33:40 +0000 (20:33 +0100)] 
compiler: -Wold-style-definition hardening

Warn if an old-style function definition is used. A warning is given
even if there is a previous prototype.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Wmissing-include-dirs hardening
Christian Brauner [Tue, 5 Feb 2019 19:31:20 +0000 (20:31 +0100)] 
compiler: -Wmissing-include-dirs hardening

Warn if a user-supplied include directory does not exist.

This already surfaced a bug that is fixed by this commit.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: -Wlogical-op hardening
Christian Brauner [Tue, 5 Feb 2019 19:29:21 +0000 (20:29 +0100)] 
compiler: -Wlogical-op hardening

Warn about suspicious uses of logical operators in expressions.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2822 from tomponline/tp-rpmspec
Stéphane Graber [Tue, 5 Feb 2019 17:16:41 +0000 (18:16 +0100)] 
Merge pull request #2822 from tomponline/tp-rpmspec

fix rpm packaging for bash completion directory.

6 years agofix rpm packaging for bash completion directory. 2822/head
tomponline [Tue, 5 Feb 2019 17:10:20 +0000 (17:10 +0000)] 
fix rpm packaging for bash completion directory.

Closed #1825

Signed-off-by: tomponline <tomp@tomp.uk>
6 years agoMerge pull request #2820 from brauner/2019-01-31/cgfsng_sys/kernel/cgroup/delegate
Stéphane Graber [Fri, 1 Feb 2019 11:38:14 +0000 (12:38 +0100)] 
Merge pull request #2820 from brauner/2019-01-31/cgfsng_sys/kernel/cgroup/delegate

cgroups: use of /sys/kernel/cgroup/delegate file

6 years agoMerge pull request #2787 from Blub/2019-01-17/revert-sys-double-bindmount-cleanup
Stéphane Graber [Fri, 1 Feb 2019 11:37:38 +0000 (12:37 +0100)] 
Merge pull request #2787 from Blub/2019-01-17/revert-sys-double-bindmount-cleanup

Revert "conf: remove extra MS_BIND with sysfs:mixed"

6 years agocgroups: use of /sys/kernel/cgroup/delegate file 2820/head
Christian Brauner [Fri, 1 Feb 2019 09:57:49 +0000 (10:57 +0100)] 
cgroups: use of /sys/kernel/cgroup/delegate file

This file contains the files one needs to chown to successfully delegate
cgroup files to unprivileged users.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2806 from brauner/2019-01-27/bugfixes
Christian Brauner [Thu, 31 Jan 2019 10:38:04 +0000 (11:38 +0100)] 
Merge pull request #2806 from brauner/2019-01-27/bugfixes

freezer: non-functional changes

6 years agofreezer: non-functional changes 2806/head
Christian Brauner [Sun, 27 Jan 2019 01:04:21 +0000 (02:04 +0100)] 
freezer: non-functional changes

Fix the coding style in a few files.

Fixes: db1228b35f3e ("Avoid hardcoded string length")
Fixes: 71fc9c046816 ("Avoid risk of "too far memory read"")
Fixes: 2341916a0367 ("Avoid double lxc-freeze/unfreeze")
Fixes: 9eb9ce3e4778 ("Update freezer.c")
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2817 from Rachid-Koucha/patch-5
Christian Brauner [Tue, 29 Jan 2019 12:06:22 +0000 (13:06 +0100)] 
Merge pull request #2817 from Rachid-Koucha/patch-5

More accurate error msg for template file

6 years agoMore accurate error msg for template file 2817/head
Rachid Koucha [Tue, 29 Jan 2019 11:20:46 +0000 (12:20 +0100)] 
More accurate error msg for template file

When calling lxc-create, if the template exists but is not executable, we end with the following error messages which make believe that the template file does not exist when it is merely a execute access problem:

lxc-create: ctn00: utils.c: get_template_path: 918 No such file or directory - bad template: /.../lxc-busybox
lxc-create: ctn00: lxccontainer.c: do_lxcapi_create: 1786 Unknown template "/.../lxc-busybox"
lxc-create: ctn00: tools/lxc_create.c: main: 327 Failed to create container ctn00

Actually internally the errno is lost as the following code triggers a useless access to (strace output):

access("/.../lxc-busybox", X_OK) = -1 ENOENT (No such file or directory)

With the above fix, we get a more explicit error message when the template file is missing the "execute" bit:

lxc-create: bbc: utils.c: get_template_path: 917 Permission denied - Bad template pathname: /tmp/azerty
lxc-create: bbc: lxccontainer.c: do_lxcapi_create: 1816 Unknown template "/tmp/azerty"
lxc-create: bbc: tools/lxc_create.c: main: 331 Failed to create container bbc

With the above fix, we get a more explicit error message when the pathname of the template file is incorrect:

lxc-create: bbc: utils.c: get_template_path: 917 No such file or directory - Bad template pathname: /tmp/qwerty
lxc-create: bbc: lxccontainer.c: do_lxcapi_create: 1816 Unknown template "/tmp/qwerty"
lxc-create: bbc: tools/lxc_create.c: main: 331 Failed to create container bbc

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
6 years agoMerge pull request #2807 from brauner/2019-01-27/mount_entries
Stéphane Graber [Mon, 28 Jan 2019 22:24:01 +0000 (17:24 -0500)] 
Merge pull request #2807 from brauner/2019-01-27/mount_entries

conf: check for successful mount entry parse

6 years agoMerge pull request #2814 from tenforward/japanese
Christian Brauner [Mon, 28 Jan 2019 10:54:45 +0000 (11:54 +0100)] 
Merge pull request #2814 from tenforward/japanese

doc: Add lxc.seccomp.allow_nesting to Japanese lxc.container.conf(5)

6 years agodoc: Add lxc.seccomp.allow_nesting to Japanese lxc.container.conf(5) 2814/head
KATOH Yasufumi [Mon, 28 Jan 2019 10:01:40 +0000 (19:01 +0900)] 
doc: Add lxc.seccomp.allow_nesting to Japanese lxc.container.conf(5)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
6 years agoMerge pull request #2813 from brauner/2019-01-27/bugfixes_2
Serge Hallyn [Mon, 28 Jan 2019 03:41:49 +0000 (21:41 -0600)] 
Merge pull request #2813 from brauner/2019-01-27/bugfixes_2

compiler: remove deprecated and unneeded header

6 years agoprlimit: remove deprecated and unneeded header 2813/head
Christian Brauner [Sun, 27 Jan 2019 22:05:47 +0000 (23:05 +0100)] 
prlimit: remove deprecated and unneeded header

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: remove deprecated and unneeded header
Christian Brauner [Sun, 27 Jan 2019 22:02:49 +0000 (23:02 +0100)] 
compiler: remove deprecated and unneeded header

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2812 from Rachid-Koucha/patch-7
Christian Brauner [Sun, 27 Jan 2019 13:03:40 +0000 (14:03 +0100)] 
Merge pull request #2812 from Rachid-Koucha/patch-7

/etc/resolv.conf grows indefinitely

6 years ago/etc/resolv.conf grows indefinitely 2812/head
Rachid Koucha [Sun, 27 Jan 2019 12:46:48 +0000 (13:46 +0100)] 
/etc/resolv.conf grows indefinitely

This file grows indefinitely : upon each DHCP lease renew,
the "nameserver ..dns..." line is added at the end of the file.
Make a "grep" in the file to make sure that the same line
does not already exist.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
6 years agoconf: append 0 0 to nesting helpers mount entries 2807/head
Christian Brauner [Sun, 27 Jan 2019 12:14:24 +0000 (13:14 +0100)] 
conf: append 0 0 to nesting helpers mount entries

Otherwise musl's getmntent_r() parser will fail.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2811 from Rachid-Koucha/patch-6
Christian Brauner [Sun, 27 Jan 2019 12:07:03 +0000 (13:07 +0100)] 
Merge pull request #2811 from Rachid-Koucha/patch-6

Create /var/run

6 years agoCreate /var/run 2811/head
Rachid Koucha [Sun, 27 Jan 2019 11:23:58 +0000 (12:23 +0100)] 
Create /var/run

Some programs like "who" need this directory
to work (this permits the of /var/run/utmp file).

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
6 years agoMerge pull request #2810 from Rachid-Koucha/patch-6
Christian Brauner [Sun, 27 Jan 2019 11:11:47 +0000 (12:11 +0100)] 
Merge pull request #2810 from Rachid-Koucha/patch-6

Use BUSYBOX_EXE variable in configure_busybox()

6 years agoUse BUSYBOX_EXE variable in configure_busybox() 2810/head
Rachid Koucha [Sun, 27 Jan 2019 10:51:57 +0000 (11:51 +0100)] 
Use BUSYBOX_EXE variable in configure_busybox()

As "which busybox" is stored in BUSYBOX_EXE
global variable at startup, use it wherever it is
needed.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
6 years agoconf: check for successful mount entry parse
Christian Brauner [Sun, 27 Jan 2019 01:22:43 +0000 (02:22 +0100)] 
conf: check for successful mount entry parse

Since liblxc is completely in control of the mount entry file we should
only consider a parse successful when EOF is reached.

Closes #2798.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2809 from Rachid-Koucha/patch-6
Christian Brauner [Sun, 27 Jan 2019 09:14:26 +0000 (10:14 +0100)] 
Merge pull request #2809 from Rachid-Koucha/patch-6

Installation of default.script for udhcpc

6 years agoInstallation of default.script for udhcpc 2809/head
Rachid Koucha [Sun, 27 Jan 2019 02:38:36 +0000 (03:38 +0100)] 
Installation of default.script for udhcpc

The busybox template installs default.script in /usr/share/udhcpc/.
But the pathname of "default.script" may vary from one busybox
build to another. As the pathname is displayed in udhcpc's help,
grab it from it.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
6 years agoMerge pull request #2744 from adamkasztenny/patch-1
Christian Brauner [Sun, 27 Jan 2019 00:56:23 +0000 (01:56 +0100)] 
Merge pull request #2744 from adamkasztenny/patch-1

Add template-options to help output

6 years agoMerge pull request #2804 from Rachid-Koucha/patch-4
Christian Brauner [Sun, 27 Jan 2019 00:46:25 +0000 (01:46 +0100)] 
Merge pull request #2804 from Rachid-Koucha/patch-4

Avoid hardcoded string length

6 years agoAvoid hardcoded string length 2804/head
Rachid Koucha [Sun, 27 Jan 2019 00:07:38 +0000 (01:07 +0100)] 
Avoid hardcoded string length

Use strlen() on "state" variable instead of harcoded
value 6.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
6 years agoMerge pull request #2803 from Rachid-Koucha/patch-4
Christian Brauner [Sat, 26 Jan 2019 23:43:32 +0000 (00:43 +0100)] 
Merge pull request #2803 from Rachid-Koucha/patch-4

Avoid risk of "too far memory read"

6 years agoMerge pull request #2802 from Rachid-Koucha/patch-3
Christian Brauner [Sat, 26 Jan 2019 23:26:00 +0000 (00:26 +0100)] 
Merge pull request #2802 from Rachid-Koucha/patch-3

Avoid double lxc-freeze/unfreeze

6 years agoAvoid risk of "too far memory read" 2803/head
Rachid Koucha [Sat, 26 Jan 2019 23:10:39 +0000 (00:10 +0100)] 
Avoid risk of "too far memory read"

As we call "lxc_add_state_client(fd, handler, (lxc_state_t *)req->data)"
which supposes that the last parameter is a table of MAX_STATE
entries when calling memcpy():
memcpy(newclient->states, states, sizeof(newclient->states))

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
6 years agoMerge pull request #2801 from Rachid-Koucha/patch-2
Christian Brauner [Sat, 26 Jan 2019 22:48:59 +0000 (23:48 +0100)] 
Merge pull request #2801 from Rachid-Koucha/patch-2

Update freezer.c

6 years agoAvoid double lxc-freeze/unfreeze 2802/head
Rachid Koucha [Sat, 26 Jan 2019 22:46:34 +0000 (23:46 +0100)] 
Avoid double lxc-freeze/unfreeze

If we call lxc-freeze multiple times for an already frozen container, LXC
triggers useless freezing by writing into the "freezer.state" cgroup file.
This is the same when we call lxc-unfreeze multiple times.
Checking the current state with a LXC_CMD_GET_STATE
(calling c->state) would permit to check if the container is FROZEN
or not.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
6 years agoUpdate freezer.c 2801/head
Rachid Koucha [Sat, 26 Jan 2019 22:27:07 +0000 (23:27 +0100)] 
Update freezer.c

Suppressed hard coded values for state and array's maximum index.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
6 years agoMerge pull request #2794 from brauner/2019-01-21/revert_seccomp_fuckup
Wolfgang Bumiller [Mon, 21 Jan 2019 14:33:05 +0000 (15:33 +0100)] 
Merge pull request #2794 from brauner/2019-01-21/revert_seccomp_fuckup

Revert "seccomp: add rules for specified architecture only"