]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
5 years agopam: s/MAXPATHLEN/PATH_MAX/g
Christian Brauner [Sun, 7 Oct 2018 08:02:39 +0000 (10:02 +0200)]
pam: s/MAXPATHLEN/PATH_MAX/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agonetwork: s/MAXPATHLEN/PATH_MAX/g
Christian Brauner [Sun, 7 Oct 2018 08:02:14 +0000 (10:02 +0200)]
network: s/MAXPATHLEN/PATH_MAX/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agomacro: s/MAXPATHLEN/PATH_MAX/g
Christian Brauner [Sun, 7 Oct 2018 08:01:59 +0000 (10:01 +0200)]
macro: s/MAXPATHLEN/PATH_MAX/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agolxccontainer: s/MAXPATHLEN/PATH_MAX/g
Christian Brauner [Sun, 7 Oct 2018 08:01:30 +0000 (10:01 +0200)]
lxccontainer: s/MAXPATHLEN/PATH_MAX/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agolsm: s/MAXPATHLEN/PATH_MAX/g
Christian Brauner [Sun, 7 Oct 2018 08:01:13 +0000 (10:01 +0200)]
lsm: s/MAXPATHLEN/PATH_MAX/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agodoc: fix indent
2xsec [Sun, 7 Oct 2018 08:00:50 +0000 (17:00 +0900)]
doc: fix indent

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
5 years agolog: s/MAXPATHLEN/PATH_MAX/g
Christian Brauner [Sun, 7 Oct 2018 08:00:50 +0000 (10:00 +0200)]
log: s/MAXPATHLEN/PATH_MAX/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoconfile: s/MAXPATHLEN/PATH_MAX/g
Christian Brauner [Sun, 7 Oct 2018 07:59:16 +0000 (09:59 +0200)]
confile: s/MAXPATHLEN/PATH_MAX/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoconf: s/MAXPATHLEN/PATH_MAX/g
Christian Brauner [Sun, 7 Oct 2018 07:58:56 +0000 (09:58 +0200)]
conf: s/MAXPATHLEN/PATH_MAX/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocmd: s/MAXPATHLEN/PATH_MAX/g
Christian Brauner [Sun, 7 Oct 2018 07:53:46 +0000 (09:53 +0200)]
cmd: s/MAXPATHLEN/PATH_MAX/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agomacro: add PATH_MAX
Christian Brauner [Sun, 7 Oct 2018 07:53:30 +0000 (09:53 +0200)]
macro: add PATH_MAX

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoparse: report errors when failing config parsing
Christian Brauner [Sat, 6 Oct 2018 22:50:52 +0000 (00:50 +0200)]
parse: report errors when failing config parsing

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoparse: remove access() check
Christian Brauner [Sat, 6 Oct 2018 22:42:44 +0000 (00:42 +0200)]
parse: remove access() check

We can just fail on open() and not waste an additional syscall.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2672 from 2xsec/bugfix
Christian Brauner [Sat, 6 Oct 2018 13:30:12 +0000 (15:30 +0200)]
Merge pull request #2672 from 2xsec/bugfix

remove unused argument

5 years agoMerge pull request #2673 from Blub/2018-10-06/cgfsng-alloc-cleanup
Christian Brauner [Sat, 6 Oct 2018 10:58:43 +0000 (12:58 +0200)]
Merge pull request #2673 from Blub/2018-10-06/cgfsng-alloc-cleanup

cgfsng: use realloc instead of malloc+copy+free

5 years agocgfsng: use realloc instead of malloc+copy+free
Wolfgang Bumiller [Sat, 6 Oct 2018 09:12:08 +0000 (11:12 +0200)]
cgfsng: use realloc instead of malloc+copy+free

Signed-off-by: Wolfgang Bumiller <w.bumiller@errno.eu>
5 years agotools: lxc-unshare: remove unnecessary initialization
2xsec [Fri, 5 Oct 2018 02:08:41 +0000 (11:08 +0900)]
tools: lxc-unshare: remove unnecessary initialization

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
5 years agotools: lxc-start: remove unused argument
2xsec [Fri, 5 Oct 2018 02:07:02 +0000 (11:07 +0900)]
tools: lxc-start: remove unused argument

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
5 years agoMerge pull request #2671 from brauner/2018-10-03/syscall_wrappers
Wolfgang Bumiller [Wed, 3 Oct 2018 12:13:57 +0000 (14:13 +0200)]
Merge pull request #2671 from brauner/2018-10-03/syscall_wrappers

syscalls: move wrappers and raw syscalls to appropriate files

5 years agoMerge pull request #2670 from brauner/2018-10-03/cgfsng_fix_race
Wolfgang Bumiller [Wed, 3 Oct 2018 12:11:57 +0000 (14:11 +0200)]
Merge pull request #2670 from brauner/2018-10-03/cgfsng_fix_race

cgfsng: close tiny race window

5 years agoraw_syscalls: move lxc_raw_gettid()
Christian Brauner [Wed, 3 Oct 2018 11:10:55 +0000 (13:10 +0200)]
raw_syscalls: move lxc_raw_gettid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agosyscall_wrappers: move signalfd()
Christian Brauner [Wed, 3 Oct 2018 11:08:51 +0000 (13:08 +0200)]
syscall_wrappers: move signalfd()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agosyscall_wrappers: move unshare()
Christian Brauner [Wed, 3 Oct 2018 11:03:30 +0000 (13:03 +0200)]
syscall_wrappers: move unshare()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agosyscall_wrappers: move sethostname()
Christian Brauner [Wed, 3 Oct 2018 10:59:32 +0000 (12:59 +0200)]
syscall_wrappers: move sethostname()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agosyscall_wrappers: move setns()
Christian Brauner [Wed, 3 Oct 2018 10:57:32 +0000 (12:57 +0200)]
syscall_wrappers: move setns()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agosyscall_wrappers: move memfd_create()
Christian Brauner [Wed, 3 Oct 2018 10:49:46 +0000 (12:49 +0200)]
syscall_wrappers: move memfd_create()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgfsng: handle v1 cpuset hierarchy first
Christian Brauner [Wed, 3 Oct 2018 10:23:36 +0000 (12:23 +0200)]
cgfsng: handle v1 cpuset hierarchy first

If the value of cgroup.clone_children in our immediate ancestor cgroup
is 0 then the cpuset of any cgroups we create in subtrees will be empty
and hence we'll copy an empty cpuset at which point we cannot enter the
cpuset cgroup.
Avoid this problem by initializing cgroup.clone_children to 1 an copying
the initialized cpuset of our immediate ancestor. Note, that the cpuset
of our immediate ancestor must be initialized and ours as well otherwise
we couldn't be located in this cgroup.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoRevert "Revert "cgfsng: avoid tiny race window""
Christian Brauner [Wed, 3 Oct 2018 10:20:49 +0000 (12:20 +0200)]
Revert "Revert "cgfsng: avoid tiny race window""

This reverts commit c5e7a7acbf23f0c267179b3318af41423b39493a.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoRevert "cgfsng: avoid tiny race window"
Stéphane Graber [Tue, 2 Oct 2018 22:02:41 +0000 (18:02 -0400)]
Revert "cgfsng: avoid tiny race window"

This reverts commit 17e55991744576bca20e370a6d829da99c3fc801.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
5 years agoMerge pull request #2669 from brauner/2018-10-02/bugfixes
Stéphane Graber [Tue, 2 Oct 2018 19:28:24 +0000 (15:28 -0400)]
Merge pull request #2669 from brauner/2018-10-02/bugfixes

utils: fix lxc_set_death_signal()

5 years agoutils: fix lxc_set_death_signal()
Christian Brauner [Tue, 2 Oct 2018 18:59:34 +0000 (20:59 +0200)]
utils: fix lxc_set_death_signal()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2668 from brauner/2018-10-02/cgroups_monitor_fixes
Stéphane Graber [Tue, 2 Oct 2018 18:40:55 +0000 (14:40 -0400)]
Merge pull request #2668 from brauner/2018-10-02/cgroups_monitor_fixes

cgfsng: do not reuse another monitor's cgroup

5 years agocgfsng: avoid tiny race window
Christian Brauner [Tue, 2 Oct 2018 15:40:25 +0000 (17:40 +0200)]
cgfsng: avoid tiny race window

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgfsng: do not reuse another monitor's cgroup
Christian Brauner [Tue, 2 Oct 2018 15:27:55 +0000 (17:27 +0200)]
cgfsng: do not reuse another monitor's cgroup

Otherwise we will create a race.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2667 from brauner/2018-10-02/prefault_mmaped_config_file
Stéphane Graber [Tue, 2 Oct 2018 15:28:28 +0000 (11:28 -0400)]
Merge pull request #2667 from brauner/2018-10-02/prefault_mmaped_config_file

parse: prefault config file with MAP_POPULATE

5 years agoparse: prefault config file with MAP_POPULATE
Christian Brauner [Tue, 2 Oct 2018 14:40:13 +0000 (16:40 +0200)]
parse: prefault config file with MAP_POPULATE

When we call lxc_file_for_each_line_mmap() we will always parse the
whole config file. Prefault it in case it is really long to optimize
performance.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2666 from 2xsec/bugfix
Christian Brauner [Tue, 2 Oct 2018 10:50:51 +0000 (12:50 +0200)]
Merge pull request #2666 from 2xsec/bugfix

cgroups: remove unnecessary line

5 years agonetns_iaddrs: remove unused functions
2xsec [Tue, 2 Oct 2018 09:55:33 +0000 (18:55 +0900)]
netns_iaddrs: remove unused functions

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
5 years agocgroups: remove unnecessary line
2xsec [Tue, 2 Oct 2018 09:49:16 +0000 (18:49 +0900)]
cgroups: remove unnecessary line

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
5 years agoMerge pull request #2664 from brauner/2018-09-30/syscall_wrappers
Stéphane Graber [Sun, 30 Sep 2018 21:02:55 +0000 (17:02 -0400)]
Merge pull request #2664 from brauner/2018-09-30/syscall_wrappers

syscalls: add wrappers and explicit raw syscalls

5 years agoMerge pull request #2665 from brauner/2018-09-30/netns_ifaddrs
Stéphane Graber [Sun, 30 Sep 2018 21:01:08 +0000 (17:01 -0400)]
Merge pull request #2665 from brauner/2018-09-30/netns_ifaddrs

netns_ifaddrs: only use struct rtnl_link_stats64

5 years agonetns_ifaddrs: only use struct rtnl_link_stats64
Christian Brauner [Sun, 30 Sep 2018 18:58:06 +0000 (20:58 +0200)]
netns_ifaddrs: only use struct rtnl_link_stats64

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agotests: add missing build dependencies
Christian Brauner [Sun, 30 Sep 2018 18:23:54 +0000 (20:23 +0200)]
tests: add missing build dependencies

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoautotools: fix lxc-usernsexec build
Christian Brauner [Sun, 30 Sep 2018 18:13:02 +0000 (20:13 +0200)]
autotools: fix lxc-usernsexec build

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoautotools: fix lxc-user-nic build
Christian Brauner [Sun, 30 Sep 2018 18:10:36 +0000 (20:10 +0200)]
autotools: fix lxc-user-nic build

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoautotools: fix lxc-monitord build
Christian Brauner [Sun, 30 Sep 2018 18:08:46 +0000 (20:08 +0200)]
autotools: fix lxc-monitord build

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoautotools: fix lxc init build
Christian Brauner [Sun, 30 Sep 2018 18:07:02 +0000 (20:07 +0200)]
autotools: fix lxc init build

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoraw_syscalls: add lxc_raw_getpid()
Christian Brauner [Sun, 30 Sep 2018 18:05:17 +0000 (20:05 +0200)]
raw_syscalls: add lxc_raw_getpid()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoraw_syscalls: add lxc_raw_clone{_cb}()
Christian Brauner [Sun, 30 Sep 2018 17:47:58 +0000 (19:47 +0200)]
raw_syscalls: add lxc_raw_clone{_cb}()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2663 from brauner/2018-09-30/netns_ifaddrs
Stéphane Graber [Sun, 30 Sep 2018 18:01:06 +0000 (14:01 -0400)]
Merge pull request #2663 from brauner/2018-09-30/netns_ifaddrs

netns_ifaddrs: handle IFLA_STATS{64} correctly

5 years agoraw_syscalls: add lxc_raw_execveat()
Christian Brauner [Sun, 30 Sep 2018 10:43:15 +0000 (12:43 +0200)]
raw_syscalls: add lxc_raw_execveat()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agosyscall_wrappers: add pivot_root()
Christian Brauner [Sun, 30 Sep 2018 10:41:34 +0000 (12:41 +0200)]
syscall_wrappers: add pivot_root()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agonetns_ifaddrs: handle IFLA_STATS{64} correctly
Christian Brauner [Sun, 30 Sep 2018 10:25:27 +0000 (12:25 +0200)]
netns_ifaddrs: handle IFLA_STATS{64} correctly

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2661 from brauner/2018-09-28/relro_bind_now
Stéphane Graber [Fri, 28 Sep 2018 23:15:11 +0000 (01:15 +0200)]
Merge pull request #2661 from brauner/2018-09-28/relro_bind_now

autotools: support -z relro and -z now

5 years agoautotools: support -z relro and -z now
Christian Brauner [Fri, 28 Sep 2018 20:58:20 +0000 (22:58 +0200)]
autotools: support -z relro and -z now

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2658 from brauner/2018-09-28/keyctl
Stéphane Graber [Fri, 28 Sep 2018 12:13:47 +0000 (14:13 +0200)]
Merge pull request #2658 from brauner/2018-09-28/keyctl

utils: add lxc_setup_keyring()

5 years agoutils: add lxc_setup_keyring()
Christian Brauner [Fri, 28 Sep 2018 11:14:25 +0000 (13:14 +0200)]
utils: add lxc_setup_keyring()

Allocate a new keyring if we can to prevent information leak.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoconfigure: fix -Wimplicit-fallthrough check
Christian Brauner [Fri, 28 Sep 2018 11:29:58 +0000 (13:29 +0200)]
configure: fix -Wimplicit-fallthrough check

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2657 from ssup2/master
Stéphane Graber [Fri, 28 Sep 2018 10:32:02 +0000 (12:32 +0200)]
Merge pull request #2657 from ssup2/master

oci-template: Add logic for no /etc/passwd, group

5 years agooci-template: Add logic for no /etc/passwd, group
Jungsub Shin [Fri, 28 Sep 2018 10:21:08 +0000 (19:21 +0900)]
oci-template: Add logic for no /etc/passwd, group

OCI image spec dosen't specify action when there is
no /etc/passwd or /etc/group. So if there is no
/etc/passwd with string user info, set uid to 0. If there
is no /etc/group with string group info, set gid to 0.

Signed-off-by: Jungsub Shin jungsub_shin@tmax.co.kr
5 years agoMerge pull request #2656 from brauner/2018-09-28/fix_btrfs_regression
Stéphane Graber [Fri, 28 Sep 2018 10:13:39 +0000 (12:13 +0200)]
Merge pull request #2656 from brauner/2018-09-28/fix_btrfs_regression

btrfs: fix btrfs containers

5 years agobtrfs: fix btrfs containers
Christian Brauner [Fri, 28 Sep 2018 09:24:46 +0000 (11:24 +0200)]
btrfs: fix btrfs containers

Closes #2612.
Closes #2655.

Fixes: 9de31d5a1394 ("tree-wide: s/strncpy()/strlcpy()/g")
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2629 from ssup2/master
Stéphane Graber [Fri, 28 Sep 2018 08:35:51 +0000 (10:35 +0200)]
Merge pull request #2629 from ssup2/master

template: oci template supports for char user info

5 years agotemplate: oci template supports for char user info
Jungsub Shin [Fri, 21 Sep 2018 06:29:37 +0000 (15:29 +0900)]
template: oci template supports for char user info

oci template changes character user info to uid, gid
according to OCI image spec.

Signed-off-by: Jungsub Shin jungsub_shin@tmax.co.kr
5 years agoMerge pull request #2653 from brauner/2018-09-27/minor_tweaks
Stéphane Graber [Thu, 27 Sep 2018 12:30:57 +0000 (14:30 +0200)]
Merge pull request #2653 from brauner/2018-09-27/minor_tweaks

cgroups: tweaks

5 years agocgroup: make monitor_pattern const
Christian Brauner [Thu, 27 Sep 2018 11:36:17 +0000 (13:36 +0200)]
cgroup: make monitor_pattern const

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgfsng: log cgroup names for monitor and container
Christian Brauner [Thu, 27 Sep 2018 11:35:34 +0000 (13:35 +0200)]
cgfsng: log cgroup names for monitor and container

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2643 from brauner/2018-09-23/cgroup_scoping_fixes
Wolfgang Bumiller [Thu, 27 Sep 2018 11:12:56 +0000 (13:12 +0200)]
Merge pull request #2643 from brauner/2018-09-23/cgroup_scoping_fixes

cgroups: implement monitor cgroup deletion

5 years agoMerge pull request #2652 from brauner/lxc/master
Stéphane Graber [Thu, 27 Sep 2018 07:51:48 +0000 (03:51 -0400)]
Merge pull request #2652 from brauner/lxc/master

tree-wide: fix includes to fix bionic builds

5 years agotree-wide: fix includes to fix bionic builds
Christian Brauner [Wed, 26 Sep 2018 22:51:59 +0000 (00:51 +0200)]
tree-wide: fix includes to fix bionic builds

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2649 from brauner/lxc/master
Stéphane Graber [Wed, 26 Sep 2018 17:17:19 +0000 (13:17 -0400)]
Merge pull request #2649 from brauner/lxc/master

netns_ifaddrs: fix missing include

5 years agoMerge pull request #2650 from tenforward/japanese
Christian Brauner [Wed, 26 Sep 2018 16:30:31 +0000 (18:30 +0200)]
Merge pull request #2650 from tenforward/japanese

doc: Add -u and -g args to Japanese lxc-attach(1) and lxc-execute(1)

5 years agodoc: Add -u and -g args to Japanese lxc-attach(1) and lxc-execute(1)
KATOH Yasufumi [Wed, 26 Sep 2018 16:17:04 +0000 (01:17 +0900)]
doc: Add -u and -g args to Japanese lxc-attach(1) and lxc-execute(1)

Update for commit ddd51fd and 0840104

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
5 years agonetns_ifaddrs: fix missing include
Christian Brauner [Wed, 26 Sep 2018 16:14:46 +0000 (18:14 +0200)]
netns_ifaddrs: fix missing include

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2648 from brauner/2018-09-26/compiler_attributes
Stéphane Graber [Wed, 26 Sep 2018 14:44:51 +0000 (10:44 -0400)]
Merge pull request #2648 from brauner/2018-09-26/compiler_attributes

compiler: add __hot attribute

5 years agoMerge pull request #2647 from brauner/2018-09-23/noreturn_android
Stéphane Graber [Wed, 26 Sep 2018 14:44:36 +0000 (10:44 -0400)]
Merge pull request #2647 from brauner/2018-09-23/noreturn_android

compiler: fix __noreturn on bionic

5 years agocompiler: add __hot attribute
Christian Brauner [Wed, 26 Sep 2018 12:52:27 +0000 (14:52 +0200)]
compiler: add __hot attribute

This instructs the compiler to better optimize the config parsing code.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocompiler: fix __noreturn on bionic
Christian Brauner [Wed, 26 Sep 2018 12:38:41 +0000 (14:38 +0200)]
compiler: fix __noreturn on bionic

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgfsng: do not go into infinite loop
Christian Brauner [Wed, 26 Sep 2018 12:16:10 +0000 (14:16 +0200)]
cgfsng: do not go into infinite loop

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgfsng: s/25/INTTYPE_TO_STRLEN(pid_t)/g
Christian Brauner [Wed, 26 Sep 2018 12:13:05 +0000 (14:13 +0200)]
cgfsng: s/25/INTTYPE_TO_STRLEN(pid_t)/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgfsng: ensure no-reuse in cgfsng_monitor_create()
Christian Brauner [Mon, 24 Sep 2018 09:04:04 +0000 (11:04 +0200)]
cgfsng: ensure no-reuse in cgfsng_monitor_create()

The same way we need to ensure that no existing cgroups are reused for
the payload in cgfsng_payload_create() we need to ensure that no
existing cgroups are reused for the monitor. Technially this is less of
an issue since there currently is no logic for the monitor to apply
limits to its cgroup but it is still the proper way to do it.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgroups: introduce helper macros
Christian Brauner [Sun, 23 Sep 2018 22:14:22 +0000 (00:14 +0200)]
cgroups: introduce helper macros

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgfsng: add cgfsng_monitor_destroy()
Christian Brauner [Sun, 23 Sep 2018 18:11:56 +0000 (20:11 +0200)]
cgfsng: add cgfsng_monitor_destroy()

Since we switched to the new cgroup scoping scheme that places the
container payload into lxc.payload/<container-name> and
lxc.monitor/<container-name> deletion becomes slightly more complicated.
The monitor will be able to rm_rf(lxc.payload/<container-name>) but will
not be able to rm_rf(lxc.monitor/<container-name>) since it will be
located in that cgroup and it will thus be populated.
My current solution to this is to create a lxc.pivot cgroup that only
exists so that the monitor process on container stop can pivot into it,
call rm_rf(lxc.monitor/<container-name>) and can then exit. This group
has not function whatsoever apart from this and can thus be shared by
all monitor processes.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocgfsng: s/cgfsng_destroy/cgfsng_payload_destroy/g
Christian Brauner [Sun, 23 Sep 2018 15:55:27 +0000 (17:55 +0200)]
cgfsng: s/cgfsng_destroy/cgfsng_payload_destroy/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2618 from CameronNemo/lxcmountroot
Stéphane Graber [Tue, 25 Sep 2018 18:46:21 +0000 (14:46 -0400)]
Merge pull request #2618 from CameronNemo/lxcmountroot

apparmor: account for specified rootfs path (closes #2617)

5 years agoMerge pull request #2646 from brauner/2018-09-24/cgroup_tweaks
Stéphane Graber [Mon, 24 Sep 2018 21:35:03 +0000 (23:35 +0200)]
Merge pull request #2646 from brauner/2018-09-24/cgroup_tweaks

cgfsng: set errno to ENOENT on get_hierarchy()

5 years agocgfsng: set errno to ENOENT on get_hierarchy()
Christian Brauner [Mon, 24 Sep 2018 20:58:45 +0000 (22:58 +0200)]
cgfsng: set errno to ENOENT on get_hierarchy()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agodoc: tweak documentation a little
Christian Brauner [Mon, 24 Sep 2018 20:07:34 +0000 (22:07 +0200)]
doc: tweak documentation a little

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2645 from stgraber/master
Christian Brauner [Mon, 24 Sep 2018 19:35:15 +0000 (21:35 +0200)]
Merge pull request #2645 from stgraber/master

stop: Only freeze if freezer is available

5 years agostop: Only freeze if freezer is available
Stéphane Graber [Mon, 24 Sep 2018 18:41:37 +0000 (14:41 -0400)]
stop: Only freeze if freezer is available

Closes #2644

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
5 years agoMerge pull request #2640 from brauner/2018-09-23/netns_getifaddrs
Stéphane Graber [Sun, 23 Sep 2018 22:35:21 +0000 (00:35 +0200)]
Merge pull request #2640 from brauner/2018-09-23/netns_getifaddrs

network: add netns_getifaddrs() implementation

5 years agoautotools: fix lxc_user_nic build
Christian Brauner [Sun, 23 Sep 2018 19:00:28 +0000 (21:00 +0200)]
autotools: fix lxc_user_nic build

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agonetns_ifaddrs: mark casts as safe
Christian Brauner [Sun, 23 Sep 2018 18:50:54 +0000 (20:50 +0200)]
netns_ifaddrs: mark casts as safe

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agotree_wide: switch to netns_getifaddrs()
Christian Brauner [Sun, 23 Sep 2018 13:40:20 +0000 (15:40 +0200)]
tree_wide: switch to netns_getifaddrs()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agonetwork: add netns_getifaddrs() implementation
Christian Brauner [Sun, 23 Sep 2018 13:29:22 +0000 (15:29 +0200)]
network: add netns_getifaddrs() implementation

This commit introduces my concept of a network namespace aware
getifaddrs(), i.e. netns_getifaddrs(). This presupposes a kernel that
carries my IF{L}A_TARGET_NETNSID patches:

struct netns_ifaddrs {
        struct netns_ifaddrs *ifa_next;

        /* Can - but shouldn't be - NULL. */
        char *ifa_name;

        /* This field is not present struct ifaddrs. */
        int ifa_ifindex;

        unsigned ifa_flags;

        /* This field is not present struct ifaddrs. */
        int ifa_mtu;

        /* This field is not present struct ifaddrs. */
        int ifa_prefixlen;

        struct sockaddr *ifa_addr;
        struct sockaddr *ifa_netmask;
        union {
                struct sockaddr *ifu_broadaddr;
                struct sockaddr *ifu_dstaddr;
        } ifa_ifu;

        /* If you don't know what this is for don't touch it. */
        void *ifa_data;
};

which is a superset of struct ifaddrs. It contains additional
information such as the mtu, ifindex of the interface and the prefix
length of the address.
Note that the field ordering is different. So don't get any ideas of
using memcpy() to copy from an old struct ifaddrs into a struct
netns_ifaddrs.

int netns_getifaddrs(struct netns_ifaddrs **ifap, __s32 netns_id, bool *netnsid_aware)

takes a network namespace identifier as argument which identifies the
target network namespace.
If successfull, i.e. netns_getifaddrs() returns 0, callers should check
the bool *netnsid_aware return argument. If it is true then
RTM_GET{ADDR,LINK} requests are fully netnsid aware. If it is false then
they are not and the information returned in struct netns_ifaddrs does
*not* contain correct information about the target network namespace
identified by netnsid.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoMerge pull request #2639 from brauner/2018-09-23/compiler_based_hardening
Stéphane Graber [Sun, 23 Sep 2018 18:43:56 +0000 (20:43 +0200)]
Merge pull request #2639 from brauner/2018-09-23/compiler_based_hardening

compiler: compiler based hardening

5 years agoMerge pull request #2642 from brauner/2018-09-23/android
Stéphane Graber [Sun, 23 Sep 2018 18:43:46 +0000 (20:43 +0200)]
Merge pull request #2642 from brauner/2018-09-23/android

compiler: __attribute__((noreturn)) on bionic

5 years agoautotools: support -Wstrict-prototypes
Christian Brauner [Sun, 23 Sep 2018 11:19:55 +0000 (13:19 +0200)]
autotools: support -Wstrict-prototypes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agoautotools: support -Wcast-align
Christian Brauner [Sun, 23 Sep 2018 11:16:52 +0000 (13:16 +0200)]
autotools: support -Wcast-align

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agocompiler: __attribute__((noreturn)) on bionic
Christian Brauner [Sun, 23 Sep 2018 18:16:12 +0000 (20:16 +0200)]
compiler: __attribute__((noreturn)) on bionic

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>