Commit Graph

11821 Commits

Author SHA1 Message Date
Serge Hallyn
f934e8f78b
Merge pull request #4530 from stgraber/main
Some checks failed
Tests / Code (push) Has been cancelled
Tests / Test suite (clang, ubuntu-22.04, default) (push) Has been cancelled
Tests / Test suite (clang, ubuntu-22.04, sanitizer) (push) Has been cancelled
Tests / Test suite (clang, ubuntu-22.04-arm, default) (push) Has been cancelled
Tests / Test suite (clang, ubuntu-24.04, default) (push) Has been cancelled
Tests / Test suite (clang, ubuntu-24.04, sanitizer) (push) Has been cancelled
Tests / Test suite (clang, ubuntu-24.04-arm, default) (push) Has been cancelled
Tests / Test suite (gcc, ubuntu-22.04, default) (push) Has been cancelled
Tests / Test suite (gcc, ubuntu-22.04-arm, default) (push) Has been cancelled
Tests / Test suite (gcc, ubuntu-24.04, default) (push) Has been cancelled
Tests / Test suite (gcc, ubuntu-24.04-arm, default) (push) Has been cancelled
Switch to new MAC address prefix
2025-03-16 09:18:15 -05:00
Stéphane Graber
7914afb0cd
global: Switch to new MAC prefix
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2025-03-16 02:23:00 -04:00
Stéphane Graber
7bd24f6cbf
global: Switch MAC generation to Zabbly prefix
Zabbly obtained the 10:66:6a MAC address prefix for use by
the Linux Containers project.

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2025-03-16 02:20:45 -04:00
Stéphane Graber
447da373c1
Merge pull request #4527 from Managor/config
sysconfig/lxc: remove false comment
2025-03-02 22:10:54 -05:00
Managor
31cd146822
sysconfig/lxc: remove false comment
Signed-off-by: Managor <42655600+Managor@users.noreply.github.com>
2025-03-01 20:33:43 +02:00
Stéphane Graber
fc77e20953
Merge pull request #4521 from mathiasaerts/feature/option-disable-ipv6
Added LXC_IPV6_ENABLE option for lxc-net to enable or disable IPv6
2025-02-20 17:13:31 -05:00
Mathias Aerts
d047d81b77
Added LXC_IPV6_ENABLE option for lxc-net to enable or disable IPv6
Signed-off-by: Mathias Aerts <mathias.aerts@delta.blue>
2025-02-20 22:50:04 +01:00
Stéphane Graber
32b8126072
Merge pull request #4524 from stgraber/main
github: Switch to native arm64 runners
2025-02-20 11:52:22 -05:00
Stéphane Graber
3befeeb194
Merge pull request #4523 from irnes/fix/bcast
config-bcast: fix incorrect broadcast address calculation
2025-02-20 11:32:48 -05:00
Stéphane Graber
9c9c27e8c4
github: Switch to native arm64 runners
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2025-02-20 11:27:49 -05:00
Irnes Mujkanovic
59825e1870 config-bcast: fix incorrect broadcast address calculation
Signed-off-by: Irnes Mujkanovic <irnes.mujkanovic@gmail.com>
2025-02-20 15:28:31 +01:00
Stéphane Graber
9e95451ecc
Merge pull request #4517 from mihalicyn/lxc_attach_regression_fix
lxc/attach: Revert "- LXC attach should exit on SIGCHLD"
2025-01-24 09:02:45 -05:00
Alexander Mikhalitsyn
b4248f626b
lxc/attach: Revert "- LXC attach should exit on SIGCHLD"
This reverts commit f021584396.

Let's revert this change as it introduces 2 regressions:
1. it's not correct to do exit(2) from a signal handler in this case,
as we skip a proper cleaning procedures like restoring PTY configuration
state (see lxc_terminal_delete()) which leads to a problem with a PTY after lxc-attach exits.

[ hint: just try to use lxc-attach on a main branch with this change and you will
see it. After lxc-attach exits you won't be able to type anything in your
current terminal session as it's messed up. ]

2. this introduces race-condition in the code which leads to a
regression on LXD/(and I believe Incus too) which can be seen as
random "Failed to retrieve PID of executing child process" errors
on "lxc exec"/"incus exec" commands. It's extremely hard to reproduce,
but my guess is that we are getting a race condition here, because
by the time when we set a new signal handler for SIGCHLD, transient process
is still alive and when it exists it generates SIGCHLD which may lead to
exit().

3. This changes a behavior of lxc-attach which was there for *years*
and it's quite scary to be honest. I'm not against having this change, but
in a different form, for example we can add a new command line parameter for
lxc-attach command which will enable this behavior.

My first attempt was to fix that change to prevent race, but then
I've noticed that we also have a more serious problem described in (1),
this requires more work to do.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2025-01-24 14:20:34 +01:00
Stéphane Graber
040e006d5d
Merge pull request #4512 from sdanailo-42/chore/add-useful-logging
conf: useful logging for capabilities
2025-01-09 18:24:26 -05:00
Stéphane Graber
4a4ba051aa
Merge pull request #4511 from sdanailo-42/fix/dbus-hard-coded-address
dbus: replace hardcoded dbus address with environment variable
2025-01-09 18:05:20 -05:00
Sotir Danailov
8d8fd27b57 conf: warn when capabilities are disabled or libcap is not found
The reason for this warning, is that the project will compile and when it does
not work, it's not clear from the logs what the reason might be.

Signed-off-by: Sotir Danailov <sndanailov@gmail.com>
2025-01-09 23:43:24 +01:00
Sotir Danailov
844c49fcf3 dbus: replace hardcoded dbus address with environment variable
Signed-off-by: Sotir Danailov <sndanailov@gmail.com>
2025-01-09 23:41:28 +01:00
Sotir Danailov
4c46368305 conf: log name of invalid capability in error
Signed-off-by: Sotir Danailov <sndanailov@gmail.com>
2025-01-09 00:05:26 +01:00
Stéphane Graber
a42884ea3c
Merge pull request #4510 from asainkujovic/undefisnotzero
confile-vlanid: undefined is not a zero value
2025-01-03 10:42:19 -05:00
Asain Kujovic
50be11e8d8 confile-vlanid: undefined is not a zero value
Signed-off-by: Asain Kujovic <asainnp@gmail.com>
2025-01-02 22:45:25 +01:00
Serge Hallyn
29be7b9d20
Merge pull request #4509 from asainkujovic/lxc-attach-exit
- LXC attach should exit on SIGCHLD
2025-01-02 14:21:52 -06:00
Asain Kujovic
f021584396 - LXC attach should exit on SIGCHLD
Signed-off-by: Asain Kujovic <asainnp@gmail.com>
2025-01-02 20:48:27 +01:00
Christian Brauner
192ee85d65
Merge pull request #4506 from stgraber/main
Github Actions improvements
2024-12-19 07:59:57 +01:00
Stéphane Graber
9589be83c1
github: Improve progress reporting
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-12-18 23:58:59 -05:00
Stéphane Graber
4fef635268
github: Cleanup OSS-fuzz
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-12-18 23:58:58 -05:00
Stéphane Graber
664344d9da
github: Rework test workflow
Introduce a main "tests" workflow which runs the LXC testsuite on both
x86_64 and aarch64, on a variety of compilers and OS as well as handling
the santizer runs.

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-12-18 23:58:58 -05:00
Stéphane Graber
6dd4c9baed
github: Introduce shared testsuite logic
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-12-18 22:23:14 -05:00
Stéphane Graber
5b752b5250
github: Introduce shared build logic
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-12-18 22:23:13 -05:00
Stéphane Graber
e47b9ee65f
github: Update coverity workflow
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-12-18 22:23:12 -05:00
Stéphane Graber
8276169537
Merge pull request #4491 from gjaekel/patch-2
fix return code of recursive all of cgroup_tree_prune
2024-12-17 10:42:48 -05:00
Christian Brauner
f3821144c1
Merge pull request #4503 from stgraber/main
init.lxc: Tweak signal handling
2024-12-16 23:36:15 +01:00
Stéphane Graber
4527cec26b
lxc.init: Allow SIGHUP from outside the container
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-12-16 17:06:12 -05:00
Stéphane Graber
d25e7f3069
lxc.init: Ignore user signals coming from inside the contianer
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-12-16 14:25:14 -05:00
Stéphane Graber
c41c5ebfa8
lxc.init: Switch to sigaction
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-12-16 14:24:14 -05:00
Stéphane Graber
680f4dda2a
Merge pull request #4497 from ElJeffe/enter_net_before_user_ns
network config of unprivileged containers is not shown
2024-12-13 03:11:43 -05:00
Jef Steelant
87dcdecf52 lxccontainer: fix enter_net_ns helper to work when netns is inherited
If a network namespace is shared by setting lxc.namespace.share.net and
the container is unprivileged, then the network namespace should be
entered before entering the user namespace. However, if an unprivileged
user started a container, then the network namespace should be entered
after entering the user namespace. To solve this, we try to enter the
network namespace before entering the user namespace. If it did not
succeed, it will be tried again inside the uder namespace.

Signed-off-by: Jef Steelant <jef.steelant_ext@softathome.com>
2024-12-12 21:01:06 +01:00
Stéphane Graber
62f9e7eda4
Merge pull request #4495 from stgraber/main
lxc-net: Replace random IPv6 subnet
2024-11-29 01:03:56 -05:00
Stéphane Graber
31012d49a5
lxc-net: Replace random IPv6 subnet
This is meant to be a completely random ULA subnet.

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2024-11-28 23:06:14 -05:00
Stéphane Graber
de296ea48b
Merge pull request #4493 from tttuuu888/work-issue-4492
meson: fix minor typo
2024-10-24 21:13:47 -04:00
Seungki Kim
d03cb0aca3
meson: fix minor typo
Fixes: https://github.com/lxc/lxc/issues/4492
Signed-off-by: Seungki Kim <tttuuu888@gmail.com>
2024-10-25 07:13:12 +09:00
Guido Jäkel
f7c7585377
fix return code of recursive all of cgroup_tree_prune
Signed-off-by: Guido Jäkel <g.jaekel@dnb.de>
2024-10-23 14:07:53 +02:00
Stéphane Graber
1be6ab047e
Merge pull request #4488 from sgalgano/fix-4476
Avoid null pointer dereference when using shared rootfs
2024-10-14 20:09:59 -04:00
Steven Galgano
d5c2d1efff Avoid null pointer dereference when using shared rootfs.
rootfs->storage not set by lxc_storage_prepare when using a shared
rootfs.

Fixes: https://github.com/lxc/lxc/issues/4476
Signed-off-by: Steven Galgano <sgalgano@adjacentlink.com>
2024-10-14 15:30:57 -04:00
Stéphane Graber
0fdc055e74
Merge pull request #4487 from hallyn/kurt-cb/lxc
create_run_template: don't use txtuid and txtguid out of scope
2024-10-13 18:54:43 -04:00
Serge Hallyn
d50ee6f7c4 create_run_template: don't use txtuid and txtguid out of scope
It's ok that we don't free the malloc()d space since we're
immediately exec()ing.

Originally-by: Kurt Godwin <kgodwin@itron.com>
Reported-by: Kurt Godwin <kgodwin@itron.com>
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2024-10-13 10:11:12 -05:00
Serge Hallyn
5714ae4b19
Merge pull request #4482 from hallyn/2024-09-16/static
meson.build: add -ffat-lto-objects
2024-10-09 15:35:52 -05:00
Serge Hallyn
bf33e9bc54
Merge pull request #4483 from ariel-miculas/support_puzzlefs
Add suppport for PuzzleFS images in the oci template
2024-10-05 19:12:27 -05:00
Ariel Miculas-Trif
3764c19967 Add suppport for PuzzleFS images in the oci template
PuzzleFS images (media type 'application/vnd.puzzlefs.image.rootfs.v1')
can be mounted in a similar way to squashfs images, we just have to
detect the type and reuse the existing code for providing a mount
helper. PuzzleFS is a next-generation container filesystem [1] with
several benefits, such as  reduced duplication, reproducible image
builds, direct mounting support and memory safety guarantees.

Since PuzzleFS currently doesn't provide an image config, also add
support for empty image configs, they are supported by the OCI spec [2].

The MOUNT_HELPER is now passed a `--persist <upperdir>` flag, so it
knows that it needs to create an overlay. This is needed because LXC
expects a writable rootfs and both atomfs and puzzlefs are read-only
filesystems.

Example:
```
$ sudo env PATH=$PATH build/src/lxc/tools/lxc-create --name mycontainer -t \
oci -- --url oci:/$HOME/.local/share/puzzlefs/pfs_ubuntu:eg --no-cache

$ sudo build/src/lxc/tools/lxc-start --name mycontainer --foreground /bin/bash
```

--no-cache is needed for puzzlefs until [3] is solved

[1] https://github.com/project-machine/puzzlefs
[2] https://github.com/opencontainers/image-spec/blob/main/manifest.md#image-manifest
[3] https://github.com/project-machine/puzzlefs/issues/131

Signed-off-by: Ariel Miculas-Trif <amiculas@cisco.com>
2024-10-04 21:51:03 +03:00
Serge Hallyn
a8ca9f5f31 meson.build: drop suggest-attribute=noreturn build option
The suggest-attribute=noreturn option marks functions which will
never return, to give the compiler some hints.  It catches all of
our src/lxc/tools/*.c *_main functions as follows:

error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn]

But if we mark those __noreturn, then  the compiler complains that:

../src/lxc/tools/lxc_attach.c:320:53: warning: ‘main’ specifies less restrictive attribute than its target ‘lxc_attach_main’: ‘noreturn’ [-Wmissi
ng-attributes]
  320 | int __attribute__((weak, alias("lxc_attach_main"))) main(int argc, char *argv[]);

This recommendation is really not very important, so let's not ask
the build to warn about it.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2024-10-03 13:41:39 -05:00
Serge Hallyn
36497cc90f meson.build: add -ffat-lto-objects
Otherwise, if we generate a static library, lintian warns that
it has no code sections.  See

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=977596

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2024-09-16 07:47:34 -05:00