]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
8 years agoChange Fedora mirror downloads to https by default, rsync optional 1371/head
Reto Gantenbein [Tue, 7 Feb 2017 05:59:15 +0000 (06:59 +0100)] 
Change Fedora mirror downloads to https by default, rsync optional

This mainly affects the download of the bootstrap image when
running on a non-Fedora host and the initial download of the
repo and release RPMs. The container rootfs creation will then
be verified by dnf against the GPG signatures in the repos RPM.

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
8 years agoQuery Fedora mirror list over HTTPS
Reto Gantenbein [Mon, 6 Feb 2017 07:17:13 +0000 (08:17 +0100)] 
Query Fedora mirror list over HTTPS

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
8 years agoRestrict package locales to en_US
Reto Gantenbein [Thu, 5 Jan 2017 06:22:35 +0000 (07:22 +0100)] 
Restrict package locales to en_US

Adjust locale setup to official Fedora cloud setup. This will
shrink the image size for e.g. Fedora 25 from around 350MB to
260MB.

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
8 years agoFix chroot rpmdb path
Reto Gantenbein [Sat, 7 Jan 2017 01:36:38 +0000 (02:36 +0100)] 
Fix chroot rpmdb path

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
8 years agoFix installing multiple packages given with '--packages'
Reto Gantenbein [Fri, 6 Jan 2017 06:06:03 +0000 (07:06 +0100)] 
Fix installing multiple packages given with '--packages'

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
8 years agoFix version comparison
Reto Gantenbein [Fri, 6 Jan 2017 06:03:04 +0000 (07:03 +0100)] 
Fix version comparison

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
8 years agoExplicitly mount squashfs in case autodetection fails
Reto Gantenbein [Mon, 2 Jan 2017 16:13:11 +0000 (17:13 +0100)] 
Explicitly mount squashfs in case autodetection fails

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
8 years agoAlso add lxc-fedora-legacy to AC_CONFIG_FILES
Reto Gantenbein [Sun, 1 Jan 2017 17:53:01 +0000 (18:53 +0100)] 
Also add lxc-fedora-legacy to AC_CONFIG_FILES

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
8 years agoComplete rework of lxc-fedora template
Reto Gantenbein [Sat, 31 Dec 2016 00:43:10 +0000 (01:43 +0100)] 
Complete rework of lxc-fedora template

Heavily refactored version of the Fedora container creation template.
Removed compatibility to unsupported Fedora releases including sysvinit
and yum stuff. Added new commandline arguments found in other templates:

  --mirror   : To set custom HTTP(s) Fedora download mirror
  --packages : List of custom packages to install into a new container
  --debug    : Run with shell script with 'set -x'

There are also some new environment variables which can be used to
customize the template behaviour. See --help output.

Supports Fedora >=24. By default Fedora 25 will be installed except on
Fedora hosts, where the host release is taken. To simplify the code
path (or at least not make it more complex) all non-Fedora hosts will
now use the LiveOS-image based bootstrap environment even when they
would natively support rpm, yum or even dnf (e.g. Gentoo, CentOS).

Mainly runs systemd services by default (journald, networkd, resolved
logind).

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
8 years agoRename fedora template to fedora-legacy
Reto Gantenbein [Sun, 25 Dec 2016 17:09:06 +0000 (18:09 +0100)] 
Rename fedora template to fedora-legacy

Signed-off-by: Reto Gantenbein <reto.gantenbein@linuxmonk.ch>
8 years agoMerge pull request #1360 from ffontaine/master
Christian Brauner [Mon, 19 Dec 2016 08:07:55 +0000 (09:07 +0100)] 
Merge pull request #1360 from ffontaine/master

Add --enable-gnutls option

8 years agoAdd --enable-gnutls option 1360/head
Fabrice Fontaine [Sun, 18 Dec 2016 20:39:24 +0000 (21:39 +0100)] 
Add --enable-gnutls option

Previously HAVE_LIBGNUTLS was never set in config.h even if gnutls was
detected as AC_CHECK_LIB default action-if-found was overriden by
enable_gnutls=yes
This patch adds an --enable-gnutls option and will call AC_CHECK_LIB
with the default action to write HAVE_LIBGNUTLS in config.h

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
8 years agoMerge pull request #1343 from lifupan/master
Serge Hallyn [Fri, 16 Dec 2016 18:46:32 +0000 (12:46 -0600)] 
Merge pull request #1343 from lifupan/master

confile: support the network link string pattern matching

8 years agoMerge pull request #1358 from evgeni/no-default-passwords
Christian Brauner [Thu, 15 Dec 2016 23:16:34 +0000 (00:16 +0100)] 
Merge pull request #1358 from evgeni/no-default-passwords

do not set insecure passwords

8 years agoMerge pull request #1357 from evgeni/opensuse-systemd-fixes
Christian Brauner [Thu, 15 Dec 2016 23:15:47 +0000 (00:15 +0100)] 
Merge pull request #1357 from evgeni/opensuse-systemd-fixes

OpenSUSE systemd fixes

8 years agodo not set insecure passwords 1358/head
Evgeni Golov [Thu, 15 Dec 2016 18:52:50 +0000 (19:52 +0100)] 
do not set insecure passwords

Signed-off-by: Evgeni Golov <evgeni@debian.org>
8 years agolxc-opensuse: rm poweroff.target -> sigpwr.target copy 1357/head
Evgeni Golov [Thu, 15 Dec 2016 19:02:10 +0000 (20:02 +0100)] 
lxc-opensuse: rm poweroff.target -> sigpwr.target copy

Given commit 330ae3d350e060e5702a0e5ef5d0faeeeea8df6e:

    lxccontainer: detect if we should send SIGRTMIN+3

    This is required by systemd to cleanly shutdown. Other init systems should not
    have SIGRTMIN+3 in the blocked signals set.

we should stop poking around with sigpwr.target for systemd.

Signed-off-by: Evgeni Golov <evgeni@debian.org>
8 years agodon't try to get stuff from /usr/lib/systemd on the host
Evgeni Golov [Thu, 15 Dec 2016 18:59:13 +0000 (19:59 +0100)] 
don't try to get stuff from /usr/lib/systemd on the host

it might not even be there…

Signed-off-by: Evgeni Golov <evgeni@debian.org>
8 years agoconfile: support the network link string pattern matching 1343/head
fli [Tue, 6 Dec 2016 08:59:52 +0000 (00:59 -0800)] 
confile: support the network link string pattern matching

Enable lxc network config support the following type and link:

lxc.network.type = phys
lxc.network.link = eth+

Here, the suffix '+' will trigger a string pattern matching
and when lxc find any network interfaces name prefixed with
"eth" such as "eth0", "eth1", "ethxxxx" and so on, it will
try to move them into the container's namespace; If it didn't
find any matching, it would do nothing for this configure
line.

Signed-off-by: fli <fupan.li@windriver.com>
8 years agoMerge pull request #1354 from tsdmgz/leap-422-template
Christian Brauner [Mon, 12 Dec 2016 23:11:28 +0000 (00:11 +0100)] 
Merge pull request #1354 from tsdmgz/leap-422-template

templates: update openSUSE release to 42.2

8 years agoMerge pull request #1352 from evgeni/powerpc
Christian Brauner [Mon, 12 Dec 2016 21:37:44 +0000 (22:37 +0100)] 
Merge pull request #1352 from evgeni/powerpc

Debian: powerpc and architecture fixes

8 years agoRemove libgcc_s1 from openSUSE template 1354/head
Terzeus S. Dominguez [Mon, 12 Dec 2016 21:01:05 +0000 (05:01 +0800)] 
Remove libgcc_s1 from openSUSE template

Removed libgcc_s1 because it breaks container building for openSUSE.

Related: openSUSE/obs-build#188

Signed-off-by: Terzeus S. Dominguez <tsdmgz@gmail.com>
8 years agotemplates/lxc-debian.in: handle ppc hostarch -> powerpc 1352/head
Santiago Ruano Rincón [Mon, 12 Dec 2016 10:12:26 +0000 (11:12 +0100)] 
templates/lxc-debian.in: handle ppc hostarch -> powerpc

Signed-off-by: Santiago Ruano Rincón <santiago@debian.org>
Signed-off-by: Evgeni Golov <evgeni@debian.org>
8 years agotemplates/lxc-debian.in: Fix typo in calling dpkg with --print-foreign-architectures...
Santiago Ruano Rincón [Mon, 12 Dec 2016 10:00:39 +0000 (11:00 +0100)] 
templates/lxc-debian.in: Fix typo in calling dpkg with --print-foreign-architectures option

Signed-off-by: Santiago Ruano Rincón <santiago@debian.org>
Signed-off-by: Evgeni Golov <evgeni@debian.org>
8 years agoSet openSUSE to be unconfined by AppArmor
Terzeus S. Dominguez [Mon, 12 Dec 2016 19:51:18 +0000 (03:51 +0800)] 
Set openSUSE to be unconfined by AppArmor

Uncommented lxc.aa_profile = unconfined. Otherwise, container fails to
start up.

Signed-off-by: Terzeus S. Dominguez <tsdmgz@gmail.com>
8 years agoChange openSUSE default release to Leap 42.2
Terzeus S. Dominguez [Mon, 12 Dec 2016 17:04:31 +0000 (01:04 +0800)] 
Change openSUSE default release to Leap 42.2

Signed-off-by: Terzeus S. Dominguez <tsdmgz@gmail.com>
8 years agoUpdate openSUSE template for Leap 42.2
Terzeus S. Dominguez [Mon, 12 Dec 2016 16:56:35 +0000 (00:56 +0800)] 
Update openSUSE template for Leap 42.2

Aside from adding a 42.2 option, $DISTRO comparisons for Leap have been
changed [ exp ] => [[ exp ]] to accomodate pattern matching for future
releases.

Signed-off-by: Terzeus S. Dominguez <tsdmgz@gmail.com>
8 years agoMerge pull request #1351 from Blub/cleanup/save-errno
Stéphane Graber [Sat, 10 Dec 2016 18:43:08 +0000 (19:43 +0100)] 
Merge pull request #1351 from Blub/cleanup/save-errno

conf, attach: save errno across call to close

8 years agoconf, attach: save errno across call to close 1351/head
Wolfgang Bumiller [Sat, 10 Dec 2016 09:18:27 +0000 (10:18 +0100)] 
conf, attach: save errno across call to close

Save errno across some calls to close() since it can be
interrupted.

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
8 years agoMerge pull request #1346 from brauner/2016-11-08/fix_attach_fd_leak_master
Stéphane Graber [Fri, 9 Dec 2016 09:37:06 +0000 (10:37 +0100)] 
Merge pull request #1346 from brauner/2016-11-08/fix_attach_fd_leak_master

attach: close lsm label file descriptor

8 years agoattach: close lsm label file descriptor 1346/head
Christian Brauner [Thu, 8 Dec 2016 22:13:11 +0000 (23:13 +0100)] 
attach: close lsm label file descriptor

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1344 from FooDeas/fix-getty
Christian Brauner [Thu, 8 Dec 2016 13:22:32 +0000 (14:22 +0100)] 
Merge pull request #1344 from FooDeas/fix-getty

templates: fix getty service startup

8 years agotemplates: fix getty service startup 1344/head
FooDeas [Thu, 8 Dec 2016 13:03:10 +0000 (14:03 +0100)] 
templates: fix getty service startup

Commit bf39edb39ecaea25801d716aebef798885277992 broke the handling of the getty service file with an '@' character in filename. So the startup condition was not fixed.

Because the parameter was quoted with the causal commit, the escaping has to be removed.

Signed-off-by: Andreas Eberlein foodeas@aeberlein.de
8 years agoMerge pull request #1342 from brauner/2016-12-06/fix_printf_lxc_top
Stéphane Graber [Tue, 6 Dec 2016 16:02:45 +0000 (11:02 -0500)] 
Merge pull request #1342 from brauner/2016-12-06/fix_printf_lxc_top

tools: account for different architectures

8 years agotools: account for different architectures 1342/head
Christian Brauner [Tue, 6 Dec 2016 15:42:28 +0000 (16:42 +0100)] 
tools: account for different architectures

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1341 from attivio/lxc-top-iops
Christian Brauner [Tue, 6 Dec 2016 13:25:32 +0000 (14:25 +0100)] 
Merge pull request #1341 from attivio/lxc-top-iops

attach batch mode with -b flag which prints csv output with a timestamp

8 years agoattach batch mode with -b flag which prints csv output with a timestamp 1341/head
martin [Mon, 5 Dec 2016 20:09:14 +0000 (15:09 -0500)] 
attach batch mode with -b flag which prints csv output with a timestamp

Signed-off-by: martin <martin@attivio.com>
8 years agoMerge pull request #1337 from stgraber/master
Christian Brauner [Sat, 3 Dec 2016 16:29:11 +0000 (11:29 -0500)] 
Merge pull request #1337 from stgraber/master

tests; Don't cause test failures on cleanup errors

8 years agoMerge pull request #1340 from brauner/2016-12-02/cap_drop_keep_report_better_error
Stéphane Graber [Fri, 2 Dec 2016 19:04:03 +0000 (14:04 -0500)] 
Merge pull request #1340 from brauner/2016-12-02/cap_drop_keep_report_better_error

conf: clearly report to either use drop or keep

8 years agoconf: clearly report to either use drop or keep 1340/head
Christian Brauner [Fri, 2 Dec 2016 18:41:11 +0000 (19:41 +0100)] 
conf: clearly report to either use drop or keep

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1338 from Blub/tools-configfile
Christian Brauner [Fri, 2 Dec 2016 15:37:12 +0000 (10:37 -0500)] 
Merge pull request #1338 from Blub/tools-configfile

tools: lxc-start: set configfile after load_config

8 years agotools: lxc-start: set configfile after load_config 1338/head
Wolfgang Bumiller [Fri, 2 Dec 2016 13:15:40 +0000 (14:15 +0100)] 
tools: lxc-start: set configfile after load_config

Same change as in 6118210e0a which was missing in lxc-start
and back then is_defined() wasn't being called.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
8 years agotests; Don't cause test failures on cleanup errors 1337/head
Stéphane Graber [Thu, 1 Dec 2016 23:34:00 +0000 (18:34 -0500)] 
tests; Don't cause test failures on cleanup errors

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
8 years agoMerge pull request #1336 from brauner/2016-11-29/use_clockgettime
Stéphane Graber [Tue, 29 Nov 2016 19:01:39 +0000 (14:01 -0500)] 
Merge pull request #1336 from brauner/2016-11-29/use_clockgettime

state: use async signal safe fun in lxc_wait()

8 years agoMerge pull request #1334 from brauner/2016-11-29/correct_date_formatting
Stéphane Graber [Tue, 29 Nov 2016 18:34:02 +0000 (13:34 -0500)] 
Merge pull request #1334 from brauner/2016-11-29/correct_date_formatting

log: make sure that date is correctly formatted

8 years agoMerge pull request #1333 from brauner/2016-11-29/macro_cleanups
Stéphane Graber [Tue, 29 Nov 2016 18:33:50 +0000 (13:33 -0500)] 
Merge pull request #1333 from brauner/2016-11-29/macro_cleanups

tree-wide: random macro cleanups

8 years agoMerge pull request #1332 from brauner/2016-11-29/fix_possible_hanging_monitord
Stéphane Graber [Tue, 29 Nov 2016 18:33:34 +0000 (13:33 -0500)] 
Merge pull request #1332 from brauner/2016-11-29/fix_possible_hanging_monitord

monitord: close mainloop on exit if we opened it

8 years agostate: use async signal safe fun in lxc_wait() 1336/head
Christian Brauner [Tue, 29 Nov 2016 17:42:22 +0000 (18:42 +0100)] 
state: use async signal safe fun in lxc_wait()

gettimeofday() is not async signal safe. So let's switch to clock_gettime() to
be on the safe side.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agomonitord: close mainloop on exit if we opened it 1332/head
Christian Brauner [Tue, 29 Nov 2016 04:42:47 +0000 (05:42 +0100)] 
monitord: close mainloop on exit if we opened it

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agolog: make sure that date is correctly formatted 1334/head
Christian Brauner [Tue, 29 Nov 2016 06:50:29 +0000 (07:50 +0100)] 
log: make sure that date is correctly formatted

- single digit months, days, hours, minutes, and seconds should always be
  preceded by a 0.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agotree-wide: random macro cleanups 1333/head
Christian Brauner [Tue, 29 Nov 2016 06:28:19 +0000 (07:28 +0100)] 
tree-wide: random macro cleanups

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1331 from brauner/2016-11-27/use_sec_nanosec_since_epoch
Serge Hallyn [Tue, 29 Nov 2016 03:24:57 +0000 (21:24 -0600)] 
Merge pull request #1331 from brauner/2016-11-27/use_sec_nanosec_since_epoch

log: drop all timezone conversion functions

8 years agolog: annotate lxc_unix_epoch_to_utc() 1331/head
Christian Brauner [Tue, 29 Nov 2016 00:26:25 +0000 (01:26 +0100)] 
log: annotate lxc_unix_epoch_to_utc()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agolog: use lxc_unix_epoch_to_utc()
Christian Brauner [Mon, 28 Nov 2016 21:19:02 +0000 (22:19 +0100)] 
log: use lxc_unix_epoch_to_utc()

This allows us to generate nice timestamps in a thread-safe manner without
relying on locale touching functions from any libc.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agolog: add lxc_unix_epoch_to_utc()
Christian Brauner [Mon, 28 Nov 2016 21:08:37 +0000 (22:08 +0100)] 
log: add lxc_unix_epoch_to_utc()

Converts a unix time Epoch given by a struct timespec to a UTC string useable
in our logging functions. Maybe expanded to allow for more generic formatting.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agolog: drop all timezone conversion functions
Christian Brauner [Sun, 27 Nov 2016 22:42:11 +0000 (23:42 +0100)] 
log: drop all timezone conversion functions

Our log functions need to make extra sure that they are thread-safe. We had
some problems with that before. This especially involves time-conversion
functions. I don't want to find any localtime() or gmtime() functions or
relatives in here. Not even localtime_r() or gmtime_r() or relatives. They all
fiddle with global variables and locking in various libcs. They cause deadlocks
when liblxc is used multi-threaded and no matter how smart you think you are,
you __will__ cause trouble using them.
(As a short example how this can cause trouble: LXD uses forkstart to fork off
a new process that runs the container. At the same time the go runtime LXD
relies on does its own multi-threading thing which we can't control. The
fork()ing + threading then seems to mess with the locking states in these time
functions causing deadlocks.)
The current solution is to be good old unix people and use the Epoch as our
reference point and simply use the seconds and nanoseconds that have past since
then. This relies on clock_gettime() which is explicitly marked MT-Safe with no
restrictions! This way, anyone who is really strongly invested in getting the
actual time the log entry was created, can just convert it for themselves. Our
logging is mostly done for debugging purposes so don't try to make it pretty.
Pretty might cost you thread-safety.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoutils: add macro __LXC_NUMSTRLEN
Christian Brauner [Sun, 27 Nov 2016 22:41:06 +0000 (23:41 +0100)] 
utils: add macro __LXC_NUMSTRLEN

This macro can be used to set or allocate a string buffer that can hold any
64bit representable number.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1329 from brauner/2016-11-27/log_signal_error_on_container_stop
Stéphane Graber [Sun, 27 Nov 2016 06:00:55 +0000 (01:00 -0500)] 
Merge pull request #1329 from brauner/2016-11-27/log_signal_error_on_container_stop

lxccontainer: log failure to send sig to init pid

8 years agoMerge pull request #1328 from brauner/2016-11-27/make_running_hooks_async_signal_safe
Stéphane Graber [Sun, 27 Nov 2016 05:10:53 +0000 (00:10 -0500)] 
Merge pull request #1328 from brauner/2016-11-27/make_running_hooks_async_signal_safe

conf: remove thread-unsafe strsignal + improve log

8 years agolxccontainer: log failure to send sig to init pid 1329/head
Christian Brauner [Sun, 27 Nov 2016 05:01:36 +0000 (06:01 +0100)] 
lxccontainer: log failure to send sig to init pid

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1327 from brauner/2016-11-26/make_lxc_monitord_async_signal_safe
Stéphane Graber [Sun, 27 Nov 2016 03:56:58 +0000 (22:56 -0500)] 
Merge pull request #1327 from brauner/2016-11-26/make_lxc_monitord_async_signal_safe

lxc_monitord: make lxc-monitord async signal safe

8 years agoconf: remove thread-unsafe strsignal + improve log 1328/head
Christian Brauner [Sun, 27 Nov 2016 03:44:06 +0000 (04:44 +0100)] 
conf: remove thread-unsafe strsignal + improve log

The thread-unsafe functions strsignal() is called in run_buffer() which in turn
is called in run_buffer_argv() which is responsible for running __all__ lxc
hooks. This is pretty dangerous for multi-threaded users like LXD.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agolxc_monitord: make lxc-monitord async signal safe 1327/head
Christian Brauner [Sun, 27 Nov 2016 00:43:37 +0000 (01:43 +0100)] 
lxc_monitord: make lxc-monitord async signal safe

Before lxc_monitord called lxc_monitord_cleanup() from a signal handler.  This
function calls a bunch of async signal unsafe functions and basically begs for
deadlocks. This commit switches lxc-monitord to using sigsetjmp() and
siglongjmp() in the signal handler to jump to a cleanup label that call
lxc_monitord_cleanup(). In this way, we avoid using async signal unsafe
functions.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1326 from brauner/2016-11-26/improve_logging_for_monitord
Stéphane Graber [Sat, 26 Nov 2016 20:13:41 +0000 (15:13 -0500)] 
Merge pull request #1326 from brauner/2016-11-26/improve_logging_for_monitord

lxc_monitord: improve log + set log level to DEBUG

8 years agolxc_monitord: improve log + set log level to DEBUG 1326/head
Christian Brauner [Sat, 26 Nov 2016 18:39:44 +0000 (19:39 +0100)] 
lxc_monitord: improve log + set log level to DEBUG

Setting loglevel to DEBUG will allow us to retrieve more useful information in
case something goes wrong. The total size of the log will not increase
significantly.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1325 from brauner/2016-11-26/improve_command_logging
Stéphane Graber [Sat, 26 Nov 2016 17:57:40 +0000 (12:57 -0500)] 
Merge pull request #1325 from brauner/2016-11-26/improve_command_logging

commands: improve logging

8 years agoMerge pull request #1324 from brauner/2016-11-26/more_logging_for_monitor
Stéphane Graber [Sat, 26 Nov 2016 17:57:16 +0000 (12:57 -0500)] 
Merge pull request #1324 from brauner/2016-11-26/more_logging_for_monitor

monitor: add more logging

8 years agoMerge pull request #1322 from brauner/2016-11-26/remove_werror_vla
Stéphane Graber [Sat, 26 Nov 2016 17:56:54 +0000 (12:56 -0500)] 
Merge pull request #1322 from brauner/2016-11-26/remove_werror_vla

configure: remove -Werror=vla

8 years agocommands: improve logging 1325/head
Christian Brauner [Sat, 26 Nov 2016 08:16:25 +0000 (09:16 +0100)] 
commands: improve logging

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agomonitor: add more logging 1324/head
Christian Brauner [Sat, 26 Nov 2016 06:40:59 +0000 (07:40 +0100)] 
monitor: add more logging

Execing lxc-monitord is quite a crucial step so let's be very obsessive about
logging possible errors to guide us in debugging.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1323 from hallyn/2016-11-25/droplock
Christian Brauner [Sat, 26 Nov 2016 06:31:22 +0000 (01:31 -0500)] 
Merge pull request #1323 from hallyn/2016-11-25/droplock

lvm: supress warnings about leaked files

8 years agoconfigure: remove -Werror=vla 1322/head
Christian Brauner [Sat, 26 Nov 2016 06:07:25 +0000 (07:07 +0100)] 
configure: remove -Werror=vla

Because we include a header that uses a vla (/me scoffs at header).

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agolvm: supress warnings about leaked files 1323/head
Serge Hallyn [Sat, 26 Nov 2016 06:07:15 +0000 (00:07 -0600)] 
lvm: supress warnings about leaked files

Closes #1283

Signed-off-by: Serge Hallyn <serge@hallyn.com>
8 years agoMerge pull request #1321 from brauner/2016-11-25/cleanup_monitor
Stéphane Graber [Sat, 26 Nov 2016 05:22:19 +0000 (00:22 -0500)] 
Merge pull request #1321 from brauner/2016-11-25/cleanup_monitor

cleanup monitor + improve log

8 years agoMerge pull request #1315 from brauner/2016-11-23/memfd_create
Stéphane Graber [Sat, 26 Nov 2016 04:50:28 +0000 (23:50 -0500)] 
Merge pull request #1315 from brauner/2016-11-23/memfd_create

conf, criu: add make_anonymous_mount_file()

8 years agomonitor: log which pipe fd is currently used 1321/head
Christian Brauner [Sat, 26 Nov 2016 04:28:58 +0000 (05:28 +0100)] 
monitor: log which pipe fd is currently used

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agomonitor: non-functional changes
Christian Brauner [Sat, 26 Nov 2016 04:03:55 +0000 (05:03 +0100)] 
monitor: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1320 from brauner/2016-11-25/remove_vlas
Stéphane Graber [Sat, 26 Nov 2016 04:04:21 +0000 (23:04 -0500)] 
Merge pull request #1320 from brauner/2016-11-25/remove_vlas

tree-wide: remove any variable length arrays

8 years agoconf, criu: add make_anonymous_mount_file() 1315/head
Christian Brauner [Wed, 23 Nov 2016 05:47:37 +0000 (06:47 +0100)] 
conf, criu: add make_anonymous_mount_file()

Before we used tmpfile() to write out mount entries for the container. This
requires a writeable /tmp file system which can be a problem for systems where
this filesystem is not present. This commit switches from tmpfile() to using
the memfd_create() syscall. It allows us to create an anonymous tmpfs file (And
is somewhat similar to mmap().) which is automatically deleted as soon as any
references to it are dropped. In case we detect that syscall is not
implemented, we fallback to using tmpfile().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoconfigure: check for memfd_create()
Christian Brauner [Fri, 25 Nov 2016 19:55:38 +0000 (20:55 +0100)] 
configure: check for memfd_create()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoconf: non-functional changes
Christian Brauner [Wed, 23 Nov 2016 05:47:07 +0000 (06:47 +0100)] 
conf: non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agotree-wide: remove any variable length arrays 1320/head
Christian Brauner [Fri, 25 Nov 2016 21:01:20 +0000 (22:01 +0100)] 
tree-wide: remove any variable length arrays

They are pointless and marked optional since C11.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1319 from brauner/2016-11-25/fix_logging_race
Stéphane Graber [Fri, 25 Nov 2016 23:20:25 +0000 (18:20 -0500)] 
Merge pull request #1319 from brauner/2016-11-25/fix_logging_race

log: fix race

8 years agoconfigure: do not allow variable length arrays
Christian Brauner [Fri, 25 Nov 2016 21:00:45 +0000 (22:00 +0100)] 
configure: do not allow variable length arrays

There pointless and marked as optional since C11.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agolog: use N/A if getpid() != gettid() when threaded 1319/head
Christian Brauner [Fri, 25 Nov 2016 19:23:00 +0000 (20:23 +0100)] 
log: use N/A if getpid() != gettid() when threaded

Sample log output:

    lxc 20161125201943.819 INFO     lxc_start - start.c:lxc_check_inherited:243 - Closed inherited fd: 54.
--> lxc N/A                INFO     lxc_monitor - monitor.c:lxc_monitor_sock_name:178 - using monitor sock name lxc/ad055575fe28ddd5//var/lib/lxc
    lxc 20161125201943.958 DEBUG    lxc_commands - commands.c:lxc_cmd_handler:893 - peer has disconnected
--> lxc N/A                DEBUG    lxc_commands - commands.c:lxc_cmd_get_state:579 - 'lxc-test-concurrent-0' is in 'RUNNING' state
    lxc 20161125201943.960 DEBUG    lxc_commands - commands.c:lxc_cmd_handler:893 - peer has disconnected
    lxc 20161125201944.009 INFO     lxc_start - start.c:lxc_check_inherited:243 - Closed inherited fd: 3.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agolog: fix race
Christian Brauner [Fri, 25 Nov 2016 16:28:18 +0000 (17:28 +0100)] 
log: fix race

localtime_r() can lead to deadlocks because it calls __tzset() and
__tzconvert() internally. The deadlock stems from an interaction between these
functions and the functions in monitor.c and commands.{c,h}. The latter
functions will write to the log independent of the container thread that is
currently running. Since the monitor fork()ed it seems to duplicate the mutex
states of the time functions mentioned above causing the deadlock.
As a short termm fix, I suggest to simply disable receiving the time when
monitor.c or command.{c,h} functions are called. This should be ok, since the
[lxc monitor] will only emit a few messages and thread-safety is currently more
important than beautiful logs. The rest of the log stays the same as it was
before.

Here is an example output from logs where I printed the pid and tid of the
process that is currently writing to the log:

            lxc 20161125170200.619 INFO     lxc_start:   18695-18695: - start.c:lxc_check_inherited:243 - Closed inherited fd: 23.
            lxc 20161125170200.640 DEBUG    lxc_start:   18677-18677: - start.c:__lxc_start:1334 - Not dropping CAP_SYS_BOOT or watching utmp.
            lxc 20161125170200.640 INFO     lxc_cgroup:  18677-18677: - cgroups/cgroup.c:cgroup_init:68 - cgroup driver cgroupfs-ng initing for lxc-test-concurrent-0

----------> lxc 20150427012246.000 INFO     lxc_monitor: 13017-18622: - monitor.c:lxc_monitor_sock_name:178 - using monitor sock name lxc/ad055575fe28ddd5//var/lib/lxc

            lxc 20161125170200.662 DEBUG    lxc_cgfsng:  18677-18677: - cgroups/cgfsng.c:filter_and_set_cpus:478 - No isolated cpus detected.
            lxc 20161125170200.662 DEBUG    lxc_cgfsng:  18677-18677: - cgroups/cgfsng.c:handle_cpuset_hierarchy:648 - "cgroup.clone_children" was already set to "1".

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoconfigure: check whether gettid() is declared
Christian Brauner [Fri, 25 Nov 2016 19:02:24 +0000 (20:02 +0100)] 
configure: check whether gettid() is declared

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1317 from brauner/2016-11-24/cleanup_attach
Stéphane Graber [Fri, 25 Nov 2016 17:46:03 +0000 (12:46 -0500)] 
Merge pull request #1317 from brauner/2016-11-24/cleanup_attach

cleanup attach

8 years agoMerge pull request #1318 from brauner/2016-11-25/fix_logging_race
Stéphane Graber [Fri, 25 Nov 2016 02:22:04 +0000 (21:22 -0500)] 
Merge pull request #1318 from brauner/2016-11-25/fix_logging_race

log: use thread-safe localtime_r()

8 years agolog: use thread-safe localtime_r() 1318/head
Christian Brauner [Fri, 25 Nov 2016 01:42:51 +0000 (02:42 +0100)] 
log: use thread-safe localtime_r()

This fixes a race in liblxc logging which can lead to deadlocks. The reproducer
for this issue before this is to simply compile with --enable-tests and then
run:

    lxc-test-concurrent -j 20 -m create,start,stop,destroy -D

which should deadlock.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoattach: non-functional changes 1317/head
Christian Brauner [Thu, 24 Nov 2016 07:16:59 +0000 (08:16 +0100)] 
attach: non-functional changes

- improve logging
- simplify functions

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoattach: simplify lsm_openat()
Christian Brauner [Thu, 24 Nov 2016 06:58:01 +0000 (07:58 +0100)] 
attach: simplify lsm_openat()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoattach: do not send procfd to attached process
Christian Brauner [Tue, 8 Nov 2016 18:21:19 +0000 (19:21 +0100)] 
attach: do not send procfd to attached process

So far, we opened a file descriptor refering to proc on the host inside the
host namespace and handed that fd to the attached process in
attach_child_main(). This was done to ensure that LSM labels were correctly
setup. However, by exploiting a potential kernel bug, ptrace could be used to
prevent the file descriptor from being closed which in turn could be used by an
unprivileged container to gain access to the host namespace. Aside from this
needing an upstream kernel fix, we should make sure that we don't pass the fd
for proc itself to the attached process. However, we cannot completely prevent
this, as the attached process needs to be able to change its apparmor profile
by writing to /proc/self/attr/exec or /proc/self/attr/current. To minimize the
attack surface, we only send the fd for /proc/self/attr/exec or
/proc/self/attr/current to the attached process. To do this we introduce a
little more IPC between the child and parent:

 * IPC mechanism: (X is receiver)
 *   initial process        intermediate          attached
 *        X           <---  send pid of
 *                          attached proc,
 *                          then exit
 *    send 0 ------------------------------------>    X
 *                                              [do initialization]
 *        X  <------------------------------------  send 1
 *   [add to cgroup, ...]
 *    send 2 ------------------------------------>    X
 * [set LXC_ATTACH_NO_NEW_PRIVS]
 *        X  <------------------------------------  send 3
 *   [open LSM label fd]
 *    send 4 ------------------------------------>    X
 *    [set LSM label]
 *   close socket                                 close socket
 *                                                run program

The attached child tells the parent when it is ready to have its LSM labels set
up. The parent then opens an approriate fd for the child PID to
/proc/<pid>/attr/exec or /proc/<pid>/attr/current and sends it via SCM_RIGHTS
to the child. The child can then set its LSM laben. Both sides then close the
socket fds and the child execs the requested process.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
8 years agoMerge pull request #1314 from ccope/static-mac
Christian Brauner [Wed, 23 Nov 2016 04:04:45 +0000 (23:04 -0500)] 
Merge pull request #1314 from ccope/static-mac

Configure a static MAC address on the LXC bridge

8 years agoConfigure a static MAC address on the LXC bridge 1314/head
Cam Cope [Tue, 22 Nov 2016 23:16:32 +0000 (15:16 -0800)] 
Configure a static MAC address on the LXC bridge

Signed-off-by: Cam Cope <cam@dropbox.com>
8 years agoMerge pull request #1312 from brauner/2016-11-22/fix_lxc_unshare_parsing
Stéphane Graber [Tue, 22 Nov 2016 17:12:21 +0000 (12:12 -0500)] 
Merge pull request #1312 from brauner/2016-11-22/fix_lxc_unshare_parsing

tools: replace non-standard namespace identifiers

8 years agoMerge pull request #1313 from brauner/2016-11-22/fix_lxc_tests
Stéphane Graber [Tue, 22 Nov 2016 17:10:41 +0000 (12:10 -0500)] 
Merge pull request #1313 from brauner/2016-11-22/fix_lxc_tests

tests: remove overflow tests

8 years agotests: remove overflow tests 1313/head
Christian Brauner [Tue, 22 Nov 2016 16:38:18 +0000 (17:38 +0100)] 
tests: remove overflow tests

They do not behave correctly on some architectures, so let's remove them for
now and come up with better ones later.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agotools: replace non-standard namespace identifiers 1312/head
Christian Brauner [Tue, 22 Nov 2016 08:42:59 +0000 (09:42 +0100)] 
tools: replace non-standard namespace identifiers

The identifiers for namespaces used with lxc-unshare and lxc-attach as given on
the manpage do not align with the standard identifiers. This affects network,
mount, and uts namespaces. The standard identifiers are: "mnt", "uts", and
"net" whereas lxc-unshare and lxc-attach use "MOUNT", "UTSNAME", and "NETWORK".
I'm weary to hack this into namespace.{c.h} by e.g. adding additional members
to the ns_info struct or to special case this in lxc_fill_namespace_flags().
Internally, we should only accept standard identifiers to ensure that we are
always correctly aligned with the kernel. So let's use some cheap memmove()s to
replace them by their standard identifiers in lxc-unshare and lxc-attach.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
8 years agoMerge pull request #1256 from brauner/2016-09-06/remove_atoi
Serge Hallyn [Tue, 22 Nov 2016 04:46:21 +0000 (22:46 -0600)] 
Merge pull request #1256 from brauner/2016-09-06/remove_atoi

remove atoi