]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
10 years agoAdd Japanese man pages.
KATOH Yasufumi [Thu, 5 Sep 2013 11:38:32 +0000 (11:38 +0000)]
Add Japanese man pages.

Japanese man pages is installed under $mandir/ja.
At this time, it is based on version 0.9.0.

10 years agochange version to 1.0.0.alpha1 in configure.ac
Daniel Lezcano [Tue, 10 Sep 2013 21:55:26 +0000 (23:55 +0200)]
change version to 1.0.0.alpha1 in configure.ac

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
10 years agoMerge git://github.com/lxc/lxc
Daniel Lezcano [Mon, 9 Sep 2013 19:07:12 +0000 (21:07 +0200)]
Merge git://github.com/lxc/lxc

Signed-off-by: Daniel Lezcano <daniel.lezcano@free.fr>
10 years agoconfigure: enable Lua if found and continue without if not
Natanael Copa [Fri, 6 Sep 2013 19:09:57 +0000 (21:09 +0200)]
configure: enable Lua if found and continue without if not

Search for Lua if no --enable-lua/--disable-lua specified but continue
without if not found.

If --enable-lua is specified and Lua is not found then return error.

If --disable-lua is specified, then don't search for Lua.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc_spawn: don't close pinfd until container is stopped
Serge Hallyn [Fri, 6 Sep 2013 17:25:47 +0000 (12:25 -0500)]
lxc_spawn: don't close pinfd until container is stopped

Otherwise containers may be able to remount -o ro their rootfs
at shutdown.

Reported-by: Harald Dunkel <harri@afaics.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolua: fix logic to enable lua support in configure
Natanael Copa [Fri, 6 Sep 2013 07:08:45 +0000 (09:08 +0200)]
lua: fix logic to enable lua support in configure

When there is no --enable-lua or --with-lua-pc, Lua should not be
enabled.

This fixes a bug introduced with 12e93188 (configure/makefile:
Allow specify Lua pkg-config file with --with-lua-pc) that caused
configure script to fail if lua headers was missing.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agosanity-check number of detected capabilities
Serge Hallyn [Fri, 6 Sep 2013 01:31:55 +0000 (20:31 -0500)]
sanity-check number of detected capabilities

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoadd AS_VAR_COPY for older autoconf versions
Dwight Engen [Thu, 5 Sep 2013 20:40:49 +0000 (16:40 -0400)]
add AS_VAR_COPY for older autoconf versions

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolua: fix stats gathering
Dwight Engen [Thu, 5 Sep 2013 19:20:44 +0000 (15:20 -0400)]
lua: fix stats gathering

- remove lxc subdir in cgroup paths (done in commit b98f7d6e)
- remove extraneous debug printfs
- remove extra call to stats_clear

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolua: implement dirname in C rather than depend on external executable
Natanael Copa [Thu, 5 Sep 2013 13:29:20 +0000 (15:29 +0200)]
lua: implement dirname in C rather than depend on external executable

Instead of popen and run external executable dirname we implement a
dirname in C in the core module.

We also remove the unused basename function.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolua: implement usleep in C module
Natanael Copa [Thu, 5 Sep 2013 12:33:28 +0000 (14:33 +0200)]
lua: implement usleep in C module

So we avoid running os.execute

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoconfigure/makefile: Allow specify Lua pkg-config file with --with-lua-pc
Natanael Copa [Thu, 5 Sep 2013 15:13:07 +0000 (17:13 +0200)]
configure/makefile: Allow specify Lua pkg-config file with --with-lua-pc

Enable support for both Lua 5.1 and 5.2 by letting user specify the Lua
pkg-config package name. By default it will use 'lua' and try figure
out which version it is.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolua: prepare for Lua 5.2
Natanael Copa [Thu, 5 Sep 2013 06:45:33 +0000 (08:45 +0200)]
lua: prepare for Lua 5.2

Adjust code for Lua 5.2 and keep compatibility with Lua 5.1.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolua: fix a bug in the parsing of /proc/mounts
Natanael Copa [Thu, 5 Sep 2013 19:07:51 +0000 (15:07 -0400)]
lua: fix a bug in the parsing of /proc/mounts

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoclone: don't copy rdepends when not doing a snapshot clone
Serge Hallyn [Thu, 5 Sep 2013 23:05:34 +0000 (18:05 -0500)]
clone: don't copy rdepends when not doing a snapshot clone

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agofix typo
Serge Hallyn [Thu, 5 Sep 2013 22:59:28 +0000 (17:59 -0500)]
fix typo

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agointroduce lxc.cap.keep
Serge Hallyn [Fri, 14 Jun 2013 03:43:01 +0000 (22:43 -0500)]
introduce lxc.cap.keep

The lxc configuration file currently supports 'lxc.cap.drop', a list of
capabilities to be dropped (using the bounding set) from the container.
The problem with this is that over time new capabilities are added.  So
an older container configuration file may, over time, become insecure.

Walter has in the past suggested replacing lxc.cap.drop with
lxc.cap.preserve, which would have the inverse sense - any capabilities
in that set would be kept, any others would be dropped.

Realistically both have the same problem - the sendmail capabilities
bug proved that running code with unexpectedly dropped privilege can be
dangerous.  This patch gives the admin a choice:  You can use either
lxc.cap.keep or lxc.cap.drop, not both.

Both continue to be ignored if a user namespace is in use.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agobdev: free after bdev_init
Serge Hallyn [Thu, 5 Sep 2013 21:56:54 +0000 (16:56 -0500)]
bdev: free after bdev_init

(Except in cases where we will immediately exit)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agovalgrind: fix memory leak on container new/put
Dwight Engen [Wed, 4 Sep 2013 21:04:51 +0000 (17:04 -0400)]
valgrind: fix memory leak on container new/put

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-alpine: add hwaddr for a single macvlan interface
Natanael Copa [Wed, 4 Sep 2013 15:01:09 +0000 (17:01 +0200)]
lxc-alpine: add hwaddr for a single macvlan interface

We already add harware address for a single veth interface. Do the same
with a single macvlan interface.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agobdev_copy segfaults if bdevtype is NULL
S.Çağlar Onur [Tue, 3 Sep 2013 20:21:15 +0000 (16:21 -0400)]
bdev_copy segfaults if bdevtype is NULL

Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agotests: Add lxc-test-usernic to the dist tarball
Stéphane Graber [Tue, 3 Sep 2013 19:11:07 +0000 (15:11 -0400)]
tests: Add lxc-test-usernic to the dist tarball

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolicensing: Add missing headers and FSF address
Stéphane Graber [Tue, 3 Sep 2013 18:29:46 +0000 (14:29 -0400)]
licensing: Add missing headers and FSF address

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoubuntu: iproute is now called iproute2
Stéphane Graber [Tue, 3 Sep 2013 15:36:09 +0000 (11:36 -0400)]
ubuntu: iproute is now called iproute2

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolua: update license
Serge Hallyn [Tue, 3 Sep 2013 12:56:11 +0000 (07:56 -0500)]
lua: update license

As with other files, update to be LGPL since these are part
of the lxc library.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agopython: Fix api_test to use the new attach() API
Stéphane Graber [Fri, 30 Aug 2013 21:27:14 +0000 (17:27 -0400)]
python: Fix api_test to use the new attach() API

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-commands: add a comment explaining CMD_* rules
Serge Hallyn [Tue, 3 Sep 2013 13:08:39 +0000 (08:08 -0500)]
lxc-commands: add a comment explaining CMD_* rules

We wish to ensure that, henceforth, newer lxc tools are always compatible
with older lxc monitors.  Add a comment to commands.c to explain the
rule we wish to enforce to this end.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoremove old stale comments (lxc-clone is now implemented)
Serge Hallyn [Fri, 30 Aug 2013 20:51:31 +0000 (15:51 -0500)]
remove old stale comments (lxc-clone is now implemented)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd a section about licensing to CONTRIBUTING
Stéphane Graber [Fri, 30 Aug 2013 19:56:21 +0000 (15:56 -0400)]
Add a section about licensing to CONTRIBUTING

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agofix license text in ubuntu and ubuntu-cloud templates
Serge Hallyn [Fri, 30 Aug 2013 19:43:09 +0000 (14:43 -0500)]
fix license text in ubuntu and ubuntu-cloud templates

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agofix wrong license text for parts of liblxc library
Serge Hallyn [Fri, 30 Aug 2013 19:42:20 +0000 (14:42 -0500)]
fix wrong license text for parts of liblxc library

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoavoid zgrep -q as it's failing on some distros
Stéphane Graber [Fri, 30 Aug 2013 16:08:26 +0000 (12:08 -0400)]
avoid zgrep -q as it's failing on some distros

Reported-by: Filirom1
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agofedora: Add missing double-quotes.
Stéphane Graber [Fri, 30 Aug 2013 15:47:58 +0000 (11:47 -0400)]
fedora: Add missing double-quotes.

Reported-by: tlc
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix some typos
Stéphane Graber [Fri, 30 Aug 2013 15:43:19 +0000 (11:43 -0400)]
Fix some typos

Signed-off-by: Dmitry Shachnev <mitya57@ubuntu.com>
Reported-by: Vincent Ladeuil
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agostart.c: handle potential signal flood
Serge Hallyn [Thu, 29 Aug 2013 15:41:19 +0000 (10:41 -0500)]
start.c: handle potential signal flood

Signalfd does not guarantee that we'll get an event for every signal.
So if 3 tasks exit at the same time, we may get only one sigchld
event.  Therefore, in signal_handler(), always check whether init has
exited.  Do with with WNOWAIT so that we can still wait4 to cleanup
the init after lxc_poll() exists (rather than complicating the code).

Note - there is still a race in the kernel which can cause the
container init to become a defunct child of the host init (!).  This
doesn't solve that, but is a potential (if very unlikely) race which
apw pointed out while we were trying to create a reproducer for the
kernel bug.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agolxc-alpine: create /dev/zero
Natanael Copa [Mon, 26 Aug 2013 11:47:58 +0000 (13:47 +0200)]
lxc-alpine: create /dev/zero

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoconfig_ipv6: run inet_pton on the addr value without mask
Serge Hallyn [Fri, 23 Aug 2013 17:45:15 +0000 (12:45 -0500)]
config_ipv6: run inet_pton on the addr value without mask

otherwise a "$addr/$mask" results in failure.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoapi: convert lxc_start
Serge Hallyn [Thu, 22 Aug 2013 15:27:40 +0000 (10:27 -0500)]
api: convert lxc_start

Normal lxc-start usage tends to be "lxc-start -n name [-P lxcpath]".
This causes $lxcpath/$name/config to be the configuration for the
container.  However, lxc-start is more flexible than that.  You can
specify a custom configuration file, in which case $lxcpath/$name/config
is not used.  You can also (in addition or in place of either of these)
specify configuration entries one-by-one using "-s lxc.utsname=xxx".

To support this using the API, if we are not using
$lxcpath/$name/config then we put ourselves into a custom lxcpath
called (configurable using LXCPATH) /var/lib/lxc_anon.  To stop a
container so created, then, you would use

lxc-stop -P /var/lib/lxc_anon -n name

TODO: we should walk over the list of &defines by hand and set them
using c->set_config_item.  I haven't done that in this patch.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agohooks/ubuntu-cloud-prep: add hostname to meta-data
Scott Moser [Thu, 22 Aug 2013 19:38:48 +0000 (15:38 -0400)]
hooks/ubuntu-cloud-prep: add hostname to meta-data

prior to my enabling of the clone hook, the setting of the hostname
was being done by writing to /etc/hostname.  Instead of relying on that
we're now writing 'local-hostname' into the metadata for the instance.

cloud-init then reads this and sets the hostname properly.

We are also writing /etc/hostname with the new hostname explicitly.  This is
useful/necessary because on network bringup of eth0, dhclient will submit its
hosname.  The updating done by cloud-init occurs to late, and thus
the dhcp request goes out with the un-configured hostname and dns doens't
work correctly.

Signed-off-by: Scott Moser <smoser@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoapi: convert lxc_wait, lxc_freeze, and lxc_unfreeze
Serge Hallyn [Wed, 21 Aug 2013 21:53:52 +0000 (16:53 -0500)]
api: convert lxc_wait, lxc_freeze, and lxc_unfreeze

These are the last of the simpler conversions.  Start, execute,
kill, info and attach remain to be done.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
10 years agolxc_cgroup: convert to using API
Serge Hallyn [Wed, 21 Aug 2013 19:35:28 +0000 (14:35 -0500)]
lxc_cgroup: convert to using API

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoTrack snapshot dependencies (v2)
Serge Hallyn [Wed, 21 Aug 2013 19:43:52 +0000 (14:43 -0500)]
Track snapshot dependencies (v2)

(Will push in a bit barring any objections)

lvm, btrfs, and zfs snapshots each do an ok job of handling deletions
for us - a btrfs snapshot does fine after the original is removed,
while zfs and lvm will both refuse to allow the original to be deleted
while the snapshot exists.

Overlayfs doesn't do this for us.  So, for overlayfs snapshots, track
the dependencies.

When c2 is created as an overlayfs snapshot of dir-backed c1, then

1. c2's lxc_rdepends file will contain

c1_lxcpath
c1_lxcname

2. c1's lxc_snapshots will contain "1"

c1 cannot be deleted so long as lxc_snapshots exists and contains
a non-zero number.

The contents of lxc_snapshots and lxc_rdepends are protected by
container_disk_lock() and at lxc_clone by the new container not yet
being accessible.

(Originally I was going to keep them in the container config, but the
problem with using $lxcpath/$name/config is that api users could end up
calling c->save_config() with a cached old value of snapshots/rdepends.)

Changelog:
aug 21: check for fprintf and fclose failures

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Dwight Engen <dwight.engen@oracle.com>
10 years agoavoid very unlikely race due to EEXIST
Serge Hallyn [Tue, 20 Aug 2013 23:15:06 +0000 (18:15 -0500)]
avoid very unlikely race due to EEXIST

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: make indent match nest level
Serge Hallyn [Tue, 20 Aug 2013 23:01:07 +0000 (18:01 -0500)]
coverity: make indent match nest level

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: dont dereference before null check
Serge Hallyn [Tue, 20 Aug 2013 22:59:19 +0000 (17:59 -0500)]
coverity: dont dereference before null check

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: don't leak partial_fd
Serge Hallyn [Tue, 20 Aug 2013 22:54:19 +0000 (17:54 -0500)]
coverity: don't leak partial_fd

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: don't leak open DIR
Serge Hallyn [Tue, 20 Aug 2013 22:48:54 +0000 (17:48 -0500)]
coverity: don't leak open DIR

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: correctly handle tpath error case.
Serge Hallyn [Tue, 20 Aug 2013 21:58:24 +0000 (16:58 -0500)]
coverity: correctly handle tpath error case.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: ftell returns long, not size_t (which is unsigned)
Serge Hallyn [Tue, 20 Aug 2013 21:50:25 +0000 (16:50 -0500)]
coverity: ftell returns long, not size_t (which is unsigned)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocoverity: don't bother getting template path if we're not going to measure it
Serge Hallyn [Tue, 20 Aug 2013 21:29:29 +0000 (16:29 -0500)]
coverity: don't bother getting template path if we're not going to measure it

This should also fix a memory leak, since we were freeing it under ifdef
but always allocating it.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoubuntu-cloud-prep: improve overlayfs workaround
Scott Moser [Mon, 19 Aug 2013 14:18:37 +0000 (10:18 -0400)]
ubuntu-cloud-prep: improve overlayfs workaround

the previous 'patch_start' can be vastly simplified now that I better
understand what the bug was.  Instead of wrapping 'start', we only
need to ensure that /etc/init exists inside the overlayfs, so that the
directory that upstart watches is guaranteed to be in the overlay, not
the underlay.

The problem is described under bug 1213925.

Signed-off-by: Scott Moser <smoser@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroup updates: fix several bugs
Ubuntu [Mon, 19 Aug 2013 13:34:59 +0000 (13:34 +0000)]
cgroup updates: fix several bugs

1. add cgroup_get_subsys_abspath() which returns the absolute
path for a subsystem mount, and use that where needed to actually
set cgroup values

2. cgroup_devices_has_{allow,deny}: don't mix int and boolean
values.  Also, accept 'a *:* rwm" as any whitelist entry for
has_allow().

3. subsys_lists_match(): fix an off-by-one error in calculating
updated oldlen.  (we need to keep the extra char for '\0')

4. return -1, not 0, if lxc_cgroup_attach fails to open
/proc/self/cgroup.

Signed-off-by: Ubuntu <ubuntu@ip-10-181-158-15.ec2.internal>
10 years agopython/attach: Add function that returns personality for architecture
Christian Seiler [Sun, 18 Aug 2013 22:52:44 +0000 (00:52 +0200)]
python/attach: Add function that returns personality for architecture

Adds the arch_to_personality function that looks up an architecture
and returns the corresponding personality. This may be used in
conjunction with the attach/attach_wait keyword argument.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agopython/attach: export CLONE_NEW* constants to Python
Christian Seiler [Sun, 18 Aug 2013 22:52:43 +0000 (00:52 +0200)]
python/attach: export CLONE_NEW* constants to Python

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroup: minor bugfixes so start and attach work again
Christian Seiler [Sun, 18 Aug 2013 22:52:40 +0000 (00:52 +0200)]
cgroup: minor bugfixes so start and attach work again

This fixes some minor bugs in the cgroup logic that made start and
attach fail (at least when all cgroup controllers were mounted
together).

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agopython/attach: Fix minor memory leaks
Christian Seiler [Sun, 18 Aug 2013 22:52:42 +0000 (00:52 +0200)]
python/attach: Fix minor memory leaks

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoattach: Fix minor memory leak in environment variable handling
Christian Seiler [Sun, 18 Aug 2013 22:52:41 +0000 (00:52 +0200)]
attach: Fix minor memory leak in environment variable handling

Signed-off-by: Christian Seiler <christian@iwakd.de>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoRemove all trailing whitespaces
Stéphane Graber [Mon, 19 Aug 2013 12:37:20 +0000 (14:37 +0200)]
Remove all trailing whitespaces

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoFix lxc-user-nic to work on bionic
Stéphane Graber [Fri, 16 Aug 2013 14:55:40 +0000 (16:55 +0200)]
Fix lxc-user-nic to work on bionic

This adds a couple of missing includes, uses the local version of
getline on bionic and replaces getpwuid_r by getpwuid.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd missing namespace.h include
Stéphane Graber [Fri, 16 Aug 2013 14:42:39 +0000 (16:42 +0200)]
Add missing namespace.h include

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAllow building without confstr
Stéphane Graber [Fri, 16 Aug 2013 14:40:48 +0000 (16:40 +0200)]
Allow building without confstr

We use confstr to grab the default PATH value. If it's not there, just
use a standard one with bin and sbin for /, /usr and /usr/local.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoDon't define new_personality when building without personalities
Stéphane Graber [Fri, 16 Aug 2013 13:38:13 +0000 (15:38 +0200)]
Don't define new_personality when building without personalities

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd missing sys/socket.h include
Stéphane Graber [Fri, 16 Aug 2013 13:35:51 +0000 (15:35 +0200)]
Add missing sys/socket.h include

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoDefine SOCK_CLOEXEC when missing
Stéphane Graber [Fri, 16 Aug 2013 13:35:06 +0000 (15:35 +0200)]
Define SOCK_CLOEXEC when missing

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoUse srand/rand instead of initstate/random
Stéphane Graber [Fri, 16 Aug 2013 13:22:28 +0000 (15:22 +0200)]
Use srand/rand instead of initstate/random

initstate/random doesn't work on bionic, srand/rand works on everything,
so let's use that.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoInclude stdio.h in getline.h for FILE
Stéphane Graber [Fri, 16 Aug 2013 13:10:13 +0000 (15:10 +0200)]
Include stdio.h in getline.h for FILE

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoImport local getline copy on bionic
Stéphane Graber [Fri, 16 Aug 2013 13:08:39 +0000 (15:08 +0200)]
Import local getline copy on bionic

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd missing sys/select.h include for fd_set
Stéphane Graber [Fri, 16 Aug 2013 13:05:52 +0000 (15:05 +0200)]
Add missing sys/select.h include for fd_set

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd missing syscall.h include to utils.h
Stéphane Graber [Fri, 16 Aug 2013 10:28:17 +0000 (12:28 +0200)]
Add missing syscall.h include to utils.h

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd arm defines for __NR_signalfd(4)
Stéphane Graber [Fri, 16 Aug 2013 10:25:28 +0000 (12:25 +0200)]
Add arm defines for __NR_signalfd(4)

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAndroid now uses a sane clone() definition
Stéphane Graber [Fri, 16 Aug 2013 10:22:38 +0000 (12:22 +0200)]
Android now uses a sane clone() definition

The current Android NDK provides a clone() defintion that's identical to
eglibc's so we can drop the ifdef from that one.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoDefine BLKGETSIZE64 and LO_FLAGS_AUTOCLEAR
Stéphane Graber [Fri, 16 Aug 2013 10:19:44 +0000 (12:19 +0200)]
Define BLKGETSIZE64 and LO_FLAGS_AUTOCLEAR

Those two aren't always around (specifically on bionic), so add some
defines in case they aren't already defined.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoExport the local getmntent_r implementation
Stéphane Graber [Fri, 16 Aug 2013 10:18:15 +0000 (12:18 +0200)]
Export the local getmntent_r implementation

New code now uses getmntent_r so we need it exported so that it can be
used when building on bionic.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoReplace all calls to rindex by strrchr
Stéphane Graber [Fri, 16 Aug 2013 09:53:11 +0000 (11:53 +0200)]
Replace all calls to rindex by strrchr

The two functions are identical but strrchr also works on Bionic.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd a local implementation of ifaddrs.h
Stéphane Graber [Fri, 16 Aug 2013 09:47:10 +0000 (11:47 +0200)]
Add a local implementation of ifaddrs.h

This adds a local ifaddrs implementation to be used on Bionic or other C
libraries that don't come with a getifaddrs implementation.

This code was written by Kenneth MacKay and is under a two-clause BSD
license (copyright information in the file headers).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoubuntu-cloud-prep: patch /sbin/start for overlayfs
Scott Moser [Fri, 16 Aug 2013 20:47:32 +0000 (16:47 -0400)]
ubuntu-cloud-prep: patch /sbin/start for overlayfs

upstart depends on inotify, and overlayfs does not support inotify.

That means that the following results in 'tgt' not running. tgt is simply
used here as an example of a service that installs an upstart job and
starts it on package install.
 lxc-clone -s -B overlayfs -o source-precise-amd64 -n test1
 lxc-start -n test1
 ..
 apt-get install tgt

The change here is to modify /sbin/start inside the container so that when
something explicitly tries 'start', it results in an explicit call to
'initctl reload-configuration' so that upstart is aware of the newly
placed job.

Should overlayfs ever gain inotify support, this should still not cause
any harm.

Signed-off-by: Scott Moser <smoser@ubuntu.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-clone: default to overlaysf for -s clone of dir
Serge Hallyn [Fri, 16 Aug 2013 20:50:25 +0000 (15:50 -0500)]
lxc-clone: default to overlaysf for -s clone of dir

If you go to the trouble to request a -s (snapshot) clone of
a container which is dir backingstore, then you deserve an
overlayfs clone.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroup.c: remove spurious ERROR messages
Serge Hallyn [Fri, 16 Aug 2013 18:34:36 +0000 (13:34 -0500)]
cgroup.c: remove spurious ERROR messages

Because they are in probing functions.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agoReplace a few more str(n)dupa by str(n)dup + free
Stéphane Graber [Fri, 16 Aug 2013 12:57:44 +0000 (14:57 +0200)]
Replace a few more str(n)dupa by str(n)dup + free

strdup and strndup still don't exist on bionic, so we need to do the
alloc() call ourselves or free the memory by hand.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd attach_options.h to the list of included files
Stéphane Graber [Fri, 16 Aug 2013 10:09:02 +0000 (12:09 +0200)]
Add attach_options.h to the list of included files

Without this, make dist doesn't include it and LXC fails to build.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
10 years agodocument new lxc-create btrfs behavior
Serge Hallyn [Thu, 15 Aug 2013 20:37:30 +0000 (15:37 -0500)]
document new lxc-create btrfs behavior

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agobdev: support -B best and -B lvm,dir
Serge Hallyn [Thu, 15 Aug 2013 17:55:50 +0000 (12:55 -0500)]
bdev: support -B best and -B lvm,dir

-B dev will check whether btrfs, zfs, or lvm can be used,
in that order, and fall back to dir.

-B lvm,btrfs will try lvm first, then btrfs, then fail.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agobdev_create: don't default to btrfs if possible
Serge Hallyn [Thu, 15 Aug 2013 17:22:26 +0000 (12:22 -0500)]
bdev_create: don't default to btrfs if possible

Ideally it would be great to default to a btrfs subvolume for each new
container created.  However, this is not as we previously thought
without consequence.  'rsync --one-file-system' will not descend into
btrfs subvolumes.  This means that 'lxc-create -B _unset' will cause
different behavior for rsync -vax /var/lib/lxc based on whether that
fs is btrfs or not.

So don't do that.  If -B is not specified, use -B dir.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd subdir-objects option to AM_INIT_AUTOMAKE
Alexander Vladimirov [Thu, 15 Aug 2013 06:27:05 +0000 (14:27 +0800)]
Add subdir-objects option to AM_INIT_AUTOMAKE

Fix build with automake 1.14 and newer, since it requires explicit
setting now.

Signed-off-by: Alexander Vladimirov <alexander.idkfa.vladimirov@gmail.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-fedrora: New patch for systemd detection and init configuration.
Michael H. Warfield [Thu, 15 Aug 2013 17:57:50 +0000 (13:57 -0400)]
lxc-fedrora: New patch for systemd detection and init configuration.

Satoshi Matsumoto certainly had the right idea and in spotting a bug in
the lxc-fedora template for systemd detection.  Heart was in the right
spot but patch was not what we needed.

I've looked the patch code over for systemd support and init/upstart
support and modified the logic appropriately.  If /etc/systemd/system
exists, we'll do the right thing by systemd.  If /etc/rc.sysinit exists,
we'll do the right thing by init / upstart.  If both are installed,
we'll trying and accommodate both in case someone is playing games with
the two (I've done this).

Patch was trivial, just took more time to actually test it and create
some containers with it and verify them, than it did to code them.

Signed-off-by: Michael H. Warfield <mhw@WittsEnd.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoattach: implement remaining options of lxc_attach_set_environment
Christian Seiler [Tue, 13 Aug 2013 21:04:37 +0000 (23:04 +0200)]
attach: implement remaining options of lxc_attach_set_environment

This patch implements the extra_env and extra_keep options of
lxc_attach_set_environment.

The Python implementation, the C container API and the lxc-attach
utility are able to utilize this feature; lxc-attach has gained two new
command line options for this.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agopython: add attach support
Christian Seiler [Tue, 21 May 2013 12:57:06 +0000 (14:57 +0200)]
python: add attach support

Add methods attach() and attach_wait() to the Python API that give
access to the attach functionality of LXC. Both accept two main
arguments:

1. run: A python function that is executed inside the container
2. payload: (optional) A parameter that will be passed to the python
            function

Additionally, the following keyword arguments are supported:

attach_flags: How attach should operate, i.e. whether to attach to
              cgroups, whether to drop capabilities, etc. The following
              constants are defined as part of the lxc module that may
              be OR'd together for this option:
                LXC_ATTACH_MOVE_TO_CGROUP
                LXC_ATTACH_DROP_CAPABILITIES
                LXC_ATTACH_SET_PERSONALITY
                LXC_ATTACH_APPARMOR
                LXC_ATTACH_REMOUNT_PROC_SYS
                LXC_ATTACH_DEFAULT
namespaces: Which namespaces to attach to, as defined as the flags that
            may be passed to the clone(2) system call. Note: maybe we
            should export these flags too.
personality: The personality of the process, it will be passed to the
             personality(2) syscall. Note: maybe we should provide
             access to the function that converts arch into
             personality.
initial_cwd: The initial working directory after attaching.
uid: The user id after attaching.
gid: The group id after attaching.
env_policy: The environment policy, may be one of:
              LXC_ATTACH_KEEP_ENV
              LXC_ATTACH_CLEAR_ENV
extra_env_vars: A list (or tuple) of environment variables (in the form
                KEY=VALUE) that should be set once attach has
                succeeded.
extra_keep_env: A list (or tuple) of names of environment variables
                that should be kept regardless of policy.
stdin: A file/socket/... object that should be used as stdin for the
       attached process. (If not a standard Python object, it has to
       implemented the fileno() method and provide a fd as the result.)
stdout, stderr: See stdin.

attach() returns the PID of the attached process, or -1 on failure.

attach_wait() returns the return code of the attached process after
that has finished executing, or -1 on failure. Note that if the exit
status of the process is 255, -1 will also be returned, since attach
failures result in an exit code of 255.

Two default run functions are also provided in the lxc module:

attach_run_command: Runs the specified command
attach_run_shell: Runs a shell in the container

Examples (assumeing c is a Container object):

c.attach_wait(lxc.attach_run_command, 'id')
c.attach_wait(lxc.attach_run_shell)
def foo():
  print("Hello World")
  # the following line is important, otherwise the exit code of
  # the attached program will be -1
  # sys.exit(0) will also work
  return 0
c.attach_wait(foo)
c.attach_wait(lxc.attach_run_command, ['cat', '/proc/self/cgroup'])
c.attach_wait(lxc.attach_run_command, ['cat', '/proc/self/cgroup'],
              attach_flags=(lxc.LXC_ATTACH_DEFAULT &
              ~lxc.LXC_ATTACH_MOVE_TO_CGROUP))

Note that while it is possible to execute Python code inside the
container by passing a function (see example), it is unwise to import
modules, since there is no guarantee that the Python installation
inside the container is in any way compatible with that outside of it.
If you want to run Python code directly, please import all modules
before attaching and only use them within the container.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agopython: improve convert_tuple_to_char_pointer_array
Christian Seiler [Tue, 13 Aug 2013 19:36:58 +0000 (21:36 +0200)]
python: improve convert_tuple_to_char_pointer_array

convert_tuple_to_char_pointer_array now also accepts lists and not only
tuples when converting to a C array. Other fixes:

 - some checking that it's actually a list/tuple before trying to
   convert
 - off-by-a-few-bytes allocation error
   (sizeof(char *)*n+1 vs. sizeof(char *)*(n+1)/calloc(...))

Signed-off-by: Christian Seiler <christian@iwakd.de>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoapparmor/attach: make sure buffer is NUL-terminated
Christian Seiler [Tue, 13 Aug 2013 19:33:19 +0000 (21:33 +0200)]
apparmor/attach: make sure buffer is NUL-terminated

Signed-off-by: Christian Seiler <christian@iwakd.de>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd attach support to container C API
Christian Seiler [Tue, 21 May 2013 12:57:06 +0000 (14:57 +0200)]
Add attach support to container C API

Signed-off-by: Christian Seiler <christian@iwakd.de>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoAdd helper functions to convert va_list of char* to char**.
Christian Seiler [Tue, 21 May 2013 12:56:00 +0000 (14:56 +0200)]
Add helper functions to convert va_list of char* to char**.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-attach: Completely rework lxc-attach and move to API function
Christian Seiler [Wed, 8 May 2013 12:57:35 +0000 (14:57 +0200)]
lxc-attach: Completely rework lxc-attach and move to API function

 - Move attach functionality to a completely new API function for
   attaching to containers. The API functions accepts the name of the
   container, the lxcpath, a structure indicating options for attaching
   and returns the pid of the attached process. The calling thread may
   then use waitpid() or similar to wait for the attached process to
   finish. lxc-attach itself is just a simple wrapper around the new
   API function.

 - Use CLONE_PARENT when creating the attached process from the
   intermediate process. This allows the intermediate process to exit
   immediately after attach and the original thread may supervise the
   attached process directly.

 - Since the intermediate process exits quickly, its only job is to
   send the original process the pid of the attached process (as seen
   from outside the pidns) and exit. This allows us to simplify the
   synchronisation logic by quite a bit.

 - Use O_CLOEXEC / SOCK_CLOEXEC on (hopefully) all FDs opened in the
   main thread by the attach logic so that other threads of the same
   program may safely fork+exec off. Also, use shutdown() on the
   synchronisation socket, so that if another thread forks off without
   exec'ing, the synchronisation will not fail. (Not tested whether
   this solves this issue.)

 - Instead of directly specifying a program to execute on the API
   level, one specifies a callback function and a payload. This allows
   code using the API to execute a custom function directly inside the
   container without having to execute a program. Two default callbacks
   are provided directly, one to execute an arbitrary program, another
   to execute a shell. The lxc-attach utility will always use either
   one of these default callbacks.

 - More fine-grained control of the attached process on the API level
   (not implemented in lxc-attach utility yet, some may not be sensible):
     * Specify which file descriptors should be stdin/stdout/stderr of
       the newly created process. If fds other than 0/1/2 are
       specified, they will be dup'd in the attached process (and the
       originals closed). This allows e.g. threaded applications to
       specify pipes for communication with the attached process
       without having to modify its own stdin/stdout/stderr before
       running lxc-attach.
     * Specify user and group id for the newly attached process.
     * Specify initial working directory for the newly attached
       process.
     * Fine-grained control on whether to do any, all or none of the
       following: move attached process into the container's init's
       cgroup, drop capabilities of the process, set the processes's
       personality, load the proper apparmor profile and (for partial
       attaches to any but not mount-namespaces) whether to unshare the
       mount namespace and remount /sys and /proc. If additional
       features (SELinux policy, SMACK policy, ...) are implemented,
       flags for those may also be provided.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agoFix return type of read/write utility functions.
Christian Seiler [Tue, 21 May 2013 09:58:35 +0000 (11:58 +0200)]
Fix return type of read/write utility functions.

Signed-off-by: Christian Seiler <christian@iwakd.de>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-stop: exit with 1 or 2, not -1 or -2.
Serge Hallyn [Wed, 14 Aug 2013 20:01:40 +0000 (15:01 -0500)]
lxc-stop: exit with 1 or 2, not -1 or -2.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc_destroy: print an error if the container is not defined.
Serge Hallyn [Wed, 14 Aug 2013 19:58:48 +0000 (14:58 -0500)]
lxc_destroy: print an error if the container is not defined.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agocgroups: rework to handle nested containers with multiple and partial mounts
Serge Hallyn [Sat, 10 Aug 2013 04:47:37 +0000 (23:47 -0500)]
cgroups: rework to handle nested containers with multiple and partial mounts

Currently, if you create a container and use the mountcgruop hook,
you get the /lxc/c1/c1.real cgroup mounted to /.  If you then try
to start containers inside that container, lxc can get confused.
This patch addresses that, by accepting that the cgroup as found
in /proc/self/cgroup can be partially hidden by bind mounts.

In this patch:

Add optional 'lxc.cgroup.use' to /etc/lxc/lxc.conf to specify which
mounted cgroup filesystems lxc should use.  So far only the cgroup
creation respects this.

Keep separate cgroup information for each cgroup mountpoint.  So if
the caller is in devices cgroup /a but cpuset cgroup /b that should
now be ok.

Change how we decide whether to ignore failure to set devices cgroup
settings.  Actually look to see if our current cgroup already has the
settings.  If not, add them.

Finally, the real reason for this patch: in a nested container,
/proc/self/cgroup says nothing about where under /sys/fs/cgroup you
might find yourself.  Handle this by searching for our pid in tasks
files, and keep that info in the cgroup handler.

Also remove all strdupa from cgroup.c (not android-friendly).

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc-user-nic: specify config and db files in autoconf
Serge Hallyn [Sat, 10 Aug 2013 02:08:28 +0000 (21:08 -0500)]
lxc-user-nic: specify config and db files in autoconf

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agoadd lxc-user-nic
Serge Hallyn [Fri, 9 Aug 2013 19:48:35 +0000 (14:48 -0500)]
add lxc-user-nic

It is meant to be run setuid-root to allow unprivileged users to
tunnel veths from a host bridge to their containers.  The program
looks at /etc/lxc/lxc-usernet which has entries of the form

user type bridge number

The type currently must be veth.  Whenver lxc-user-nic creates a
nic for a user, it records it in /var/lib/lxc/nics (better location
is needed).  That way when a container dies lxc-user-nic can cull
the dead nic from the list.

The -DISTEST allows lxc-user-nic to be compiled so that it uses
files under /tmp and doesn't actually create the nic, so that
unprivileged users can compile and test the code.  lxc-test-usernic
is a script which runs a few tests using lxc-usernic-test, which
is a version of lxc-user-nic compiled with -DISTEST.

The next step, after issues with this code are raised and addressed,
is to have lxc-start, when running unprivileged, call out to
lxc-user-nic (will have to exec so that setuid-root is honored).
On top of my previous unprivileged-creation patchset, that should
allow unprivileged users to create and start useful containers.

Also update .gitignore.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agohooks/Makefile.am: add ubuntu-cloud-prep
Serge Hallyn [Wed, 14 Aug 2013 14:57:12 +0000 (09:57 -0500)]
hooks/Makefile.am: add ubuntu-cloud-prep

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
10 years agolxc.conf.sgml.in: note the arguments and environment variables passed to hooks
Serge Hallyn [Tue, 13 Aug 2013 18:45:56 +0000 (13:45 -0500)]
lxc.conf.sgml.in: note the arguments and environment variables passed to hooks

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>