]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
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>
5 years agoMerge pull request #2637 from brauner/2018-09-22/bugfixes
Stéphane Graber [Sun, 23 Sep 2018 17:31:05 +0000 (19:31 +0200)]
Merge pull request #2637 from brauner/2018-09-22/bugfixes

macro: add STRLITERALLEN() and STRARRAYLEN()

5 years agoMerge pull request #2641 from brauner/2018-09-23/cgroup_scoping_fixes
Stéphane Graber [Sun, 23 Sep 2018 17:30:21 +0000 (19:30 +0200)]
Merge pull request #2641 from brauner/2018-09-23/cgroup_scoping_fixes

cgfsng: copy parent's cpu settings for monitor too

5 years agocgfsng: copy parent's cpu settings for monitor too
Christian Brauner [Sun, 23 Sep 2018 14:26:31 +0000 (16:26 +0200)]
cgfsng: copy parent's cpu settings for monitor too

Closes https://github.com/lxc/lxd/issues/5060.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
5 years agotree-wide: replace sizeof() with SIZEOF2STRLEN()
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>
5 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>
5 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>
5 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>
5 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>
5 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

5 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

5 years agoautotools: fix wrong AX_CHECK_COMPILE_FLAG test
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>
5 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

5 years agocgfsng: add missing __cgfsng_ops__ attributes
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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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

5 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()

5 years agoautotools: add -Wimplicit-fallthrough
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>
5 years agoapi_extensions: introduce lxc_has_api_extension()
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>
5 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

5 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

5 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

5 years agocgfsng: mark ops with __cgfsng_ops__ attribute
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>
5 years agoconfile: s/lxc.cgroup.keep/lxc.cgroup.relative/g
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>
5 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()

5 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

5 years agostart: s/backgrounded/daemonize/g
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>
5 years agoconf: realpath() uses null as second parameter to prevent buffer overflow
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>
5 years agoapparmor: account for specified rootfs path (closes #2617)
Cameron Nemo [Thu, 20 Sep 2018 22:55:21 +0000 (15:55 -0700)]
apparmor: account for specified rootfs path (closes #2617)

Signed-off-by: Cameron Nemo <camerontnorman@gmail.com>
5 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

5 years agolxccontainer: remove locks from get_cgroup_item()
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>
5 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>
5 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

5 years agoaf_unix: add function to remove duplicated codes for set sockaddr
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>
5 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

5 years agoattach: report standard shell exit codes
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>
5 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

5 years agosecurity: fix too wide or inconsistent non-owner permissions
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>
5 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

5 years agoattach: don't shutdown ipc socket in child
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>
5 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

5 years agolog: add additional info of dlog
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>
5 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>
5 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>
5 years agonetwork: minor tweaks
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>
5 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

5 years agofile_utils: remove unused function
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>
5 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>
5 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>
5 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

5 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>
5 years agoconf: remove extra MS_BIND with sysfs:mixed
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>
5 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

5 years agolxccontainer: use correct pid_t type
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>
5 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

5 years agoutils: make lxc_switch_uid_gid() return bool
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>
5 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>
5 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>
5 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]

5 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>
5 years agolog: support dlog
2xsec [Tue, 11 Sep 2018 07:04:25 +0000 (16:04 +0900)]
log: support dlog

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
5 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>
5 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>
5 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

5 years agolxc: fix build with --disable-werror
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>
5 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

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

Signed-off-by: 2xsec <dh48.jeong@samsung.com>