]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
6 years agocoverity: #1437936
Christian Brauner [Thu, 12 Jul 2018 15:49:30 +0000 (17:49 +0200)] 
coverity: #1437936

Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoattach: simplify lxc_attach_getpwshell()
Christian Brauner [Wed, 11 Jul 2018 21:12:04 +0000 (23:12 +0200)] 
attach: simplify lxc_attach_getpwshell()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolog: thread-safety backports
Christian Brauner [Mon, 10 Dec 2018 14:14:07 +0000 (15:14 +0100)] 
log: thread-safety backports

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: don't unconditionally open("/dev/null")
Christian Brauner [Mon, 9 Jul 2018 12:28:57 +0000 (14:28 +0200)] 
start: don't unconditionally open("/dev/null")

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425816
2xsec [Mon, 2 Jul 2018 11:37:36 +0000 (20:37 +0900)] 
coverity: #1425816

Explicit null dereferenced

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoCODING_STYLE: add section about using strlcat()
Christian Brauner [Sat, 30 Jun 2018 09:41:23 +0000 (11:41 +0200)] 
CODING_STYLE: add section about using strlcat()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolog: account for Android's Bionic's strerror_r()
Christian Brauner [Tue, 26 Jun 2018 09:25:37 +0000 (11:25 +0200)] 
log: account for Android's Bionic's strerror_r()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolog: add lxc_log_strerror_r macro
2xsec [Mon, 25 Jun 2018 13:00:43 +0000 (22:00 +0900)] 
log: add lxc_log_strerror_r macro

Let's ensure that we always use the thread-safe strerror_r() function and add
an approriate macro.
Additionally, define SYS*() macros for all log levels. They will use the new
macro and ensure thread-safe retrieval of errno values.

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
[christian.brauner@ubuntu.com: simplify lxc_log_strerror_r macro]
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agomove some comments in lxc.spec.in
2xsec [Mon, 25 Jun 2018 04:26:39 +0000 (13:26 +0900)] 
move some comments in lxc.spec.in

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agomonitor: change exit() => _exit() system call in child process
2xsec [Fri, 22 Jun 2018 13:42:32 +0000 (22:42 +0900)] 
monitor: change exit() => _exit() system call in child process

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agocommands: simplify lxc_cmd()
Christian Brauner [Fri, 22 Jun 2018 12:13:06 +0000 (14:13 +0200)] 
commands: simplify lxc_cmd()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agofix pointer c is dereferenced after checking null
Donghwa Jeong [Tue, 19 Jun 2018 01:37:47 +0000 (10:37 +0900)] 
fix pointer c is dereferenced after checking null

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agofix fd handle leak
Donghwa Jeong [Tue, 19 Jun 2018 01:27:33 +0000 (10:27 +0900)] 
fix fd handle leak

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agosecure coding: #2 strcpy => strlcpy
Donghwa Jeong [Mon, 18 Jun 2018 08:18:14 +0000 (17:18 +0900)] 
secure coding: #2 strcpy => strlcpy

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agobtrfs: fix get_btrfs_subvol_path()
Christian Brauner [Mon, 10 Dec 2018 13:22:04 +0000 (14:22 +0100)] 
btrfs: fix get_btrfs_subvol_path()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoinclude: add strlcat() implementation
Christian Brauner [Wed, 20 Jun 2018 11:44:02 +0000 (13:44 +0200)] 
include: add strlcat() implementation

CC: Donghwa Jeong <dh48.jeong@samsung.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agobtrfs: fix btrfs_snapshot()
Christian Brauner [Mon, 10 Dec 2018 13:15:01 +0000 (14:15 +0100)] 
btrfs: fix btrfs_snapshot()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agosecure coding: network: strcpy => strlcpy
Donghwa Jeong [Mon, 18 Jun 2018 04:42:48 +0000 (13:42 +0900)] 
secure coding: network: strcpy => strlcpy

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agosecure coding: strcpy => strlcpy
Donghwa Jeong [Mon, 18 Jun 2018 02:30:41 +0000 (11:30 +0900)] 
secure coding: strcpy => strlcpy

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agocoverity: #1437027
Christian Brauner [Fri, 15 Jun 2018 11:37:47 +0000 (13:37 +0200)] 
coverity: #1437027

Read from pointer after free

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425855
Christian Brauner [Fri, 15 Jun 2018 11:36:37 +0000 (13:36 +0200)] 
coverity: #1425855

String not null terminated

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425789
Christian Brauner [Fri, 15 Jun 2018 11:35:09 +0000 (13:35 +0200)] 
coverity: #1425789

Unchecked return value from library

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425846
Christian Brauner [Fri, 15 Jun 2018 10:56:19 +0000 (12:56 +0200)] 
coverity: #1425846

Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425840
Christian Brauner [Fri, 15 Jun 2018 10:55:06 +0000 (12:55 +0200)] 
coverity: #1425840

Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425837
Christian Brauner [Fri, 15 Jun 2018 10:50:47 +0000 (12:50 +0200)] 
coverity: #1425837

String not null terminated

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425825
Christian Brauner [Fri, 15 Jun 2018 10:43:48 +0000 (12:43 +0200)] 
coverity: #1425825

Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425824
Christian Brauner [Fri, 15 Jun 2018 10:41:09 +0000 (12:41 +0200)] 
coverity: #1425824

Missing break in switch

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425819
Christian Brauner [Fri, 15 Jun 2018 09:54:14 +0000 (11:54 +0200)] 
coverity: #1425819

Resource leak

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425818
Christian Brauner [Fri, 15 Jun 2018 09:52:04 +0000 (11:52 +0200)] 
coverity: #1425818

Dereference after null check

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425813
Christian Brauner [Fri, 15 Jun 2018 09:49:10 +0000 (11:49 +0200)] 
coverity: #1425813

Resource leak

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425810
Christian Brauner [Fri, 15 Jun 2018 09:47:31 +0000 (11:47 +0200)] 
coverity: #1425810

Explicit null dereferenced

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425799
Christian Brauner [Fri, 15 Jun 2018 09:43:15 +0000 (11:43 +0200)] 
coverity: #1425799

Logically dead code

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425793
Christian Brauner [Fri, 15 Jun 2018 09:42:18 +0000 (11:42 +0200)] 
coverity: #1425793

Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425792
Christian Brauner [Fri, 15 Jun 2018 09:40:53 +0000 (11:40 +0200)] 
coverity: #1425792

Insecure temporary file

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425789
Christian Brauner [Fri, 15 Jun 2018 09:37:11 +0000 (11:37 +0200)] 
coverity: #1425789

Unchecked return value from library

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425771
Christian Brauner [Fri, 15 Jun 2018 09:35:10 +0000 (11:35 +0200)] 
coverity: #1425771

Insecure temporary file

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425770
Christian Brauner [Fri, 15 Jun 2018 09:33:34 +0000 (11:33 +0200)] 
coverity: #1425770

Insecure temporary file

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoinclude: add getgrgid_r()
Christian Brauner [Thu, 14 Jun 2018 22:17:01 +0000 (00:17 +0200)] 
include: add getgrgid_r()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostorage: Resource leak
Donghwa Jeong [Fri, 15 Jun 2018 02:11:48 +0000 (11:11 +0900)] 
storage: Resource leak

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agocoverity: #1425768
Christian Brauner [Thu, 14 Jun 2018 20:17:08 +0000 (22:17 +0200)] 
coverity: #1425768

Untrusted array index read

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425767
Christian Brauner [Thu, 14 Jun 2018 20:10:26 +0000 (22:10 +0200)] 
coverity: #1425767

Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425766
Christian Brauner [Thu, 14 Jun 2018 20:09:14 +0000 (22:09 +0200)] 
coverity: #1425766

Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425760
Christian Brauner [Thu, 14 Jun 2018 20:05:09 +0000 (22:05 +0200)] 
coverity: #1425760

Use of untrusted scalar value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425778
2xsec [Thu, 14 Jun 2018 15:19:22 +0000 (00:19 +0900)] 
coverity: #1425778

Out-of-bounds write

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agocoverity: #1437017
2xsec [Thu, 14 Jun 2018 13:55:47 +0000 (22:55 +0900)] 
coverity: #1437017

Uninitialized pointer

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agofix getgrgid() thread safe issue
Donghwa Jeong [Thu, 14 Jun 2018 10:06:11 +0000 (19:06 +0900)] 
fix getgrgid() thread safe issue

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agofix getpwuid() thread safe issue
Donghwa Jeong [Thu, 14 Jun 2018 06:32:03 +0000 (15:32 +0900)] 
fix getpwuid() thread safe issue

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agocoverity: #1436916
Donghwa Jeong [Thu, 14 Jun 2018 01:36:46 +0000 (10:36 +0900)] 
coverity: #1436916

Resource leak

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agoattach: fix double free
Donghwa Jeong [Tue, 12 Jun 2018 09:16:35 +0000 (18:16 +0900)] 
attach: fix double free

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agofix getpwnam() thread safe issue
Donghwa Jeong [Tue, 12 Jun 2018 08:09:13 +0000 (17:09 +0900)] 
fix getpwnam() thread safe issue

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agotools: restore lxc-create log behavior
Christian Brauner [Mon, 11 Jun 2018 11:15:48 +0000 (13:15 +0200)] 
tools: restore lxc-create log behavior

Older versions of lxc-create used to set log_file to "none" when a log priority
but no log file was specified on the command line. Let's restore this behavior.

Closes #2392.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425781
Donghwa Jeong [Mon, 11 Jun 2018 05:51:16 +0000 (14:51 +0900)] 
coverity: #1425781

Resource leak

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agoarguments: improve some operations
Donghwa Jeong [Mon, 11 Jun 2018 02:10:58 +0000 (11:10 +0900)] 
arguments: improve some operations

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agoconf: only use newuidmap and newgidmap when necessary
Jonathan Calmels [Fri, 8 Jun 2018 23:58:11 +0000 (16:58 -0700)] 
conf: only use newuidmap and newgidmap when necessary

Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
6 years agocoverity: #1425836
Donghwa Jeong [Fri, 8 Jun 2018 07:38:56 +0000 (16:38 +0900)] 
coverity: #1425836

Resource leak

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agocoverity: #1425849
Donghwa Jeong [Fri, 8 Jun 2018 02:22:18 +0000 (11:22 +0900)] 
coverity: #1425849

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agocoverity: #1425841
Donghwa Jeong [Fri, 8 Jun 2018 02:20:08 +0000 (11:20 +0900)] 
coverity: #1425841

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agocoverity: #1425795
Donghwa Jeong [Fri, 8 Jun 2018 02:16:31 +0000 (11:16 +0900)] 
coverity: #1425795

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agocoverity: #1425794
Donghwa Jeong [Fri, 8 Jun 2018 02:14:40 +0000 (11:14 +0900)] 
coverity: #1425794

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agocoverity: #1425779
Donghwa Jeong [Fri, 8 Jun 2018 02:12:52 +0000 (11:12 +0900)] 
coverity: #1425779

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agocoverity: #1425777
Donghwa Jeong [Fri, 8 Jun 2018 02:11:03 +0000 (11:11 +0900)] 
coverity: #1425777

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agoFix typo
Stéphane Graber [Tue, 5 Jun 2018 21:13:57 +0000 (17:13 -0400)] 
Fix typo

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
6 years agosupport tls in cross-compile
duguhaotian [Wed, 30 May 2018 02:25:40 +0000 (10:25 +0800)] 
support tls in cross-compile

AC_RUN_IFELSE will fail in cross-compile,
we can use AC_COMPILE_IFELSE replace.

Signed-off-by: duguhaotian <duguhaotian@gmail.com>
6 years agoconf: copy mountinfo for remount_all_slave()
Christian Brauner [Mon, 4 Jun 2018 10:49:05 +0000 (12:49 +0200)] 
conf: copy mountinfo for remount_all_slave()

While a container reads mountinfo from proc fs, the mountinfo can be changed by
the kernel anytime. This has caused critical issues on some devices.

Signed-off-by: Donghwa Jeong dh48.jeong@samsung.com
Reported-by: Donghwa Jeong dh48.jeong@samsung.com
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotree-wide: handle EINTR in some read()/write()
Christian Brauner [Fri, 1 Jun 2018 17:53:06 +0000 (19:53 +0200)] 
tree-wide: handle EINTR in some read()/write()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: log unknown info.si_code
Christian Brauner [Thu, 31 May 2018 10:18:02 +0000 (12:18 +0200)] 
start: log unknown info.si_code

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: fix waitpid() blocking issue
Donghwa Jeong [Thu, 31 May 2018 08:58:08 +0000 (17:58 +0900)] 
start: fix waitpid() blocking issue

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agoconfile: improve strprint()
Christian Brauner [Wed, 30 May 2018 13:34:03 +0000 (15:34 +0200)] 
confile: improve strprint()

POSIX specifies [1]:
"If the value of n is zero on a call to snprintf(), nothing shall be written,
the number of bytes that would have been written had n been sufficiently large
excluding the terminating null shall be returned, and s may be a null pointer."

But in case there are any non-sane libcs out there that do actually dereference
the buffer when when 0 is passed as length to snprintf() let's give them a
dummy buffer.

[1]: The Open Group Base Specifications Issue 7, 2018 edition
     IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008)
     Copyright © 2001-2018 IEEE and The Open Group

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Reported-by: Donghwa Jeong <dh48.jeong@samsung.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf: va_end was not called.
Donghwa Jeong [Tue, 29 May 2018 13:01:27 +0000 (22:01 +0900)] 
conf: va_end was not called.

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agonetwork: fix socket handle leak
Donghwa Jeong [Mon, 28 May 2018 04:42:45 +0000 (13:42 +0900)] 
network: fix socket handle leak

Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
6 years agoutils: fix task_blocking_signal()
Christian Brauner [Sat, 26 May 2018 12:22:51 +0000 (14:22 +0200)] 
utils: fix task_blocking_signal()

Closes #2342.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1435803
Christian Brauner [Sat, 26 May 2018 01:22:58 +0000 (03:22 +0200)] 
coverity: #1435803

Unchecked return value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1435805
Christian Brauner [Sat, 26 May 2018 01:21:05 +0000 (03:21 +0200)] 
coverity: #1435805

Logically dead code

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotools: fix lxc-create with global config value II
Christian Brauner [Fri, 25 May 2018 17:35:00 +0000 (19:35 +0200)] 
tools: fix lxc-create with global config value II

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotools: fix lxc-create with global config value
Christian Brauner [Fri, 25 May 2018 13:43:59 +0000 (15:43 +0200)] 
tools: fix lxc-create with global config value

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconfile: order architectures
Christian Brauner [Thu, 24 May 2018 22:12:46 +0000 (00:12 +0200)] 
confile: order architectures

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxccontainer: fix fd leaks when sending signals
Christian Brauner [Thu, 24 May 2018 22:00:50 +0000 (00:00 +0200)] 
lxccontainer: fix fd leaks when sending signals

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoutils: fix task_blocking_signal()
Christian Brauner [Thu, 24 May 2018 18:45:29 +0000 (20:45 +0200)] 
utils: fix task_blocking_signal()

sscanf() skips whitespace anyway so don't account for tabs in case the file
layout changes.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotree-wide: s/sigprocmask/pthread_sigmask()/g
Christian Brauner [Thu, 24 May 2018 18:29:48 +0000 (20:29 +0200)] 
tree-wide: s/sigprocmask/pthread_sigmask()/g

The behavior of sigprocmask() is unspecified in multi-threaded programs. Let's
use pthread_sigmask() instead.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxc-init: skip signals that can't be caught
Christian Brauner [Tue, 22 May 2018 21:26:03 +0000 (23:26 +0200)] 
lxc-init: skip signals that can't be caught

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425802
Simos Xenitellis [Tue, 15 May 2018 11:34:38 +0000 (11:34 +0000)] 
coverity: #1425802

Resource leak

Signed-off-by: Simos Xenitellis <simos.lists@googlemail.com>
6 years agocapabilities: raise ambient capabilities
Christian Brauner [Tue, 15 May 2018 19:33:48 +0000 (21:33 +0200)] 
capabilities: raise ambient capabilities

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Suggested-by: Jonathan Calmels <jcalmels@nvidia.com>
6 years agoconfig: allow read-write /sys in user namespace
Christian Brauner [Sun, 13 May 2018 13:02:09 +0000 (15:02 +0200)] 
config: allow read-write /sys in user namespace

Unprivileged containers can safely mount /sys as read-write. This also allows
systemd-udevd to be started in unprivileged containers.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425844
Simos Xenitellis [Tue, 15 May 2018 11:37:14 +0000 (11:37 +0000)] 
coverity: #1425844

Resource leak

Signed-off-by: Simos Xenitellis <simos.lists@googlemail.com>
6 years agocoverity: #1248106
Simos Xenitellis [Tue, 15 May 2018 00:05:13 +0000 (00:05 +0000)] 
coverity: #1248106

Resource leak

Signed-off-by: Simos Xenitellis <simos.lists@googlemail.com>
6 years agocoverity: #1425836
Simos Xenitellis [Tue, 15 May 2018 00:19:12 +0000 (00:19 +0000)] 
coverity: #1425836

Resource leak

Signed-off-by: Simos Xenitellis <simos.lists@googlemail.com>
6 years agocoverity: #1435603
Christian Brauner [Tue, 15 May 2018 10:34:24 +0000 (12:34 +0200)] 
coverity: #1435603

Resource leak

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1435604
Christian Brauner [Tue, 15 May 2018 10:33:22 +0000 (12:33 +0200)] 
coverity: #1435604

Resource leak

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoRevert "tools: s/strncpy()/strlcpy()/g"
Christian Brauner [Fri, 11 May 2018 13:56:58 +0000 (15:56 +0200)] 
Revert "tools: s/strncpy()/strlcpy()/g"

This reverts commit 2ec47d5149e73db97f7877d06d67cb11421097bb.

First, I forgot to actually replace strncpy() with strlcpy(). Second, we don't
want to \0-terminate since this is an abstract unix socket and this is not
required. Instead, let's simply use memcpy() which is more correct and also
silences gcc-8.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotools: s/strncpy()/strlcpy()/g
Christian Brauner [Fri, 11 May 2018 13:19:45 +0000 (15:19 +0200)] 
tools: s/strncpy()/strlcpy()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoCODING_STYLE: add section about using strlcpy()
Christian Brauner [Fri, 11 May 2018 11:02:41 +0000 (13:02 +0200)] 
CODING_STYLE: add section about using strlcpy()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotree-wide: s/strncpy()/strlcpy()/g
Christian Brauner [Fri, 11 May 2018 10:58:11 +0000 (12:58 +0200)] 
tree-wide: s/strncpy()/strlcpy()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostrlcpy: add strlcpy() implementation
Christian Brauner [Fri, 11 May 2018 10:57:51 +0000 (12:57 +0200)] 
strlcpy: add strlcpy() implementation

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoautodev: adapt to changes in Linux 4.18
Christian Brauner [Sun, 14 Oct 2018 09:42:29 +0000 (11:42 +0200)] 
autodev: adapt to changes in Linux 4.18

Starting with commit
55956b59df33 ("vfs: Allow userns root to call mknod on owned filesystems.")
Linux will allow mknod() in user namespaces for userns root if CAP_MKNOD is
available.
However, these device nodes are useless since

static struct super_block *alloc_super(struct file_system_type *type, int flags,
                                       struct user_namespace *user_ns)
{
    /* <snip> */

    if (s->s_user_ns != &init_user_ns)
            s->s_iflags |= SB_I_NODEV;

    /* <snip> */
}

will set the SB_I_NODEV flag on the filesystem. When a device node created in
non-init userns is open()ed the call chain will hit:

bool may_open_dev(const struct path *path)
{
    return !(path->mnt->mnt_flags & MNT_NODEV) &&
            !(path->mnt->mnt_sb->s_iflags & SB_I_NODEV);
}

which will cause an EPERM because the device node is located on an fs
owned by non-init-userns and thus doesn't grant access to device nodes due to
SB_I_NODEV.

This commit enables LXC to deal with such kernels.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agonetwork: adhere to IFNAMSIZ limit
Christian Brauner [Thu, 10 May 2018 22:54:47 +0000 (00:54 +0200)] 
network: adhere to IFNAMSIZ limit

The additional \0-byte space added is not needed since IFNAMSIZ needs to
include the \0-byte.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agonetwork: silence gcc-8
Christian Brauner [Thu, 10 May 2018 22:52:33 +0000 (00:52 +0200)] 
network: silence gcc-8

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoutils: account for terminating \0 byte
Christian Brauner [Thu, 10 May 2018 18:25:08 +0000 (20:25 +0200)] 
utils: account for terminating \0 byte

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocoverity: #1425744
Christian Brauner [Tue, 1 May 2018 15:27:51 +0000 (17:27 +0200)] 
coverity: #1425744

Dereference after null check

userns_exec_{1,full} are called from functions that might not have a conf.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agogenl: remove
Christian Brauner [Tue, 1 May 2018 14:59:19 +0000 (16:59 +0200)] 
genl: remove

These files have never been used and as such have no dependencies in the
codebase whatsoever. So remove them. If we need them we can simply pull them
out of the git history.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoexecute: account for -o path option count
Tycho Andersen [Wed, 9 May 2018 01:29:06 +0000 (01:29 +0000)] 
execute: account for -o path option count

This always works fine... until your exec() fails and you try to go and
free it, you've overwritten the allocator's metadata (and potentially other
stuff) and it fails.

Signed-off-by: Tycho Andersen <tycho@tycho.ws>