Commit Graph

23 Commits

Author SHA1 Message Date
Serge Hallyn
820d2a2b3a switch from libsystemd's dbus to dbus-1
This is purely so that we can do static linking.  Linking against
libsystemd makes that a challenge because while it's perfectly simple
to do, distros tend not to provide a libsystemd.a.

Tools that want to (a) link against liblxc and (b) have a statically
linked binary to bind into a minimal container are ill served by
this.  So link against libdbus-1.

.github/workflows/build.yml: switch to dbus-1.
src/lxc/cgroups/cgfsng.c: replace the unpriv_systemd_create_scope(),
   start_scope, and enter_scope() systemd code with dbus-1 code.
src/tests/oss-fuzz.sh: update from libsystemd-dev to libdbus-1-dev
src/tests/oss-fuzz.sh: disable dbus
.github/workflows/*: update from libsystemd-dev to libdbus-1-dev
meson.build and meson_options.txt: switch from sd_bus to dbus
lxc.spec.in: add dbus-1 to BuildRequires

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

Changelog: 03/13: use custom iter type so we can cleanup more easily...
Changelog: 03/13: initialize each dbus_iter to { 0 } as mihalicyn suggested.
2023-03-19 15:30:56 -05:00
Aleksa Sarai
c6c705bfa3
build: drop build-time systemd dependency
On openSUSE, our packages are build in the Open Build Service which does
not have a proper systemd installation that you can query to get the
systemdunitdir.

The simplest solution is to re-add the ability to explicitly set the
systemdunitdir (as was previously possible with the autotools build
system in pre-5.0 LXC).

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2022-10-31 00:07:56 +11:00
Đoàn Trần Công Danh
16ebb29dcc meson.build: allow explicit distrosysconfdir
Allows either:

- Build inside minimal-and-clean chroot with neither
  /etc/sysconfig nor /etc/default available.
- Cross Compile lxc from foreign distro,
  let's say host distro uses /etc/sysconfig and build distro
  uses /etc/default and vice versus.

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2022-08-10 07:12:44 +07:00
Serge Hallyn
c55353f84a
use systemd dbus StartTransientUnit for unpriv cgroup2
If, when init'ing cgroups for a container start, we detect that we
are an unprivileged user on a unified-hierarchy-only system, then we
try to request systemd, through dbus api, to create a new scope for
us with delegation.  Call the cgroup it creates for us P1.  We then
create P1/init, move ourselves into there, so we can enable the
controllers for delegation to P1's children through P1/cgroup.subtree_control.

On attach, we try to request systemd attach us to the container's
scope.  We can't do that ourselves in the normal case, as root owns
our login cgroups.

Create a new command api for the lxc monitor to tell lxc-attach the
systemd scope to which to attach.

Changelog:
 * free cgroup_meta.systemd_scope in lxc_conf_free (Thanks Tycho)
 * fix some indent
 * address some (not all) of brauner's feedback

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2022-06-21 16:01:13 +02:00
Petr Malat
f4d02217ee tools: Provide multicall lxc binary
Create a binary, which embeds all lxc tools similar way as busybox
embeds its applets. This is handy for embedded systems as it saves
roughly 90% of the disk space.

To disable normal tools and use multicall binary exclusively use the
following meson setup options:
  -Dtools=false -Dtools-multicall=true

Signed-off-by: Petr Malat <oss@malat.biz>
2022-06-15 16:27:47 +02:00
Christian Brauner
57f4bd73cb
build: map autotools options to meson options in meson_options.txt
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2022-06-13 15:46:33 +02:00
Christian Brauner
493bf2ded8
build: add missing memfd-rexec option
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2022-06-13 15:33:36 +02:00
Christian Brauner
0c4549a331
build: support thread-safety enforcement as option
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2022-06-13 15:33:31 +02:00
Christian Brauner
d42a3b1366
build: add oss-fuzz switch
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2022-06-09 23:07:07 +02:00
Christian Brauner
0b9adfdad4
build: add seccomp build option
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2022-06-09 23:07:07 +02:00
Christian Brauner
575d0e34ae
build: add additional command line switches
In order to compile for fuzzers where we will need and want to turn a
bunch of things off add command line switches that allow us to do so.

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2022-06-08 20:03:05 +02:00
Stéphane Graber
4dd5e0cf13
meson: Add coverity flag
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-06-07 17:18:03 -04:00
Stéphane Graber
8131bb44ec
meson: Add init scripts
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-05-30 19:16:40 -04:00
Stéphane Graber
b3d189920a
meson: Add tools option
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-05-27 22:02:36 -04:00
Stéphane Graber
54f1ddb39d
meson_options: Move entries around
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-05-27 22:02:34 -04:00
Christian Brauner
8c48813a6c
build: add pam_cgfs to meson
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
2022-05-19 11:49:48 +02:00
Stéphane Graber
9d18059b8d
meson: Add global config
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-05-12 22:23:58 +02:00
Stéphane Graber
7609de1826
meson: Rework options
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-05-07 18:47:11 +02:00
Stéphane Graber
0860988ed9
meson: Setup pkgconfig
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2022-05-01 11:50:18 +02:00
Christian Brauner
747bc634c5
build: add io-uring-event-loop option
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-10-28 17:07:27 +02:00
Christian Brauner
72f1c44ab2
build: add cmd builds
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-09-27 12:03:04 +02:00
Christian Brauner
dcfe4e135d
build: add more global config variables
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-09-13 11:03:34 +02:00
Christian Brauner
9b9d56e6e8
build: add meson skeleton
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-09-03 19:06:09 +02:00