]> git.proxmox.com Git - mirror_lxc.git/log
mirror_lxc.git
2 years agomeson: Get test binaries to match autotools
Stéphane Graber [Sun, 1 May 2022 08:03:21 +0000 (10:03 +0200)]
meson: Get test binaries to match autotools

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #4108 from stgraber/master
Christian Brauner [Fri, 29 Apr 2022 07:51:29 +0000 (09:51 +0200)]
Merge pull request #4108 from stgraber/master

Meson improvements

2 years agoUpdate MAINTAINERS file
Stéphane Graber [Fri, 29 Apr 2022 03:12:30 +0000 (23:12 -0400)]
Update MAINTAINERS file

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agomeson: Fix unix epoch
Stéphane Graber [Fri, 29 Apr 2022 02:35:21 +0000 (22:35 -0400)]
meson: Fix unix epoch

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agomeson: Update run_command calls
Stéphane Graber [Fri, 29 Apr 2022 02:32:56 +0000 (22:32 -0400)]
meson: Update run_command calls

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agomeson: Install the test binaries
Stéphane Graber [Fri, 29 Apr 2022 02:19:03 +0000 (22:19 -0400)]
meson: Install the test binaries

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agomeson: Cleanup build configs
Stéphane Graber [Fri, 29 Apr 2022 01:21:09 +0000 (21:21 -0400)]
meson: Cleanup build configs

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agomeson: Remove non-existent tests
Stéphane Graber [Thu, 28 Apr 2022 21:55:11 +0000 (17:55 -0400)]
meson: Remove non-existent tests

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #4101 from memnoth/fix-fail-exec-dnsmasq
Stéphane Graber [Sun, 3 Apr 2022 00:33:25 +0000 (20:33 -0400)]
Merge pull request #4101 from memnoth/fix-fail-exec-dnsmasq

lxc-net.in: fix failure executing dnsmasq

2 years agolxc-net.in: fix failure executing dnsmasq
Leesoo Ahn [Sat, 2 Apr 2022 11:23:21 +0000 (20:23 +0900)]
lxc-net.in: fix failure executing dnsmasq

Failure executing dnsmasq happens if misc dir is not existed as the
following error messages.

localhost.localdomain systemd[1]: Starting LXC network bridge setup...
localhost.localdomain lxc-net[5754]: dnsmasq: cannot open or create lease file /usr/local/var/lib/misc/dnsmasq.lxcbr0.leases: No such file or directory
localhost.localdomain dnsmasq[5754]: cannot open or create lease file /usr/local/var/lib/misc/dnsmasq.lxcbr0.leases: No such file or directory
localhost.localdomain dnsmasq[5754]: FAILED to start up
localhost.localdomain lxc-net[5727]: Failed to setup lxc-net.
localhost.localdomain lxc-net[5727]: Failed to setup lxc-net.
localhost.localdomain systemd[1]: lxc-net.service: Main process exited, code=exited, status=1/FAILURE
localhost.localdomain systemd[1]: lxc-net.service: Failed with result 'exit-code'.
localhost.localdomain systemd[1]: Failed to start LXC network bridge setup.

Modify 'lxc-net' script to call 'mkdir -p' command if the directory is not
existed before executing dnsmasq daemon.

Signed-off-by: Leesoo Ahn <lsahn@ooseel.net>
2 years agoMerge pull request #4099 from corubba/feature/stop-order
Stéphane Graber [Wed, 30 Mar 2022 15:40:16 +0000 (11:40 -0400)]
Merge pull request #4099 from corubba/feature/stop-order

tools: lxc-autostart: Reverse order on stop

2 years agotools: lxc-autostart: Reverse order on stop
corubba [Sun, 27 Mar 2022 00:36:20 +0000 (01:36 +0100)]
tools: lxc-autostart: Reverse order on stop

As it was already discussed in lxc/lxd#2082, containers should be
stopped in the opposite order they are started in. LXD does so already,
lxc should do the same.

Signed-off-by: Corubba Smith <corubba@gmx.de>
2 years agoMerge pull request #4098 from memnoth/mnth/fastpath-mkdir_p
Christian Brauner [Sat, 26 Mar 2022 16:40:02 +0000 (17:40 +0100)]
Merge pull request #4098 from memnoth/mnth/fastpath-mkdir_p

utils: add fastpath routine on mkdir_p function

2 years agoutils: add fastpath routine on mkdir_p function
Leesoo Ahn [Sat, 26 Mar 2022 12:09:05 +0000 (21:09 +0900)]
utils: add fastpath routine on mkdir_p function

Call 'access' to examine whether 'dir' is already existed or not instead
of directly calling 'mkdir' on each dir name separated by slash '/' even though
'dir' is existed.

Signed-off-by: Leesoo Ahn <lsahn@ooseel.net>
2 years agoMerge pull request #4096 from brauner/2022-03-22.meson
Stéphane Graber [Wed, 23 Mar 2022 16:57:19 +0000 (12:57 -0400)]
Merge pull request #4096 from brauner/2022-03-22.meson

build: add more tests to meson

2 years agobuild: add more tests to meson
Christian Brauner [Wed, 23 Mar 2022 15:11:00 +0000 (16:11 +0100)]
build: add more tests to meson

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agotests: fix include statements
Christian Brauner [Wed, 23 Mar 2022 15:10:48 +0000 (16:10 +0100)]
tests: fix include statements

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agoMerge pull request #4095 from brauner/2022-03-22.meson
Stéphane Graber [Tue, 22 Mar 2022 13:40:44 +0000 (09:40 -0400)]
Merge pull request #4095 from brauner/2022-03-22.meson

build: add tests to meson

2 years agobuild: add tests to meson
Christian Brauner (Microsoft) [Tue, 22 Mar 2022 07:48:43 +0000 (08:48 +0100)]
build: add tests to meson

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2 years agoMerge pull request #4091 from JamiKettunen/non-modular-kernels
Stéphane Graber [Wed, 9 Mar 2022 16:14:05 +0000 (17:14 +0100)]
Merge pull request #4091 from JamiKettunen/non-modular-kernels

lxc-checkconfig: Only check probed modules if /proc/modules exists

2 years agolxc-checkconfig: Only check probed modules if /proc/modules exists
Jami Kettunen [Tue, 8 Mar 2022 10:20:33 +0000 (12:20 +0200)]
lxc-checkconfig: Only check probed modules if /proc/modules exists

Kernels can be built with CONFIG_MODULES=n which results in
is_probed() telling the module isn't probed and lsmod spamming the
following to stderr each time it's called:

  libkmod: kmod_module_new_from_loaded: could not open /proc/modules: No such file or directory
  Error: could not get list of modules: No such file or directory

Fix this by "stubbing" is_probed() when /proc/modules doesn't exist
as it's always called after a is_enabled() anyway.

Signed-off-by: Jami Kettunen <jami.kettunen@protonmail.com>
2 years agoMerge pull request #4090 from brauner/2022-02-22.fixes.4
Stéphane Graber [Thu, 24 Feb 2022 16:32:30 +0000 (11:32 -0500)]
Merge pull request #4090 from brauner/2022-02-22.fixes.4

cgroups: modify cgroup2 attach logic

2 years agocgroups: modify cgroup2 attach logic
Christian Brauner [Wed, 23 Feb 2022 14:40:20 +0000 (15:40 +0100)]
cgroups: modify cgroup2 attach logic

Recent kernels have seen various permission checking fixes when moving
processes into cgroups. So we're forced to modify how we attach to
containers.

Link: https://discuss.linuxcontainers.org/t/lxd-4-23-unable-to-start-nested-containers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #4089 from brauner/2022-02-22.fixes
Stéphane Graber [Tue, 22 Feb 2022 15:52:37 +0000 (10:52 -0500)]
Merge pull request #4089 from brauner/2022-02-22.fixes

ttys: ensure container_ttys= env variable is set correctly

2 years agottys: ensure container_ttys= env variable is set correctly
Christian Brauner [Tue, 22 Feb 2022 11:17:23 +0000 (12:17 +0100)]
ttys: ensure container_ttys= env variable is set correctly

Fixes: #4088
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #4087 from tenforward/japanese
Christian Brauner [Mon, 21 Feb 2022 13:32:10 +0000 (14:32 +0100)]
Merge pull request #4087 from tenforward/japanese

doc: Fix reverse allowlist/denylist in Japanese man page

2 years agodoc: Fix reverse allowlist/denylist in Japanese man page
KATOH Yasufumi [Mon, 21 Feb 2022 13:17:36 +0000 (22:17 +0900)]
doc: Fix reverse allowlist/denylist in Japanese man page

Update for commit 2965130c45124a01f017144512c39fc39fa8717c

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
2 years agoMerge pull request #4085 from brauner/2022-02-20.cgroup.fixes
Stéphane Graber [Sun, 20 Feb 2022 19:53:07 +0000 (14:53 -0500)]
Merge pull request #4085 from brauner/2022-02-20.cgroup.fixes

cgroups: fixes

2 years agocgroups: log fd of newly created cgroup
Christian Brauner [Sun, 20 Feb 2022 14:51:13 +0000 (15:51 +0100)]
cgroups: log fd of newly created cgroup

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agocgroups: check that opened file descriptor is a cgroup filesystem
Christian Brauner [Sun, 20 Feb 2022 14:47:28 +0000 (15:47 +0100)]
cgroups: check that opened file descriptor is a cgroup filesystem

Link: https://discuss.linuxcontainers.org/t/lxd-4-23-unable-to-start-nested-containers/13416
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #4078 from stgraber/master
Christian Brauner [Thu, 3 Feb 2022 06:08:40 +0000 (07:08 +0100)]
Merge pull request #4078 from stgraber/master

lxc-checkconfig: Fix bashism

2 years agodoc: Fix reverse allowlist/denylist
Stéphane Graber [Thu, 3 Feb 2022 02:28:55 +0000 (21:28 -0500)]
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>
2 years agolxc-checkconfig: Fix bashism
Stéphane Graber [Thu, 3 Feb 2022 02:11:09 +0000 (21:11 -0500)]
lxc-checkconfig: Fix bashism

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #4077 from terceiro/lxc-net-on-lxc
Stéphane Graber [Wed, 2 Feb 2022 18:35:09 +0000 (13:35 -0500)]
Merge pull request #4077 from terceiro/lxc-net-on-lxc

lxc-net: don't start by default inside lxc

2 years agolxc-net: don't start by default inside lxc
Antonio Terceiro [Wed, 2 Feb 2022 18:11:02 +0000 (15:11 -0300)]
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>
2 years agoMerge pull request #4069 from brauner/2021-01-21.fixes
Stéphane Graber [Fri, 21 Jan 2022 12:47:07 +0000 (07:47 -0500)]
Merge pull request #4069 from brauner/2021-01-21.fixes

lxccontainer: allow xdev when creating the container dir

2 years agolxccontainer: allow xdev when creating the container dir
Christian Brauner [Fri, 21 Jan 2022 08:44:01 +0000 (09:44 +0100)]
lxccontainer: allow xdev when creating the container dir

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #4065 from stgraber/master
Christian Brauner [Thu, 20 Jan 2022 17:06:53 +0000 (18:06 +0100)]
Merge pull request #4065 from stgraber/master

github: Clear default ACL on /home

2 years agogithub: Clear default ACL on /home
Stéphane Graber [Thu, 20 Jan 2022 16:05:19 +0000 (11:05 -0500)]
github: Clear default ACL on /home

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #4066 from brauner/2022-01-18.fixes.2
Stéphane Graber [Thu, 20 Jan 2022 13:43:50 +0000 (08:43 -0500)]
Merge pull request #4066 from brauner/2022-01-18.fixes.2

conf, lxccontainer, build: fixes

2 years agogithub: add systemd-coredump
Christian Brauner [Thu, 20 Jan 2022 11:35:06 +0000 (12:35 +0100)]
github: add systemd-coredump

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agogithub: more detailed compilation instructions
Christian Brauner [Thu, 20 Jan 2022 11:33:57 +0000 (12:33 +0100)]
github: more detailed compilation instructions

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agogithub: log system info
Christian Brauner [Thu, 20 Jan 2022 11:23:35 +0000 (12:23 +0100)]
github: log system info

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agogithub: ensure system liblxc is wiped
Christian Brauner [Thu, 20 Jan 2022 09:34:02 +0000 (10:34 +0100)]
github: ensure system liblxc is wiped

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agolxccontainer: properly wrap lxcapi_create()
Christian Brauner [Thu, 20 Jan 2022 09:14:13 +0000 (10:14 +0100)]
lxccontainer: properly wrap lxcapi_create()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: simplify thread local storage handling
Christian Brauner [Thu, 20 Jan 2022 08:57:21 +0000 (09:57 +0100)]
build: simplify thread local storage handling

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: only enable LTO for regular builds
Christian Brauner [Thu, 20 Jan 2022 08:42:28 +0000 (09:42 +0100)]
build: only enable LTO for regular builds

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agolxccontainer: simplify partial file creation
Christian Brauner [Tue, 18 Jan 2022 17:44:37 +0000 (18:44 +0100)]
lxccontainer: simplify partial file creation

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agolxccontainer: improve create_partial()
Christian Brauner [Tue, 18 Jan 2022 16:48:29 +0000 (17:48 +0100)]
lxccontainer: improve create_partial()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agolxccontainer: improve do_lxcapi_create()
Christian Brauner [Tue, 18 Jan 2022 16:25:07 +0000 (17:25 +0100)]
lxccontainer: improve do_lxcapi_create()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agolxccontainer: improve do_lxcapi_save_config()
Christian Brauner [Tue, 18 Jan 2022 15:57:47 +0000 (16:57 +0100)]
lxccontainer: improve do_lxcapi_save_config()

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoconf: log termination status
Christian Brauner [Tue, 18 Jan 2022 15:26:58 +0000 (16:26 +0100)]
conf: log termination status

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoconf: improve userns_exec_mapped_root()
Christian Brauner [Tue, 18 Jan 2022 15:14:13 +0000 (16:14 +0100)]
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>
2 years agoMerge pull request #4063 from simondeziel/gnupg
Stéphane Graber [Tue, 18 Jan 2022 15:00:27 +0000 (10:00 -0500)]
Merge pull request #4063 from simondeziel/gnupg

github: stop installing gnupg now that it's unused

2 years agogithub: stop installing gnupg now that it's unused
Simon Deziel [Tue, 18 Jan 2022 14:53:45 +0000 (09:53 -0500)]
github: stop installing gnupg now that it's unused

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
2 years agoMerge pull request #4062 from stgraber/master
Christian Brauner [Tue, 18 Jan 2022 14:24:41 +0000 (15:24 +0100)]
Merge pull request #4062 from stgraber/master

lxc-download: Rely on HTTPS only

2 years agolxc-download: Rely on HTTPS only
Stéphane Graber [Tue, 18 Jan 2022 02:15:53 +0000 (21:15 -0500)]
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>
2 years agoMerge pull request #4058 from brauner/2022-01-13.fixes
Stéphane Graber [Fri, 14 Jan 2022 23:03:58 +0000 (18:03 -0500)]
Merge pull request #4058 from brauner/2022-01-13.fixes

cgroups: improvements

2 years agoMerge pull request #4059 from DevinNorgarb/patch-1
Stéphane Graber [Fri, 14 Jan 2022 16:30:18 +0000 (11:30 -0500)]
Merge pull request #4059 from DevinNorgarb/patch-1

Update README.md: Fix broken link (403 Forbidden)

2 years agoUpdate README.md: Fix broken link (403 Forbidden)
Devin Norgarb [Fri, 14 Jan 2022 16:04:16 +0000 (18:04 +0200)]
Update README.md: Fix broken link (403 Forbidden)

Signed-off-by: Devin Norgarb dnorgarb@gmail.com
2 years agoattach: don't pointlessly call cgroup_init()
Christian Brauner [Thu, 13 Jan 2022 17:48:15 +0000 (18:48 +0100)]
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>
2 years agocommands: log command during file descriptor retrieval
Christian Brauner [Thu, 13 Jan 2022 16:42:17 +0000 (17:42 +0100)]
commands: log command during file descriptor retrieval

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #4057 from Dmole/patch-2
Stéphane Graber [Wed, 12 Jan 2022 20:36:53 +0000 (15:36 -0500)]
Merge pull request #4057 from Dmole/patch-2

lxc-checkconfig.in: CONFIG_NF_NAT_IPV4

2 years agolxc-checkconfig.in: CONFIG_NF_NAT_IPV4 was removed from the kernel 2019-03-03
Tim [Wed, 12 Jan 2022 14:55:25 +0000 (09:55 -0500)]
lxc-checkconfig.in: CONFIG_NF_NAT_IPV4 was removed from the kernel 2019-03-03

Signed-off-by: Tim L <elatllat@gmail.com>
2 years agoMerge pull request #4054 from hallyn/2022-01-09/trivial
Stéphane Graber [Sun, 9 Jan 2022 22:16:17 +0000 (23:16 +0100)]
Merge pull request #4054 from hallyn/2022-01-09/trivial

(trivial) Fix error message, failure was connect not bind

2 years ago(trivial) Fix error message, failure was connect not bind
Serge Hallyn [Sun, 9 Jan 2022 16:16:02 +0000 (10:16 -0600)]
(trivial) Fix error message, failure was connect not bind

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2 years agoMerge pull request #4053 from brauner/2022-01-07.fixes
Wolfgang Bumiller [Fri, 7 Jan 2022 13:19:10 +0000 (14:19 +0100)]
Merge pull request #4053 from brauner/2022-01-07.fixes

seccomp: close seccomp notifier fd in cleanup handler

2 years agoseccomp: close seccomp notifier fd in cleanup handler
Christian Brauner [Fri, 7 Jan 2022 12:42:33 +0000 (13:42 +0100)]
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>
2 years agoMerge pull request #4047 from brauner/2021-12-10.fixes
Stéphane Graber [Fri, 10 Dec 2021 17:14:11 +0000 (12:14 -0500)]
Merge pull request #4047 from brauner/2021-12-10.fixes

seccomp: only guard seccomp notify behind HAVE_DECL_SECCOMP_NOTIFY_FD

2 years agoseccomp: only guard seccomp notify behind HAVE_DECL_SECCOMP_NOTIFY_FD
Christian Brauner [Fri, 10 Dec 2021 16:05:11 +0000 (17:05 +0100)]
seccomp: only guard seccomp notify behind HAVE_DECL_SECCOMP_NOTIFY_FD

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #4043 from brauner/2021-12-06.fixes
Stéphane Graber [Wed, 8 Dec 2021 15:59:43 +0000 (10:59 -0500)]
Merge pull request #4043 from brauner/2021-12-06.fixes

api-extensions: don't advertise seccomp notify support if it's not co…

2 years agoapi-extensions: don't advertise seccomp notify support if it's not compiled in
Christian Brauner [Wed, 8 Dec 2021 09:41:59 +0000 (10:41 +0100)]
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>
2 years agoMerge pull request #4042 from Blub/2021-12-03/two-sysfs-instances-main
Christian Brauner [Fri, 3 Dec 2021 14:46:29 +0000 (15:46 +0100)]
Merge pull request #4042 from Blub/2021-12-03/two-sysfs-instances-main

use 2 sysfs instances for sys:mixed

2 years agouse 2 sysfs instances for sys:mixed
Wolfgang Bumiller [Fri, 3 Dec 2021 08:13:11 +0000 (09:13 +0100)]
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>
2 years agoRevert "api: ->save_config() doesn't need to create container dir"
Stéphane Graber [Tue, 30 Nov 2021 22:39:34 +0000 (17:39 -0500)]
Revert "api: ->save_config() doesn't need to create container dir"

This reverts commit 2fde07c3990fe09925699da5d9a1762eb279c497.

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>
2 years agoMerge pull request #4039 from tych0/config-no-container-dir
Christian Brauner [Mon, 29 Nov 2021 16:26:06 +0000 (17:26 +0100)]
Merge pull request #4039 from tych0/config-no-container-dir

api: ->save_config() doesn't need to create container dir

2 years agoMerge pull request #4040 from tych0/fix-cgroup-warning
Christian Brauner [Mon, 29 Nov 2021 16:25:45 +0000 (17:25 +0100)]
Merge pull request #4040 from tych0/fix-cgroup-warning

cgroups: fix compiler warning

2 years agoapi: ->save_config() doesn't need to create container dir
Tycho Andersen [Mon, 29 Nov 2021 13:23:17 +0000 (08:23 -0500)]
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>
2 years agocgroups: fix compiler warning
Tycho Andersen [Mon, 29 Nov 2021 13:38:30 +0000 (08:38 -0500)]
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>
2 years agoMerge pull request #4035 from Blub/revert-vfork
Christian Brauner [Sat, 13 Nov 2021 22:24:12 +0000 (23:24 +0100)]
Merge pull request #4035 from Blub/revert-vfork

Revert "initutils: use vfork() in lxc_container_init()"

2 years agoRevert "initutils: use vfork() in lxc_container_init()"
Wolfgang Bumiller [Sat, 13 Nov 2021 17:20:13 +0000 (18:20 +0100)]
Revert "initutils: use vfork() in lxc_container_init()"

This reverts commit d65e5e492f740bbb50e3005f97420c3ddae3d595.

With vfork the child process modifies the parent's memory,
so the calls to `signal`, `fprintf` and regular `exit` may
be dangerous and might cause conflicting states in the
parent.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoMerge pull request #4033 from brauner/2021-11-09.fixes
Stéphane Graber [Tue, 9 Nov 2021 14:48:37 +0000 (09:48 -0500)]
Merge pull request #4033 from brauner/2021-11-09.fixes

macro: ensure necessary io_uring flags are defined

2 years agomacro: ensure necessary io_uring flags are defined
Christian Brauner [Tue, 9 Nov 2021 13:01:35 +0000 (14:01 +0100)]
macro: ensure necessary io_uring flags are defined

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #4032 from joanbm/master
Christian Brauner [Mon, 8 Nov 2021 18:41:47 +0000 (19:41 +0100)]
Merge pull request #4032 from joanbm/master

autotools: Avoid multiple liblxc.so with --enable-pam

2 years agoautotools: Avoid multiple liblxc.so with --enable-pam
Joan Bruguera [Sun, 7 Nov 2021 11:38:15 +0000 (12:38 +0100)]
autotools: Avoid multiple liblxc.so with --enable-pam

When installing LXC with the default options, a single non-symlink liblxc.so*
(e.g. liblxc.so.1.7.0) file is created:

```
    $ ./autogen.sh && ./configure && make && \
    rm -rf "$HOME/lxci" && make DESTDIR="$HOME/lxci" install && \
    stat -c%N "$HOME/lxci/usr/local/lib/liblxc.so"*
    [...]
    '/home/someone/lxci/usr/local/lib/liblxc.so' -> 'liblxc.so.1'
    '/home/someone/lxci/usr/local/lib/liblxc.so.1' -> 'liblxc.so.1.7.0'
    '/home/someone/lxci/usr/local/lib/liblxc.so.1.7.0'
```

However, when automake>=1.16.5, and the `--enable-pam` option is used, two
non-symlink liblxc.so* (e.g. liblxc.so.1.0.0 and liblxc.so.1.7.0) are
erroneously created:

```
    $ ./autogen.sh && ./configure --enable-pam && make && \
    rm -rf "$HOME/lxci" && make DESTDIR="$HOME/lxci" install && \
    stat -c%N "$HOME/lxci/usr/local/lib/liblxc.so"*
    [...]
    '/home/someone/lxci/usr/local/lib/liblxc.so' -> 'liblxc.so.1.0.0'
    '/home/someone/lxci/usr/local/lib/liblxc.so.1' -> 'liblxc.so.1.0.0'
    '/home/someone/lxci/usr/local/lib/liblxc.so.1.0.0'
    '/home/someone/lxci/usr/local/lib/liblxc.so.1.7.0'
```

This is due to infighting between libtool's and LXC's versioning:
libtool creates liblxc.so.1.0.0, then LXC's `install-exec-local` hook in
`Makefile.am` moves it to liblxc.so.1.7.0. However, with `--enable-pam`, the
`install-libLTLIBRARIES` target is re-triggered after `install-pamLTLIBRARIES`,
which will create liblxc.so.1.0.0 again.

The bigger problem here is that the install for the pam_cgfs library is done on
the `data` phase of the automake install process instead of the `exec` phase
(https://www.gnu.org/software/automake/manual/html_node/The-Two-Parts-of-Install.html),
which gives `install-libLTLIBRARIES` a chance to run again after the
`install-exec-local` / `install-exec-hook` targets have already run.

To fix this, we add an "exec_" prefix to the pam_cgfs library to make it run
during the `exec` phase (see link above). We also consolidate the various hooks
in the `install-exec-hook` target, which runs after the whole install, avoiding
needing to manually specify the dependencies like in `install-exec-local`.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2 years agoMerge pull request #4030 from brauner/2021-11-04.fixes
Stéphane Graber [Thu, 4 Nov 2021 15:28:03 +0000 (11:28 -0400)]
Merge pull request #4030 from brauner/2021-11-04.fixes

conf: lxc.proc.* and lxc.sysctl.* fixes and tests

2 years agobuild: refuse to compile with unsupported liburing version
Christian Brauner [Thu, 4 Nov 2021 14:45:58 +0000 (15:45 +0100)]
build: refuse to compile with unsupported liburing version

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agotests: add lxc.proc.* test
Christian Brauner [Thu, 4 Nov 2021 13:05:25 +0000 (14:05 +0100)]
tests: add lxc.proc.* test

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agotests: add lxc.sysctls.* test
Christian Brauner [Thu, 4 Nov 2021 10:59:08 +0000 (11:59 +0100)]
tests: add lxc.sysctls.* test

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agotest: improve logging helpers
Christian Brauner [Thu, 4 Nov 2021 11:13:02 +0000 (12:13 +0100)]
test: improve logging helpers

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoconf: improve logging setting sysctl and /proc/<pid>/ parameters
Christian Brauner [Thu, 4 Nov 2021 12:46:52 +0000 (13:46 +0100)]
conf: improve logging setting sysctl and /proc/<pid>/ parameters

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoconf: apply /proc/sys and /proc/<pid>/ parameters
Christian Brauner [Thu, 4 Nov 2021 10:26:00 +0000 (11:26 +0100)]
conf: apply /proc/sys and /proc/<pid>/ parameters

When porting to the new list type we added an accidental ! when checking
whether the list is empty.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #4028 from brauner/2021-11-02.fixes
Stéphane Graber [Tue, 2 Nov 2021 14:06:45 +0000 (10:06 -0400)]
Merge pull request #4028 from brauner/2021-11-02.fixes

start: fixes

2 years agotests: include config.h
Christian Brauner [Tue, 2 Nov 2021 10:06:33 +0000 (11:06 +0100)]
tests: include config.h

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agobuild: move _FILE_OFFSET_BITS to common option
Christian Brauner [Tue, 2 Nov 2021 09:57:24 +0000 (10:57 +0100)]
build: move _FILE_OFFSET_BITS to common option

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agostart: log signal name and number
Christian Brauner [Tue, 2 Nov 2021 09:48:52 +0000 (10:48 +0100)]
start: log signal name and number

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoprocess_utils: add signal_name() helper
Christian Brauner [Tue, 2 Nov 2021 09:42:09 +0000 (10:42 +0100)]
process_utils: add signal_name() helper

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agoMerge pull request #4025 from brauner/2021-10-30.fixes
Stéphane Graber [Mon, 1 Nov 2021 14:33:51 +0000 (10:33 -0400)]
Merge pull request #4025 from brauner/2021-10-30.fixes

build: fixes

2 years agobuild: improve liburing support detection
Christian Brauner [Sat, 30 Oct 2021 15:45:50 +0000 (17:45 +0200)]
build: improve liburing support detection

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2 years agomainloop: make ifdefs easier to follow
Christian Brauner [Sat, 30 Oct 2021 15:38:37 +0000 (17:38 +0200)]
mainloop: make ifdefs easier to follow

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>