Commit Graph

7917 Commits

Author SHA1 Message Date
Christian Brauner
bb9623e705
log: add CMD_SYSERROR()
Add a thread-safe and uniform way to retrieve errno values in programs that are
shipped as part of LXC but are not expected to have access to the logging
system.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-16 13:01:54 +02:00
Christian Brauner
7a8e91c1fc
Merge pull request #2534 from tcharding/checkpatch
Checkpatch
2018-08-16 10:40:10 +02:00
Christian Brauner
c5aca61506
Merge pull request #2532 from tcharding/unshare-err
usernsexec: Make err out vebose for unshare error
2018-08-16 09:16:10 +02:00
Tobin C. Harding
f0a86c6d1c cmd: Move assignment out of if statement
checkpatch.pl emits error

    ERROR: do not use assignment in if condition

Move assignment out of if statement.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
2018-08-16 17:06:20 +10:00
Tobin C. Harding
2db65c2187 cmd: Fix whitespace ERRORS
checkpatch.pl emits a bunch of warnings about various whitespace
issues.  Fix all these as a single patch since they are all whitespace
only changes.

Fix whitespace issues found by checkpatch.pl

Signed-off-by: Tobin C. Harding <me@tobin.cc>
2018-08-16 17:01:30 +10:00
Tobin C. Harding
3c84faa377 cmd: Do not initialise statics to 0
checkpatch.pl emits error

    ERROR: do not initialise statics to 0

Do not initialise statics to 0.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
2018-08-16 16:57:36 +10:00
Tobin C. Harding
27fdb6bec5 cmd: Correctly indent switch statement
checkpatch.pl emits error

    ERROR: do not use assignment in if condition

Correctly indent switch statement.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
2018-08-16 16:55:09 +10:00
Tobin C. Harding
ede912b440 usernsexec: Make err out vebose for unshare error
Currently if lxc-usernsexec is run on a kernel without user namespaces
enabled the error message is

	unshare: Invalid argument
	read pipe: Success

This error message 'Invalid argument' does not point at the root cause
of the error.  We can help the user out by giving a more detailed error
message and also not using perror() if errno==0.

Improve error message by
 - Printing unshare flags
 - Printing suggested cause of failure (user namespace not enabled)
 - Print error message with fprintf() if errno==0 (EOF)

Signed-off-by: Tobin C. Harding <me@tobin.cc>
2018-08-16 16:44:12 +10:00
Christian Brauner
3193354ce0
Merge pull request #2533 from tcharding/docs
doc: Fix minor grammatical errors
2018-08-16 07:37:07 +02:00
Tobin C. Harding
eb4225a047 doc: Fix minor grammatical errors
Current we have a few minor grammatical errors in the documentation for
lxc container configuration.

Fix minor grammatical errors.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
2018-08-16 15:28:31 +10:00
Stéphane Graber
1a1de30d21
Merge pull request #2531 from brauner/2018-08-16/minor_fixes
state: s/sleep()/nanosleep()/
2018-08-15 20:26:08 -04:00
Christian Brauner
746559f461
state: s/sleep()/nanosleep()/
sleep() is not thread-safe but nanosleep() is. Since no resources are allocated
in lxc_wait() it is safe to call nanosleep() without cancellation handlers.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-16 00:43:19 +02:00
Stéphane Graber
03eda56551
Merge pull request #2530 from brauner/2018-08-16/minor_fixes
lxccontainer: minor fixes
2018-08-15 18:35:17 -04:00
Christian Brauner
bafad46888
lxccontainer: minor fixes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-16 00:25:15 +02:00
Stéphane Graber
c43e9ced75
Merge pull request #2527 from brauner/2018-08-15/file_lock_fixes
lxccontainer: improve file locking
2018-08-14 23:23:24 -04:00
Christian Brauner
ecd8cb990c
lxclock: improve file locking
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-15 00:58:59 +02:00
Christian Brauner
d1bc8d484c
lxccontainer: improve file locking
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-15 00:37:05 +02:00
Stéphane Graber
27f39efa5d
Merge pull request #2526 from brauner/2018-08-14/fix_ongoing_create_check
lxccontainer: fix F_OFD_GETLK checks
2018-08-14 09:49:23 -04:00
Christian Brauner
ec74f3f859
lxccontainer: fix F_OFD_GETLK checks
When we check whether an open file description lock has been taken on a file we
need to set the l_pid field to 0 otherwise the kernel will send back EINVAL.
Additionally, the kernel will not do pid translation and simply set the l_pid
value to -1.

Fixes https://discuss.linuxcontainers.org/t/container-deleted-or-stopped-when-lxc-ls-executed-concurrently/2439

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-14 13:00:29 +02:00
Christian Brauner
375121e4e0
Merge pull request #2525 from 2xsec/bugfix
coverity: #1438392
2018-08-14 09:33:14 +02:00
2xsec
6926e3b80e
coverity: #1438392
Dereference before null check

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-14 13:29:50 +09:00
Christian Brauner
b61a67fa11
Merge pull request #2524 from 2xsec/bugfix
fix thread-safe issue (localtime => localtime_r)
2018-08-13 13:07:37 +02:00
2xsec
df05fa0f04
fix thread safe issue(localtime => localtime_r)
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-13 16:53:30 +09:00
2xsec
f9572e9f18
macro: remove duplicated define
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-13 16:52:24 +09:00
Stéphane Graber
f728ff0c72
Merge pull request #2521 from brauner/2018-08-11/fix_netnsid_allocation
netlink: add __netlink_{send,recv,transaction}
2018-08-11 20:17:29 -04:00
Christian Brauner
9fbbc42791
netlink: add __netlink_{send,recv,transaction}
These allow to pass a struct nlmsghdr directly and are used in the higher level
netlink_{send,rcv,transaction}.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-11 16:25:14 +02:00
Stéphane Graber
d813c8edf8
Merge pull request #2520 from brauner/2018-08-11/fix_netnsid_allocation
netns: improve netnsid allocation
2018-08-10 20:40:51 -04:00
Christian Brauner
b7986d0d1e
start: make netnsid allocation failures non-fatal
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-11 02:26:03 +02:00
Christian Brauner
0ce60f0d5f
netns: improve netnsid allocation
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-11 02:24:14 +02:00
Christian Brauner
4e3ed0d196
macro: add NLMSG_ERROR
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-11 02:21:14 +02:00
Christian Brauner
d851c59308
Merge pull request #2519 from 2xsec/bugfix
fix assignment of signed to bigger unsigned issue
2018-08-10 14:58:51 +02:00
2xsec
fca23691ee
fix assignment of signed to bigger unsigned issue
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-10 20:38:30 +09:00
Christian Brauner
0cbe0a0ce1
Merge pull request #2516 from 2xsec/bugfix
tests: containertests: fix dereference pointer c
2018-08-10 12:53:36 +02:00
2xsec
92d5ea573a
fix tainted int loop bound issue
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-10 13:03:12 +09:00
2xsec
12a1a87296
tests: containertests: fix dereference pointer c
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-10 13:03:01 +09:00
Stéphane Graber
913f809549
Merge pull request #2518 from brauner/2018-08-09/network_netns_id
network: type fixes lxc_netns_set_nsid()
2018-08-09 14:11:42 -04:00
Christian Brauner
1cc84f44ad
network: type fixes lxc_netns_set_nsid()
The kernel expects a __s32 for NETNSA_NSID and a __u32 for NETNSA_FD.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-09 19:53:03 +02:00
Stéphane Graber
b988d228d1
Merge pull request #2515 from brauner/2018-02-06/network_netns_id
netns: allocate network namespace id
2018-08-08 12:04:19 -04:00
Christian Brauner
873c6e87a0
netns: vendor NETNSA_*
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-08 13:57:40 +02:00
Christian Brauner
e46c0642fc
travis: add linux-libc-dev
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-08 13:40:24 +02:00
Christian Brauner
4fb34c047c
macro: move network macros from utils.h
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-08 13:11:05 +02:00
Christian Brauner
1cd9521417
netns: allocate network namespace id
Start to allocate a new network namespace id for each container.

Relates to https://github.com/lxc/lxd/issues/4831.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-08 13:11:05 +02:00
Christian Brauner
6d6ad42734
MAINTAINERS: add Wolfgang Bumiller
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-07 15:01:19 +02:00
Stéphane Graber
85d406c954
Merge pull request #2513 from brauner/2018-08-06/fix_busybox
templates: avoid endless loop
2018-08-06 12:34:44 -04:00
Christian Brauner
f26dc127bf
CVE 2018-6556: verify netns fd in lxc-user-nic
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-06 12:15:39 -04:00
Christian Brauner
46a6646a83
templates: avoid endless loop
Closes #2512.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-06 16:43:35 +02:00
Christian Brauner
639f08fd9f
Merge pull request #2495 from 2xsec/bugfix
add default log priority & cleanups
2018-08-06 11:35:35 +02:00
Christian Brauner
4e2e55dcb6
Merge pull request #2511 from 2xsec/coverity
fix coverity issues
2018-08-06 11:32:33 +02:00
2xsec
3a88eb8e6e
coverity: #1438232
Failure to restore non-local value

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-06 16:57:53 +09:00
2xsec
2082ac625e
pam_cgfs: cleanups
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-08-06 14:36:05 +09:00