Commit Graph

2580 Commits

Author SHA1 Message Date
Stéphane Graber
9de2ebe995 coverity: Check fread length
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-14 19:13:36 -05:00
Serge Hallyn
7eb44573b0 re-open cgmanager socket after fork in daemonized start
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-14 19:12:32 -05:00
Serge Hallyn
1d16785799 lxc-start: close inherited fds right before exec
Not before we've even forked.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-14 19:12:32 -05:00
S.Çağlar Onur
93c379f09c move fnv_64a_buf to utils.c and remove mutliple copies (v2)
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-14 10:10:17 -05:00
Dwight Engen
684efc5ea1 coverity: fix resource leak
also fix the check if the string will fit the local buffer

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-14 10:09:45 -05:00
KATOH Yasufumi
77e229918d Japanese lxc-usernsexec manpage: fix typo
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-14 10:09:42 -05:00
Serge Hallyn
cc69660a57 lxc-usernsexec manpage: fix typo (command name is not lxc-unshare)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-02-13 22:40:51 -06:00
Stéphane Graber
c213f406f9
change version to 1.0.0.beta4 in configure.ac
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-13 18:51:50 -05:00
Stéphane Graber
e1579aaff6 Revert "move fnv_64a_buf to utils.c and remove mutliple copies"
Fix clang breakage.

This reverts commit 7cd32872b6.
2014-02-13 17:34:26 -05:00
S.Çağlar Onur
7cd32872b6 move fnv_64a_buf to utils.c and remove mutliple copies
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-13 17:02:01 -05:00
S.Çağlar Onur
604f0955b7 reindent src/lxc/af_unix.c
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-13 16:47:39 -05:00
Dwight Engen
69aa66552f create fd, stdin, stdout, stderr symlinks in /dev
The kernel's Documentation/devices.txt says that these symlinks should
exist in /dev (they are listed in the "Compulsory" section). I'm not
currently adding nfsd and X0R since they are required for iBCS, but
they can be easily added to the array later if need be.

Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Acked-by: Michael H. Warfield <mhw@WittsEnd.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-13 16:31:49 -05:00
Stéphane Graber
cd063f4524 python3: Update apitest
This update will make it work unprivileged as well as testing a few of
the new functions.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-13 14:14:11 -05:00
Stéphane Graber
c756a6e91b python3: Drop API warning and fix pep8/pyflakes3
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-13 14:14:03 -05:00
Stéphane Graber
8158c057dc lxc-start-ephemeral: Use attach
With this change, systems that support it will use attach to run any
provided command.

This doesn't change the default behaviour of attaching to tty1, but it
does make it much easier to script or even get a quick shell with:
lxc-start-ephemeral -o p1 -n p2 -- /bin/bash

I'm doing the setgid,initgroups,setuid,setenv magic in python rather
than using the attach_wait parameters as I need access to the pwd module
in the target namespace to grab the required information.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-13 14:13:49 -05:00
Stéphane Graber
5693029730
Update rootfs README
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-13 13:52:50 -05:00
Stéphane Graber
d693cf93cd Fix crash in rename with undefined containers
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-13 13:45:51 -05:00
Stéphane Graber
63d4950fef lxc-ls: Add a few new columns
This adds support for:
 - memory (total memory)
 - ram
 - swap

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-13 13:45:36 -05:00
Stéphane Graber
87d8dfe56c python3: Add missing get_running_config_item binding
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-13 13:45:27 -05:00
Stéphane Graber
6b9324bd45 coverity: Do chdir following chroot
We used to do chdir(path), chroot(path). That's correct but not properly
handled coverity, so do chroot(path), chdir("/") instead as that's the
recommended way.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-13 13:42:21 -05:00
KATOH Yasufumi
4473e38b99 doc: Update lxc.container.conf(5)
- Update Japanese man for commit a7c27357b3, seccomp v2
- Fix typo in English man

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-13 10:13:26 -05:00
KATOH Yasufumi
48e49f08c0 doc: Update Japanese man pages for aufs support
Update lxc-clone(1) and lxc-snapshot(1) for commit 1f92162dc0
and improve some translations

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-13 10:13:23 -05:00
Serge Hallyn
25190e5b10 overlayfs_clonepaths: if unpriv then rsync in a userns
This allows lxc-snapshot and lxc-clone -s from an overlayfs container
to work unprivileged.  (lxc-clone -s from a directory backed container
already did work)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-13 10:13:20 -05:00
Stéphane Graber
e9e0ec9906
Add the seccomp examples to EXTRA_DIST
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-12 23:19:45 -05:00
Serge Hallyn
a7c27357b3 seccomp: extend manpage, and add examples
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-12 19:26:32 -05:00
Serge Hallyn
2b0ae718c8 seccomp: don't support v2 if seccomp_syscall_resolve_name_arch is not avilable
Also don't use arm arch if not defined

This *should* fix build so precise, but I didn't fire one off.
I did test that builds with libseccomp2 still work as expected.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-12 18:31:52 -05:00
Stéphane Graber
5a15791eb2
Fix some configure.ac issues
- Run on distro without lsb_release
 - Don't try and interpret with_runtime_path as a command
 - Don't print stuff on screen while in the middle of a check

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-12 17:46:06 -05:00
Stéphane Graber
4d213bd3d7
travis: Build using the daily PPA
Now that we depend on seccomp2, the backport currently in precise is too
old to allow for a succesful build, so instead use ppa:ubuntu-lxc/daily
which contains recent versions of all needed build-dependencies.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-12 17:30:12 -05:00
Stéphane Graber
585ed6b1b6 coverity: Check return value from open
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-12 17:17:50 -05:00
Stéphane Graber
af61c481f5 coverity: Drop dead code
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-12 17:17:40 -05:00
Stéphane Graber
4ad9f44bcd coverity: Don't store fgets return value if we don't use it
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-12 17:04:18 -05:00
Stéphane Graber
35e3a0cdf7 coverity: check return value of fcntl in usernsexec
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-12 17:03:55 -05:00
Stéphane Graber
119126b6fc coverity: Always check mkdir_p's return value
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-12 17:03:35 -05:00
Stéphane Graber
57d2be5493 coverity: Check return value of fcntl in lxc_popen
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-12 17:03:01 -05:00
Stéphane Graber
e7de366c67 coverity: Free bdev in clone_update_rootfs
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-12 17:02:35 -05:00
Serge Hallyn
5079813884 seccomp: introduce v2 policy (v2)
v2 allows specifying system calls by name, and specifying
architecture.  A policy looks like:

2
whitelist
open
read
write
close
mount
[x86]
open
read

Also use SCMP_ACT_KILL by default rather than SCMP_ACT_ERRNO(31)  -
which confusingly returns 'EMLINK' on x86_64.  Note this change
is also done for v1 as I think it is worthwhile.

With this patch, I can in fact use a seccomp policy like:

2
blacklist
mknod errno 0

after which 'sudo mknod null c 1 3' silently succeeds without
creating the null device.

changelog v2:
  add blacklist support
  support default action
  support per-rule action

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-12 17:01:57 -05:00
Stéphane Graber
1f92162dc0 bdev: Add aufs support
This is pretty much copy/paste from overlayfs.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-12 16:43:55 -05:00
Stéphane Graber
e40bb7f458
travis: Drop workaround introduced last week
Travis has now corrected the bug in their build environment so we no
longer need to force the autogen script through bash.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-12 15:07:11 -05:00
Stéphane Graber
a974fa76e4 lxc-start-ephemeral: Allow unprivileged run
This allows running lxc-start-ephemeral using overlayfs. aufs remains
blocked as it hasn't been looked at and patched to work in the kernel at
this point (not sure if it ever wil).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-12 15:06:24 -05:00
Serge Hallyn
c8154066e8 check for access to lxcpath
The previous check for access to rootfs->path failed in the case of
overlayfs or loop backign stores.  Instead just check early on for
access to lxcpath.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-12 10:45:20 -05:00
Stéphane Graber
8b605e2305 Fix build failure (broken makefile)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-11 19:49:56 -05:00
Stéphane Graber
fd2b7320e3 tests: Don't hardcode architecture
If on Ubuntu, then match the host's own architecture, this should allow
for our tests to pass on the armhf CI environment.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-11 19:42:28 -05:00
Stéphane Graber
45794802f1 tests: Add lxc-test-autostart
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-11 19:30:13 -05:00
Serge Hallyn
a7ef8753bc bdev: allow unprivileged overlayfs snapshots
Also make sure to chown the new rootfs path to the container owner.
This is how we make sure that the container root is allowed to write
under delta0.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-11 18:58:42 -05:00
Stéphane Graber
061ba5d071 Add --with-runtime-path to configure
This allows older distros to override /run with whatever their own path
is, mostly useful for old RedHat and possibly Android.

Reported-by: Robert Vogelgesang <vogel@users.sourceforge.net>
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-11 18:57:57 -05:00
Stéphane Graber
be660853e4 conf: Save lxc.network.ipv4 broadcast address
Reported-by: Robert Vogelgesang <vogel@users.sourceforge.net>
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
2014-02-11 18:57:26 -05:00
Serge Hallyn
8c39f7a479 lxcapi-snapshot: don't snapshot directory-backed containers
Instead force a copy clone.  Else if the user makes a change
to the original container, the snapshot will be affected.
The user should first create a snapshot clone, then use
and snapshot that clone while leaving the original container
untouched.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-10 21:20:12 -05:00
Serge Hallyn
bbd23aa0bb warn about insufficient permissions
With this patch, if an unprivileged user has $HOME 700 or
750 and does

lxc-start -n c1

he'll see an error like:

lxc_container: Permission denied - could not access /home/serge.  Please grant it 'x' access, or add an ACL for t he container root.

(This addresses bug pad.lv/1277466)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-10 21:20:08 -05:00
TAMUKI Shoichi
ffeb76b460 lxc-plamo: various small changes
- Change redirection of fd 200 to 9 (greater than 9 may conflict with
  fd the shell uses internally)
- Replace numeric line addressing of ed to regular expression to avoid
  correcting the line addressing at each modification of init scripts
- Correct the option order (trivial)

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2014-02-10 13:14:09 -06:00
Stéphane Graber
271d94a3da travis: Workaround buggy build environment
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2014-02-07 20:35:03 -05:00