]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
6 years agotree-wide: replace sizeof() with SIZEOF2STRLEN() 2637/head
Christian Brauner [Sat, 22 Sep 2018 09:21:04 +0000 (11:21 +0200)] 
tree-wide: replace sizeof() with SIZEOF2STRLEN()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agomacro: add STRLITERALLEN() and STRARRAYLEN()
Christian Brauner [Sat, 22 Sep 2018 09:14:08 +0000 (11:14 +0200)] 
macro: add STRLITERALLEN() and STRARRAYLEN()

sizeof() implementation for string literals and string arrays that makes
it behave like strlen() for strings.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgfsng: s/__cgfsng_ops__/__cgfsng_ops/g
Christian Brauner [Sun, 23 Sep 2018 10:35:44 +0000 (12:35 +0200)] 
cgfsng: s/__cgfsng_ops__/__cgfsng_ops/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: s/__noreturn__/__noreturn/g
Christian Brauner [Sat, 22 Sep 2018 08:56:09 +0000 (10:56 +0200)] 
compiler: s/__noreturn__/__noreturn/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocompiler: s/__fallthrough__/__fallthrough/g
Christian Brauner [Sat, 22 Sep 2018 08:53:52 +0000 (10:53 +0200)] 
compiler: s/__fallthrough__/__fallthrough/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2636 from brauner/2018-09-21/fix_implicit_fallthrough
Stéphane Graber [Sat, 22 Sep 2018 23:04:51 +0000 (01:04 +0200)] 
Merge pull request #2636 from brauner/2018-09-21/fix_implicit_fallthrough

autotools: fix check for -Wimplicit-fallthrough

6 years agoMerge pull request #2627 from 2xsec/bugfix
Christian Brauner [Sat, 22 Sep 2018 09:36:16 +0000 (11:36 +0200)] 
Merge pull request #2627 from 2xsec/bugfix

conf: realpath() uses null as second parameter to prevent buffer overflow

6 years agoautotools: fix wrong AX_CHECK_COMPILE_FLAG test 2636/head
Christian Brauner [Fri, 21 Sep 2018 21:45:33 +0000 (23:45 +0200)] 
autotools: fix wrong AX_CHECK_COMPILE_FLAG test

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2606 from brauner/2018-09-09/cgroup_escape
Serge Hallyn [Fri, 21 Sep 2018 14:54:25 +0000 (09:54 -0500)] 
Merge pull request #2606 from brauner/2018-09-09/cgroup_escape

cgroups: scoping for cgroup v2

6 years agocgfsng: add missing __cgfsng_ops__ attributes 2606/head
Christian Brauner [Fri, 21 Sep 2018 14:50:24 +0000 (16:50 +0200)] 
cgfsng: add missing __cgfsng_ops__ attributes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotests: adapt cgroup tests to new layout
Christian Brauner [Tue, 11 Sep 2018 09:37:36 +0000 (11:37 +0200)] 
tests: adapt cgroup tests to new layout

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgfsng: cgfsng_monitor_enter()
Christian Brauner [Mon, 10 Sep 2018 14:40:18 +0000 (16:40 +0200)] 
cgfsng: cgfsng_monitor_enter()

brauner@wittgenstein|~
> sudo systemctl status lxc@c1
● lxc@c1.service - LXC Container: c1
   Loaded: loaded (/lib/systemd/system/lxc@.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-09-11 10:42:22 CEST; 38s ago
     Docs: man:lxc-start
           man:lxc
  Process: 29855 ExecStart=/usr/bin/lxc-start -n c1 -p /run/lxc/c1.pid (code=exited, status=0/SUCCESS)
    Tasks: 18 (limit: 4915)
   Memory: 32.1M
   CGroup: /system.slice/system-lxc.slice/lxc@c1.service
           ├─lxc.monitor
           │ └─c1
           │   └─29870 [lxc monitor] /var/lib/lxc c1
           └─lxc.payload
             └─c1
               ├─init.scope
               │ └─29878 /sbin/init
               └─system.slice
                 ├─console-getty.service
                 │ └─30028 /sbin/agetty -o -p -- \u --noclear --keep-baud console 115200,38400,9600 linux
                 ├─cron.service
                 │ └─30019 /usr/sbin/cron -f
                 ├─dbus.service
                 │ └─30020 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
                 ├─networkd-dispatcher.service
                 │ └─30016 /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
                 ├─rsyslog.service
                 │ └─30017 /usr/sbin/rsyslogd -n
                 ├─system-container\x2dgetty.slice
                 │ ├─container-getty@0.service
                 │ │ └─30027 /sbin/agetty -o -p -- \u --noclear --keep-baud pts/0 115200,38400,9600 vt220
                 │ ├─container-getty@1.service
                 │ │ └─30030 /sbin/agetty -o -p -- \u --noclear --keep-baud pts/1 115200,38400,9600 vt220
                 │ ├─container-getty@2.service
                 │ │ └─30026 /sbin/agetty -o -p -- \u --noclear --keep-baud pts/2 115200,38400,9600 vt220
                 │ └─container-getty@3.service
                 │   └─30029 /sbin/agetty -o -p -- \u --noclear --keep-baud pts/3 115200,38400,9600 vt220
                 ├─systemd-journald.service
                 │ └─29976 /lib/systemd/systemd-journald
                 ├─systemd-logind.service
                 │ └─30018 /lib/systemd/systemd-logind
                 ├─systemd-networkd.service
                 │ └─29996 /lib/systemd/systemd-networkd
                 ├─systemd-resolved.service
                 │ └─30014 /lib/systemd/systemd-resolved
                 └─systemd-udevd.service
                   └─29986 /lib/systemd/systemd-udevd

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgroups: add monitor_enter()
Christian Brauner [Mon, 10 Sep 2018 14:28:13 +0000 (16:28 +0200)] 
cgroups: add monitor_enter()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgfsng: add cgfsng_monitor_create()
Christian Brauner [Mon, 10 Sep 2018 14:27:35 +0000 (16:27 +0200)] 
cgfsng: add cgfsng_monitor_create()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgroups: add monitor_create()
Christian Brauner [Mon, 10 Sep 2018 14:27:18 +0000 (16:27 +0200)] 
cgroups: add monitor_create()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgroups: add monitor_full_path member
Christian Brauner [Mon, 10 Sep 2018 13:51:38 +0000 (15:51 +0200)] 
cgroups: add monitor_full_path member

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgroups: add monitor_cgroup member
Christian Brauner [Mon, 10 Sep 2018 13:42:51 +0000 (15:42 +0200)] 
cgroups: add monitor_cgroup member

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgroups: s/base_cgroup/container_base_path/g
Christian Brauner [Mon, 10 Sep 2018 13:47:59 +0000 (15:47 +0200)] 
cgroups: s/base_cgroup/container_base_path/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgroups: add missing string.h include
Christian Brauner [Mon, 10 Sep 2018 13:42:02 +0000 (15:42 +0200)] 
cgroups: add missing string.h include

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgroups: s/fullcgpath/container_full_path/g
Christian Brauner [Mon, 10 Sep 2018 13:41:11 +0000 (15:41 +0200)] 
cgroups: s/fullcgpath/container_full_path/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgroups: switch to lxc.payload as default pattern
Christian Brauner [Mon, 10 Sep 2018 13:24:21 +0000 (15:24 +0200)] 
cgroups: switch to lxc.payload as default pattern

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocgroup: rename container specific cgroup functions
Christian Brauner [Mon, 10 Sep 2018 13:12:35 +0000 (15:12 +0200)] 
cgroup: rename container specific cgroup functions

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2635 from brauner/2018-09-21/Wimplicit-fallthrough
Stéphane Graber [Fri, 21 Sep 2018 13:54:32 +0000 (15:54 +0200)] 
Merge pull request #2635 from brauner/2018-09-21/Wimplicit-fallthrough

autotools: add -Wimplicit-fallthrough

6 years agoMerge pull request #2630 from brauner/2018-09-20/remove_locking
Stéphane Graber [Fri, 21 Sep 2018 13:50:35 +0000 (15:50 +0200)] 
Merge pull request #2630 from brauner/2018-09-20/remove_locking

api_extensions: introduce lxc_has_api_extension()

6 years agoautotools: add -Wimplicit-fallthrough 2635/head
Christian Brauner [Fri, 21 Sep 2018 12:54:06 +0000 (14:54 +0200)] 
autotools: add -Wimplicit-fallthrough

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoapi_extensions: introduce lxc_has_api_extension() 2630/head
Christian Brauner [Fri, 21 Sep 2018 08:28:34 +0000 (10:28 +0200)] 
api_extensions: introduce lxc_has_api_extension()

This is modeled after LXD's API extension checks. This allows API users
to query the given LXC instance whether a given API extension is
supported.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2633 from brauner/2018-09-21/cgfsng_ops_attribute
Stéphane Graber [Fri, 21 Sep 2018 13:13:16 +0000 (15:13 +0200)] 
Merge pull request #2633 from brauner/2018-09-21/cgfsng_ops_attribute

cgfsng: mark ops with __cgfsng_ops__ attribute

6 years agoMerge pull request #2634 from brauner/2018-09-21/cgroup_relative
Stéphane Graber [Fri, 21 Sep 2018 13:13:03 +0000 (15:13 +0200)] 
Merge pull request #2634 from brauner/2018-09-21/cgroup_relative

confile: s/lxc.cgroup.keep/lxc.cgroup.relative/g

6 years agoMerge pull request #2607 from brauner/2018-09-11/sysfs_mixed
Stéphane Graber [Fri, 21 Sep 2018 11:46:00 +0000 (13:46 +0200)] 
Merge pull request #2607 from brauner/2018-09-11/sysfs_mixed

conf: remove extra MS_BIND with sysfs:mixed

6 years agocgfsng: mark ops with __cgfsng_ops__ attribute 2633/head
Christian Brauner [Fri, 21 Sep 2018 11:25:12 +0000 (13:25 +0200)] 
cgfsng: mark ops with __cgfsng_ops__ attribute

Helps to easily tell the cgfsng ops functions from helpers.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconfile: s/lxc.cgroup.keep/lxc.cgroup.relative/g 2634/head
Christian Brauner [Fri, 21 Sep 2018 08:41:38 +0000 (10:41 +0200)] 
confile: s/lxc.cgroup.keep/lxc.cgroup.relative/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2608 from brauner/2018-09-11/netns_get_nsid
Stéphane Graber [Fri, 21 Sep 2018 11:44:34 +0000 (13:44 +0200)] 
Merge pull request #2608 from brauner/2018-09-11/netns_get_nsid

network: add lxc_netns_get_nsid()

6 years agoMerge pull request #2631 from brauner/2018-09-20/rename_backgrounded
Stéphane Graber [Fri, 21 Sep 2018 11:36:57 +0000 (13:36 +0200)] 
Merge pull request #2631 from brauner/2018-09-20/rename_backgrounded

start: s/backgrounded/daemonize/g

6 years agostart: s/backgrounded/daemonize/g 2631/head
Christian Brauner [Fri, 21 Sep 2018 10:24:24 +0000 (12:24 +0200)] 
start: s/backgrounded/daemonize/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf: realpath() uses null as second parameter to prevent buffer overflow 2627/head
2xsec [Fri, 21 Sep 2018 02:09:54 +0000 (11:09 +0900)] 
conf: realpath() uses null as second parameter to prevent buffer overflow

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2626 from brauner/2018-09-20/remove_locking
Stéphane Graber [Thu, 20 Sep 2018 22:11:43 +0000 (00:11 +0200)] 
Merge pull request #2626 from brauner/2018-09-20/remove_locking

lxccontainer: remove cgroup locking

6 years agolxccontainer: remove locks from get_cgroup_item() 2626/head
Christian Brauner [Thu, 20 Sep 2018 20:34:59 +0000 (22:34 +0200)] 
lxccontainer: remove locks from get_cgroup_item()

The on-disk config file is not altered and the in-memory config isn't
altered so no need for locking.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolxccontainer: remove locks from set_cgroup_item()
Christian Brauner [Thu, 20 Sep 2018 20:34:10 +0000 (22:34 +0200)] 
lxccontainer: remove locks from set_cgroup_item()

The on-disk config file is not altered and the in-memory config isn't
altered so no need for locking.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2624 from 2xsec/bugfix
Christian Brauner [Thu, 20 Sep 2018 19:55:08 +0000 (21:55 +0200)] 
Merge pull request #2624 from 2xsec/bugfix

af_unix: add function to remove duplicated codes for set sockaddr

6 years agoaf_unix: add function to remove duplicated codes for set sockaddr 2624/head
2xsec [Wed, 19 Sep 2018 11:38:16 +0000 (20:38 +0900)] 
af_unix: add function to remove duplicated codes for set sockaddr

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2622 from brauner/2018-09-19/attach_exit_status
Stéphane Graber [Wed, 19 Sep 2018 09:49:02 +0000 (11:49 +0200)] 
Merge pull request #2622 from brauner/2018-09-19/attach_exit_status

attach: report standard shell exit codes

6 years agoattach: report standard shell exit codes 2622/head
Christian Brauner [Wed, 19 Sep 2018 07:15:36 +0000 (09:15 +0200)] 
attach: report standard shell exit codes

POSIX mandates that on ENOEXEC 126 and on ENOENT 127 is supposed to be
reported.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2621 from 2xsec/bugfix
Christian Brauner [Wed, 19 Sep 2018 07:11:36 +0000 (09:11 +0200)] 
Merge pull request #2621 from 2xsec/bugfix

security: fix too wide or inconsistent non-owner permissions

6 years agosecurity: fix too wide or inconsistent non-owner permissions 2621/head
2xsec [Wed, 19 Sep 2018 05:30:12 +0000 (14:30 +0900)] 
security: fix too wide or inconsistent non-owner permissions

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2619 from smibarber/attach-shutdown
Christian Brauner [Tue, 18 Sep 2018 15:24:46 +0000 (18:24 +0300)] 
Merge pull request #2619 from smibarber/attach-shutdown

attach: don't shutdown ipc socket in child

6 years agoattach: don't shutdown ipc socket in child 2619/head
Stephen Barber [Tue, 18 Sep 2018 00:31:22 +0000 (17:31 -0700)] 
attach: don't shutdown ipc socket in child

shutdown() affects sockets even across forked processes. The
attached child process doesn't have any interest in using the
IPC socket, so just close it in the child process and let the
intermediate process handle shutting it down.

This fixes a bug seen with lxc exec in crbug.com/884244

Signed-off-by: Stephen Barber <smbarber@chromium.org>
6 years agoMerge pull request #2611 from 2xsec/bugfix
Christian Brauner [Mon, 17 Sep 2018 06:25:34 +0000 (09:25 +0300)] 
Merge pull request #2611 from 2xsec/bugfix

add compile flags for dlog

6 years agolog: add additional info of dlog 2611/head
2xsec [Fri, 14 Sep 2018 09:28:44 +0000 (18:28 +0900)] 
log: add additional info of dlog

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agolog: add common functions
2xsec [Fri, 14 Sep 2018 09:16:04 +0000 (18:16 +0900)] 
log: add common functions

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoadd compile flags for dlog
2xsec [Thu, 13 Sep 2018 02:37:54 +0000 (11:37 +0900)] 
add compile flags for dlog

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agonetwork: minor tweaks 2608/head
Christian Brauner [Wed, 12 Sep 2018 23:16:30 +0000 (01:16 +0200)] 
network: minor tweaks

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2609 from 2xsec/bugfix
Christian Brauner [Wed, 12 Sep 2018 11:34:36 +0000 (13:34 +0200)] 
Merge pull request #2609 from 2xsec/bugfix

remove unused variables & function

6 years agofile_utils: remove unused function 2609/head
2xsec [Wed, 12 Sep 2018 08:31:40 +0000 (17:31 +0900)] 
file_utils: remove unused function

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoremove unused variables
2xsec [Wed, 12 Sep 2018 08:29:09 +0000 (17:29 +0900)] 
remove unused variables

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agonetwork: add lxc_netns_get_nsid()
Christian Brauner [Tue, 11 Sep 2018 12:02:23 +0000 (14:02 +0200)] 
network: add lxc_netns_get_nsid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2604 from brauner/2018-09-09/fix_pid_file
Wolfgang Bumiller [Tue, 11 Sep 2018 12:18:04 +0000 (14:18 +0200)] 
Merge pull request #2604 from brauner/2018-09-09/fix_pid_file

lxccontainer: use correct pid_t type

6 years agonetwork: use correct type in lxc_netns_set_nsid()
Christian Brauner [Tue, 11 Sep 2018 12:02:03 +0000 (14:02 +0200)] 
network: use correct type in lxc_netns_set_nsid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoconf: remove extra MS_BIND with sysfs:mixed 2607/head
Christian Brauner [Tue, 11 Sep 2018 10:14:04 +0000 (12:14 +0200)] 
conf: remove extra MS_BIND with sysfs:mixed

The extra bind-mount is not required. To succesfully remount read-only
we just need MS_REMOUNT|MS_RDONLY.

Closes #2602.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Serge Hallyn <serge@hallyn.com>
6 years agoMerge pull request #2601 from 2xsec/bugfix
Christian Brauner [Tue, 11 Sep 2018 09:39:54 +0000 (11:39 +0200)] 
Merge pull request #2601 from 2xsec/bugfix

log: support dlog

6 years agolxccontainer: use correct pid_t type 2604/head
Christian Brauner [Tue, 11 Sep 2018 08:34:41 +0000 (10:34 +0200)] 
lxccontainer: use correct pid_t type

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2596 from brauner/2018-09-05/attach_id
Wolfgang Bumiller [Tue, 11 Sep 2018 09:06:42 +0000 (11:06 +0200)] 
Merge pull request #2596 from brauner/2018-09-05/attach_id

utils: allow lxc-attach to set uid / gid

6 years agoutils: make lxc_switch_uid_gid() return bool 2596/head
Christian Brauner [Sun, 9 Sep 2018 14:34:50 +0000 (16:34 +0200)] 
utils: make lxc_switch_uid_gid() return bool

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoutils: make lxc_setgroups() return bool
Christian Brauner [Sun, 9 Sep 2018 14:30:20 +0000 (16:30 +0200)] 
utils: make lxc_setgroups() return bool

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agostart: avoid unnecessary syscalls
Christian Brauner [Sun, 9 Sep 2018 11:58:53 +0000 (13:58 +0200)] 
start: avoid unnecessary syscalls

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotools/lxc-attach: add -u and -g arguments
Christian Brauner [Sun, 9 Sep 2018 11:22:58 +0000 (13:22 +0200)] 
tools/lxc-attach: add -u and -g arguments

This lets users specify uids and gids to switch to.

Closes #2591.

Signed-off-by: Disassembler disassembler@dasm.cz
[christian.brauner@ubuntu.com: adapt coding style + commit message]

6 years agoattach: handle id switching smarter
Christian Brauner [Sun, 9 Sep 2018 11:20:14 +0000 (13:20 +0200)] 
attach: handle id switching smarter

For setup, switch to the most privileged ids we can find. That is either
nsuid 0 if a mapping has been established if not switch to the ids the
init running in the container was started with.
After setup, switch to the actual requested ids.

Closes #2591.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolog: support dlog 2601/head
2xsec [Tue, 11 Sep 2018 07:04:25 +0000 (16:04 +0900)] 
log: support dlog

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoutils: improve lxc_switch_uid_gid()
Christian Brauner [Sun, 9 Sep 2018 11:11:21 +0000 (13:11 +0200)] 
utils: improve lxc_switch_uid_gid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoutils: improve get_ns_uid() and add get_ns_gid()
Christian Brauner [Sun, 9 Sep 2018 10:46:00 +0000 (12:46 +0200)] 
utils: improve get_ns_uid() and add get_ns_gid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2594 from ffontaine/master
Christian Brauner [Sat, 8 Sep 2018 19:39:05 +0000 (20:39 +0100)] 
Merge pull request #2594 from ffontaine/master

lxc: fix build with --disable-werror

6 years agolxc: fix build with --disable-werror 2594/head
Fabrice Fontaine [Sat, 8 Sep 2018 19:05:58 +0000 (21:05 +0200)] 
lxc: fix build with --disable-werror

Fix #2592 by defining -Wvla -std=gnu11 even if --disable-werror is set
As -std=gnu11 is always set, bump requirement on gcc from 4.6 to 4.7
(see https://gcc.gnu.org/projects/cxx-status.html#cxx11)

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
6 years agoMerge pull request #2589 from 2xsec/bugfix
Christian Brauner [Fri, 7 Sep 2018 12:54:09 +0000 (13:54 +0100)] 
Merge pull request #2589 from 2xsec/bugfix

lxccontainer: fix dereferenced pointer

6 years agolxccontainer: fix dereferenced pointer 2589/head
2xsec [Thu, 6 Sep 2018 07:55:10 +0000 (16:55 +0900)] 
lxccontainer: fix dereferenced pointer

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2584 from brauner/2018-09-03/bugfixes
Wolfgang Bumiller [Tue, 4 Sep 2018 12:45:55 +0000 (14:45 +0200)] 
Merge pull request #2584 from brauner/2018-09-03/bugfixes

commands: switch to setting errno and returning -1

6 years agolog: log_append_logfile() add new error path 2584/head
Christian Brauner [Tue, 4 Sep 2018 11:59:49 +0000 (13:59 +0200)] 
log: log_append_logfile() add new error path

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agonl: save errno on lxc_netns_set_nsid()
Christian Brauner [Mon, 3 Sep 2018 21:16:13 +0000 (23:16 +0200)] 
nl: save errno on lxc_netns_set_nsid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotree-wide: s/send()/lxc_send_nointr()/g
Christian Brauner [Mon, 3 Sep 2018 12:46:13 +0000 (14:46 +0200)] 
tree-wide: s/send()/lxc_send_nointr()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agofile_utils: add lxc_send_nointr()
Christian Brauner [Mon, 3 Sep 2018 12:43:06 +0000 (14:43 +0200)] 
file_utils: add lxc_send_nointr()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agotree-wide: s/recv()/lxc_recv_nointr()/g
Christian Brauner [Mon, 3 Sep 2018 12:41:48 +0000 (14:41 +0200)] 
tree-wide: s/recv()/lxc_recv_nointr()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolog: save errno on strerror_r()
Christian Brauner [Mon, 3 Sep 2018 12:19:06 +0000 (14:19 +0200)] 
log: save errno on strerror_r()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agolog: do not clobber errno
Christian Brauner [Mon, 3 Sep 2018 10:17:46 +0000 (12:17 +0200)] 
log: do not clobber errno

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocommands: switch to setting errno and returning -1
Christian Brauner [Mon, 3 Sep 2018 00:53:57 +0000 (02:53 +0200)] 
commands: switch to setting errno and returning -1

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
6 years agofile_utils: add lxc_recv_nointr()
Christian Brauner [Mon, 3 Sep 2018 00:51:39 +0000 (02:51 +0200)] 
file_utils: add lxc_recv_nointr()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocommands: better error message
Christian Brauner [Mon, 3 Sep 2018 00:44:40 +0000 (02:44 +0200)] 
commands: better error message

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2585 from 2xsec/bugfix
Christian Brauner [Tue, 4 Sep 2018 08:34:46 +0000 (10:34 +0200)] 
Merge pull request #2585 from 2xsec/bugfix

caps: fix illegal access to array bound

6 years agosyntax error: mismatch brace 2585/head
2xsec [Tue, 4 Sep 2018 05:58:59 +0000 (14:58 +0900)] 
syntax error: mismatch brace

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agonl: remove duplicated define
2xsec [Tue, 4 Sep 2018 05:24:22 +0000 (14:24 +0900)] 
nl: remove duplicated define

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoutils: defensive programming
2xsec [Tue, 4 Sep 2018 02:10:18 +0000 (11:10 +0900)] 
utils: defensive programming

If caller passed the size of array not string length, it is possible to be accessed out of bounds.

Reorder conditions can prevent access invalid index of array.

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agocaps: fix illegal access to array bound
2xsec [Mon, 3 Sep 2018 06:10:05 +0000 (15:10 +0900)] 
caps: fix illegal access to array bound

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
6 years agoMerge pull request #2581 from brauner/2018-09-02/macro
Wolfgang Bumiller [Sun, 2 Sep 2018 08:03:16 +0000 (10:03 +0200)] 
Merge pull request #2581 from brauner/2018-09-02/macro

macro: move MS_* macros

6 years agomacro: move MS_* macros 2581/head
Christian Brauner [Sun, 2 Sep 2018 05:32:23 +0000 (07:32 +0200)] 
macro: move MS_* macros

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2580 from brauner/2018-09-01/revert_blub_revert
Wolfgang Bumiller [Sat, 1 Sep 2018 18:53:32 +0000 (20:53 +0200)] 
Merge pull request #2580 from brauner/2018-09-01/revert_blub_revert

Revert "Revert "tree-wide: use sizeof on static arrays""

6 years agoRevert "Revert "tree-wide: use sizeof on static arrays"" 2580/head
Christian Brauner [Sat, 1 Sep 2018 18:25:07 +0000 (20:25 +0200)] 
Revert "Revert "tree-wide: use sizeof on static arrays""

This reverts commit 2fb7cf0b325d2e34cd6faa2758cbaba6b6c3b99f.

The problem wasn't caused by the reverted commit and was fixed in

commit 0c9b1f826d3 ("macro: calculate buffer lengths correctly")

The full explanation can be taken from the following irc excerpt from
the #lxc-dev channel:

│19:54:47 brauner | there was a bug in one of the standard macros we used
│19:55:01 brauner | and the changes by INTTYPE_TO_STRLEN() caused the issue to surface
│19:55:03 brauner | which is good
│19:55:16 brauner | i sent a branch and stgraber merged it that fixes it
│19:57:56  Blub\0 | so...
│19:58:31  Blub\0 | still doesn't explain how it was the sizeof() patch
│20:07:14 brauner | Blub\0: so here's the long explanation
│20:07:35 brauner | Blub\0: stgraber bumped pid_max on our jenkins test builders
│20:07:53 brauner | Blub\0: because we're running *a lot* of containers
│20:07:56 brauner | in any case
│20:08:06 brauner | there was a buffer
│20:08:12 brauner | LXC_LSMATTRLEN
│20:08:59 brauner | it used to be
│20:09:03 brauner | -/* /proc/pid-to-str/attr/current = (5 + INTTYPE_TO_STRLEN(pid_t) + 7 + 1) */
│20:09:03 brauner | -#define LXC_LSMATTRLEN (5 + INTTYPE_TO_STRLEN(pid_t) + 7 + 1)
│20:09:14 brauner | which one can see is wrong
│20:09:21 brauner | before the INTTYPE patchset
│20:09:40 brauner | INTTYPE_TO_STRLEN(pid_t) was LXC_NUMSTRLEN64
│20:09:45 brauner | which gave you 21 chars
│20:09:57 brauner | so it accounted for the missing parts
│20:10:03 brauner | because the correct macro should've been
│20:10:17 brauner | +/* /proc/        = 6
│20:10:17 brauner | + *               +
│20:10:17 brauner | + * <pid-as-str>  = INTTYPE_TO_STRLEN(pid_t)
│20:10:17 brauner | + *               +
│20:10:17 brauner | + * /attr/        = 6
│20:10:17 brauner | + *               +
│20:10:17 brauner | + * /current      = 8
│20:10:17 brauner | + *               +
│20:10:17 brauner | + * \0            = 1
│20:10:17 brauner | + */
│20:10:17 brauner | +#define LXC_LSMATTRLEN (6 + INTTYPE_TO_STRLEN(pid_t) + 6 + 8 + 1)
│20:10:24  Blub\0 | still
│20:10:31 brauner | the issue was only seen
│20:10:39 brauner | when the pid number hit a specific maximum
│20:10:50  Blub\0 | the sizeof patch only changed instances of actual char buf[A_FIXED_NUMBER] + snprintf(buf, A_FIXED_NUMBER, ...)
│20:10:54 brauner | aka exceeded the newly shortened buffer
│20:11:42 brauner | your patch was a red herring
│20:12:03  Blub\0 | I guess
│20:12:06 brauner | it didn't cause it
│20:12:14 brauner | it just surfaced at the same time it was merged
│20:12:25  Blub\0 | so we can revert the revert then? :)
│20:12:35 brauner | yes, that was th eplan all along

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2579 from brauner/2018-08-31/int64_t_pids
Stéphane Graber [Fri, 31 Aug 2018 23:52:23 +0000 (16:52 -0700)] 
Merge pull request #2579 from brauner/2018-08-31/int64_t_pids

macro: calculate buffer lengths correctly

6 years agomacro: calculate buffer lengths correctly 2579/head
Christian Brauner [Fri, 31 Aug 2018 22:53:33 +0000 (00:53 +0200)] 
macro: calculate buffer lengths correctly

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agocommands: assign before converting to pointer
Christian Brauner [Fri, 31 Aug 2018 22:14:06 +0000 (00:14 +0200)] 
commands: assign before converting to pointer

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoMerge pull request #2578 from brauner/2018-08-31/int64_t_pids
Stéphane Graber [Fri, 31 Aug 2018 21:30:21 +0000 (14:30 -0700)] 
Merge pull request #2578 from brauner/2018-08-31/int64_t_pids

commands: pass around intmax_t

6 years agocommands: pass around intmax_t 2578/head
Christian Brauner [Fri, 31 Aug 2018 19:25:45 +0000 (21:25 +0200)] 
commands: pass around intmax_t

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
6 years agoRevert "tree-wide: use sizeof on static arrays"
Stéphane Graber [Fri, 31 Aug 2018 18:58:17 +0000 (11:58 -0700)] 
Revert "tree-wide: use sizeof on static arrays"

This reverts commit 81a3bb64b4147ac6da3087cb77ac67828a2f2b76.

This commit broke all builders running with pid_max > 32768.

Reverting for now so we can bring the build farm back online.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
6 years agoMerge pull request #2435 from brauner/2018-06-27/storage_managed
Wolfgang Bumiller [Thu, 30 Aug 2018 06:28:08 +0000 (08:28 +0200)] 
Merge pull request #2435 from brauner/2018-06-27/storage_managed

[RFC] conf: introduce lxc.rootfs.managed