Commit Graph

11306 Commits

Author SHA1 Message Date
Christian Brauner
cc07e2d6c0
Merge pull request #4078 from stgraber/master
lxc-checkconfig: Fix bashism
2022-02-03 07:08:40 +01:00
Stéphane Graber
2965130c45
doc: Fix reverse allowlist/denylist
Reported at: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1957934
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-02-02 21:28:58 -05:00
Stéphane Graber
903b1996b9
lxc-checkconfig: Fix bashism
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-02-02 21:11:09 -05:00
Stéphane Graber
73bc39ac8c
Merge pull request #4077 from terceiro/lxc-net-on-lxc
lxc-net: don't start by default inside lxc
2022-02-02 13:35:09 -05:00
Antonio Terceiro
b9dd36af0c lxc-net: don't start by default inside lxc
When lxc is installed inside an lxc container, trying to bring up
lxc-net with the default parameters will conflict with the networking
setup for lxc on the host. This breaks all networking inside the
container where lxc is installed.

Signed-off-by: Antonio Terceiro <terceiro@debian.org>
2022-02-02 15:14:09 -03:00
Stéphane Graber
97592484fa
Merge pull request #4069 from brauner/2021-01-21.fixes
lxccontainer: allow xdev when creating the container dir
2022-01-21 07:47:07 -05:00
Christian Brauner
1238fee01b
lxccontainer: allow xdev when creating the container dir
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-21 09:44:01 +01:00
Christian Brauner
a368b91a90
Merge pull request #4065 from stgraber/master
github: Clear default ACL on /home
2022-01-20 18:06:53 +01:00
Stéphane Graber
4188864e22
github: Clear default ACL on /home
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-01-20 11:31:24 -05:00
Stéphane Graber
55d6e49efe
Merge pull request #4066 from brauner/2022-01-18.fixes.2
conf, lxccontainer, build: fixes
2022-01-20 08:43:50 -05:00
Christian Brauner
8c1c30368a
github: add systemd-coredump
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:58:58 +01:00
Christian Brauner
a434e4d4f3
github: more detailed compilation instructions
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:58:58 +01:00
Christian Brauner
617efa73e1
github: log system info
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:58:58 +01:00
Christian Brauner
0fd92707a5
github: ensure system liblxc is wiped
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:59 +01:00
Christian Brauner
e53abc4196
lxccontainer: properly wrap lxcapi_create()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:59 +01:00
Christian Brauner
e27637b7b9
build: simplify thread local storage handling
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:59 +01:00
Christian Brauner
f7d3ef8380
build: only enable LTO for regular builds
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:59 +01:00
Christian Brauner
c123aa042a
lxccontainer: simplify partial file creation
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:59 +01:00
Christian Brauner
0e375b104b
lxccontainer: improve create_partial()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:58 +01:00
Christian Brauner
07ea844f4e
lxccontainer: improve do_lxcapi_create()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:58 +01:00
Christian Brauner
78ffe01108
lxccontainer: improve do_lxcapi_save_config()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:58 +01:00
Christian Brauner
e5af72a666
conf: log termination status
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:58 +01:00
Christian Brauner
e0f6f149d5
conf: improve userns_exec_mapped_root()
As we do in all other places, first drop groups, then use
setres{g,u}id().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-20 12:12:58 +01:00
Stéphane Graber
73ff048d66
Merge pull request #4063 from simondeziel/gnupg
github: stop installing gnupg now that it's unused
2022-01-18 10:00:27 -05:00
Simon Deziel
aec7c9c2fa github: stop installing gnupg now that it's unused
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
2022-01-18 09:53:45 -05:00
Christian Brauner
8128bbef4d
Merge pull request #4062 from stgraber/master
lxc-download: Rely on HTTPS only
2022-01-18 15:24:41 +01:00
Stéphane Graber
5852026304
lxc-download: Rely on HTTPS only
GPG has been a major source of issues over the years with various
attacks on the key network as well as client side issues making it hard
to retrieve our keys.

Back when we introduced the image server, SSL certificates were still
expensive and annoying to setup, so not something we'd have expected
potential mirrors to setup for us. They were also issued for multiple
years, making a compromise of such a certificate quite problematic.

But things have changed since, we now have completely free, very easily
deployable SSL certificates everywhere with the majority of those being
shortlived and with good reporting of issued certificates.

With that, we can now deprecate the GPG validation, disable the fallback
to non-HTTPS download and rely on our indices being accurate because
they've been downloaded from a server with a valid certificate.

This puts LXC more in line with what LXD has done since the beginning
and should offer a more reliable user experience.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-01-17 21:15:53 -05:00
Stéphane Graber
0d27a21656
Merge pull request #4058 from brauner/2022-01-13.fixes
cgroups: improvements
2022-01-14 18:03:58 -05:00
Stéphane Graber
10a2878e0d
Merge pull request #4059 from DevinNorgarb/patch-1
Update README.md: Fix broken link (403 Forbidden)
2022-01-14 11:30:18 -05:00
Devin Norgarb
5e7448b57b
Update README.md: Fix broken link (403 Forbidden)
Signed-off-by: Devin Norgarb dnorgarb@gmail.com
2022-01-14 18:04:16 +02:00
Christian Brauner
d979b58c38
attach: don't pointlessly call cgroup_init()
We can let attach detect that it is running on a cgroup layout without
writable cgroup hierarchies. In that case attach can finish early and
doesn't need to run the heavy-handed cgroup parsing code.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-13 18:51:00 +01:00
Christian Brauner
575704fe80
commands: log command during file descriptor retrieval
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-13 17:42:17 +01:00
Stéphane Graber
e3d53aeaf2
Merge pull request #4057 from Dmole/patch-2
lxc-checkconfig.in: CONFIG_NF_NAT_IPV4
2022-01-12 15:36:53 -05:00
Tim
5017adb35a lxc-checkconfig.in: CONFIG_NF_NAT_IPV4 was removed from the kernel 2019-03-03
Signed-off-by: Tim L <elatllat@gmail.com>
2022-01-12 09:55:25 -05:00
Stéphane Graber
544606ead3
Merge pull request #4054 from hallyn/2022-01-09/trivial
(trivial) Fix error message, failure was connect not bind
2022-01-09 23:16:17 +01:00
Serge Hallyn
8fd8c1586b (trivial) Fix error message, failure was connect not bind
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2022-01-09 10:16:02 -06:00
Wolfgang Bumiller
02e1f71011
Merge pull request #4053 from brauner/2022-01-07.fixes
seccomp: close seccomp notifier fd in cleanup handler
2022-01-07 14:19:10 +01:00
Christian Brauner
24707291b8
seccomp: close seccomp notifier fd in cleanup handler
Reported-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2022-01-07 13:42:33 +01:00
Stéphane Graber
2ac414d567
Merge pull request #4047 from brauner/2021-12-10.fixes
seccomp: only guard seccomp notify behind HAVE_DECL_SECCOMP_NOTIFY_FD
2021-12-10 12:14:11 -05:00
Christian Brauner
331ef062be
seccomp: only guard seccomp notify behind HAVE_DECL_SECCOMP_NOTIFY_FD
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-12-10 17:05:11 +01:00
Stéphane Graber
2750663619
Merge pull request #4043 from brauner/2021-12-06.fixes
api-extensions: don't advertise seccomp notify support if it's not co…
2021-12-08 10:59:43 -05:00
Christian Brauner
3eacbe106b
api-extensions: don't advertise seccomp notify support if it's not compiled in
Link: https://discuss.linuxcontainers.org/t/runtimeerror-failed-to-read-zi-bytes-from-dev-urandom
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-12-08 10:41:59 +01:00
Christian Brauner
ce72172592
Merge pull request #4042 from Blub/2021-12-03/two-sysfs-instances-main
use 2 sysfs instances for sys:mixed
2021-12-03 15:46:29 +01:00
Wolfgang Bumiller
53b2f3d5da use 2 sysfs instances for sys:mixed
In order to facilitate this, the default mount list's
'destination' may now be NULL to mean that the source should
be unmounted instead.

Here's what we need to do:

1) Ensure the first sysfs mount point is writable.
2) Mount a read-only sysfs on /sys
3) Bind devices/virtual/net *writably* into /sys

We use /proc/sys as a staging directory for the first sysfs
mount in read-write mode, then mount /sys r/o. Afterwards we
bind the r/w devices/virtual/net and unmount the staging
/proc/sys mount point.

The staging directory would not be required with the new
mount API, but this way we can support the old API and keep
the general workflow in the `default_mounts`.

Once we drop support for the old mount API, the
default_mounts table could just get a subdirectory field to
mount subdirectories directly.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-03 12:47:00 +01:00
Stéphane Graber
9873fb06d8
Revert "api: ->save_config() doesn't need to create container dir"
This reverts commit 2fde07c399.

We need to investigate this in more detail but this commit is breaking
LXD, causing startup to fail with:

lxc foo 20211130202833.906 INFO     conf - conf.c:run_script_argv:336 - Executing script "/bin/mount -t shiftfs -o passthrough=3 "/lxc-ci/build/tmp.WemmpzWGYz/go/src/github.com/lxc/lxd/test/tmp.Cli/0To/containers/foo/rootfs" "/lxc-ci/build/tmp.WemmpzWGYz/go/src/github.com/lxc/lxd/test/tmp.Cli/0To/containers/foo/rootfs"" for container "foo"
lxc foo 20211130202833.912 ERROR    conf - conf.c:run_buffer:321 - Script exited with status 32
lxc foo 20211130202833.912 ERROR    conf - conf.c:lxc_setup_rootfs_prepare_root:3947 - Failed to run pre-mount hooks
lxc foo 20211130202833.912 ERROR    conf - conf.c:lxc_setup:4317 - Failed to setup rootfs
lxc foo 20211130202833.912 ERROR    start - start.c:do_start:1275 - Failed to setup container "foo"

Not entirely sure why we're seeing things blow up as the directory
definitely exists (and contains a valid rootfs) but this was caused by
today's liblxc update.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2021-11-30 17:39:34 -05:00
Christian Brauner
030e1aaad5
Merge pull request #4039 from tych0/config-no-container-dir
api: ->save_config() doesn't need to create container dir
2021-11-29 17:26:06 +01:00
Christian Brauner
6a9cbecdaa
Merge pull request #4040 from tych0/fix-cgroup-warning
cgroups: fix compiler warning
2021-11-29 17:25:45 +01:00
Tycho Andersen
2fde07c399 api: ->save_config() doesn't need to create container dir
If we're saving the config file to somewhere that's *not* the container
dir, we don't need to create the container dir. Let's not do this and
thus not require its parent to exist, which can be confusing, especially in
light of the sparse logging through these functions.

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
2021-11-29 08:55:31 -05:00
Tycho Andersen
2b113b55c7 cgroups: fix compiler warning
I get:

In file included from cgroups/cgfsng.c:42:
In function 'cpuset1_cpus_initialize',
    inlined from 'cpuset1_initialize' at cgroups/cgfsng.c:658:7,
    inlined from '__cgroup_tree_create.constprop' at cgroups/cgfsng.c:723:26:
./log.h:376:9: error: '%s' directive argument is null [-Werror=format-overflow=]
  376 |         LXC_ERROR(&locinfo, format, ##__VA_ARGS__);                     \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./log.h:457:17: note: in expansion of macro 'ERROR'
  457 |                 ERROR("%s - " format, ptr, ##__VA_ARGS__); \
      |                 ^~~~~
./log.h:491:17: note: in expansion of macro 'SYSERROR'
  491 |                 SYSERROR(format, ##__VA_ARGS__);              \
      |                 ^~~~~~~~
cgroups/cgfsng.c:585:24: note: in expansion of macro 'log_error_errno'
  585 |                 return log_error_errno(false, errno, "Failed to read file \"%s\"", fpath);
      |                        ^~~~~~~~~~~~~~~

it turns out here that fpath is not used, so let's get rid of it and just
render the dfd+pathname directly.

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
2021-11-29 08:40:30 -05:00
Christian Brauner
7cf6f28ed8
Merge pull request #4035 from Blub/revert-vfork
Revert "initutils: use vfork() in lxc_container_init()"
2021-11-13 23:24:12 +01:00