]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
2 months agolxc/conf: support flag kind of mount options in lxc.mount.entry options 4547/head
Alexander Mikhalitsyn [Mon, 5 May 2025 16:03:10 +0000 (18:03 +0200)] 
lxc/conf: support flag kind of mount options in lxc.mount.entry options

Currently, if user wants to use a flag-like mount option in lxc.mount.entry,
for example "userxattr" with overlayfs then it will be silently ignored.

Let's fix that by making parse_vfs_attr() to process all mount options.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 months agolxc/conf: support nosymfollow mount flag
Alexander Mikhalitsyn [Mon, 5 May 2025 16:01:38 +0000 (18:01 +0200)] 
lxc/conf: support nosymfollow mount flag

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 months agoMerge pull request #4550 from stgraber/main
Serge Hallyn [Sat, 10 May 2025 02:27:51 +0000 (21:27 -0500)] 
Merge pull request #4550 from stgraber/main

conf: Add support for "move" mount flag

2 months agoconf: Add support for "move" mount flag 4550/head
Stéphane Graber [Sat, 10 May 2025 01:18:42 +0000 (21:18 -0400)] 
conf: Add support for "move" mount flag

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2 months agoMerge pull request #4549 from mihalicyn/lxc-ci-enable-more-tests
Stéphane Graber [Fri, 9 May 2025 17:11:53 +0000 (13:11 -0400)] 
Merge pull request #4549 from mihalicyn/lxc-ci-enable-more-tests

re-enable some tests

2 months agosrc/tests/lxc-test-unpriv: prevent fail on cleanup path 4549/head
Alexander Mikhalitsyn [Fri, 9 May 2025 12:32:55 +0000 (14:32 +0200)] 
src/tests/lxc-test-unpriv: prevent fail on cleanup path

/run/user/$(id -u $TUSER) is a mountpoint for tmpfs, rm -rf
may fail with EBUSY errno. We should mask it and prevent test from marked
as failed because of this.

Also add set -x to make debugging easier in case of failures.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 months agosrc/tests/lxc-test-apparmor-mount: prevent fail on cleanup path
Alexander Mikhalitsyn [Fri, 9 May 2025 12:30:39 +0000 (14:30 +0200)] 
src/tests/lxc-test-apparmor-mount: prevent fail on cleanup path

/run/user/$(id -u $TUSER) is a mountpoint for tmpfs, rm -rf
may fail with EBUSY errno. We should mask it and prevent test from marked
as failed because of this.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 months agosrc/tests/lxc-test-apparmor-generated: enable test
Alexander Mikhalitsyn [Fri, 9 May 2025 12:29:07 +0000 (14:29 +0200)] 
src/tests/lxc-test-apparmor-generated: enable test

Remove "exit 0" at the beginning of a test to make it actually run.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 months agoMerge pull request #4548 from simondeziel/ubuntu-14.04
Stéphane Graber [Thu, 8 May 2025 21:07:47 +0000 (17:07 -0400)] 
Merge pull request #4548 from simondeziel/ubuntu-14.04

meson.build: remove quirk for Ubuntu 14.04 libcap-dev

2 months agomeson.build: remove quirk for Ubuntu 14.04 libcap-dev 4548/head
Simon Deziel [Thu, 8 May 2025 19:07:30 +0000 (15:07 -0400)] 
meson.build: remove quirk for Ubuntu 14.04 libcap-dev

After some research, it seems that Ubuntu 14.10's libcap-dev package corrected
the mistake and shiped the `.pc` file.

Both Ubuntu releases are very old now so remove the workaround.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
3 months agoMerge pull request #4539 from ianmerin/main
Serge Hallyn [Sat, 3 May 2025 03:36:01 +0000 (22:36 -0500)] 
Merge pull request #4539 from ianmerin/main

delay assumption of apparmor labels

3 months agoapparmor test: add an overlay container start 4539/head
Serge Hallyn [Fri, 18 Apr 2025 03:51:45 +0000 (03:51 +0000)] 
apparmor test: add an overlay container start

make sure that when we start an overlay container, the
init pid is aa-confined.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 months agore-add onexec for apparmor, move label assumption until after container has been...
Ian Merin [Tue, 8 Apr 2025 16:27:26 +0000 (12:27 -0400)] 
re-add onexec for apparmor, move label assumption until after container has been setup for attach

Signed-off-by: Ian Merin <Ian.Merin@ncipher.com>
3 months agoMerge pull request #4544 from RomanGenexis/4198-fix-container-ttys-env
Serge Hallyn [Fri, 25 Apr 2025 20:39:17 +0000 (15:39 -0500)] 
Merge pull request #4544 from RomanGenexis/4198-fix-container-ttys-env

lxc/conf,start: fix setting container_ttys environment variable

3 months agolxc/conf,start: fix setting container_ttys environment variable 4544/head
Roman Azarenko [Tue, 22 Apr 2025 07:16:13 +0000 (09:16 +0200)] 
lxc/conf,start: fix setting container_ttys environment variable

Commit eae44ce19931 ("conf: fix append_ttyname()") changed the format
of `conf->ttys.tty_names`, where the `container_ttys=` prefix was
removed.

This seems to have been taken into account in `lxc_create_ttys()` in
`src/lxc/conf.c`, however that's not enough. `do_start()` in
`src/lxc/start.c` clears the environment, and then does `putenv(...)`
directly on the value of `tty_names`. As it no longer has the
`container_ttys=` prefix, this call doesn't have the intended effect.

This behaviour is also confirmed via `ltrace` when doing `lxc-start`:

[pid 53587] liblxc.so.1->setenv("container_ttys", "pts/1 pts/2 pts/3 pts/4", 1) = 0
[pid 53587] liblxc.so.1->clearenv(0, 1, 0, 0)                                   = 0
[pid 53587] liblxc.so.1->putenv("container=lxc")                                = 0
[pid 53587] liblxc.so.1->putenv("pts/1 pts/2 pts/3 pts/4")                      = 0

Given that `do_start()` clears the environment anyway, there is no
reason for another `setenv()` call in `lxc_create_ttys()`, and a fix
is required for `putenv()` in `do_start()`.

Change the `putenv()` call to `setenv()` in `do_start()` to account
for the change of format in `conf->ttys.tty_names`. Remove extraneous
`setenv()` from `lxc_create_ttys()`.

Fixes #4198

Fixes: eae44ce19931 ("conf: fix append_ttyname()")
Signed-off-by: Roman Azarenko <roman.azarenko+gh@genexis.eu>
3 months agoMerge pull request #4543 from hallyn/2025-04-11/typo
Stéphane Graber [Sat, 12 Apr 2025 04:21:37 +0000 (00:21 -0400)] 
Merge pull request #4543 from hallyn/2025-04-11/typo

selinux: fix typo (AppArmor)

3 months agoselinux: fix typo (AppArmor) 4543/head
Serge Hallyn [Sat, 12 Apr 2025 04:13:08 +0000 (23:13 -0500)] 
selinux: fix typo (AppArmor)

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 months agoMerge pull request #4540 from simondeziel/meson-bools
Stéphane Graber [Tue, 8 Apr 2025 20:16:44 +0000 (16:16 -0400)] 
Merge pull request #4540 from simondeziel/meson-bools

meson_options.txt: don't use str when defining bool default values

3 months agomeson_options.txt: remove space before `:` for consistency 4540/head
Simon Deziel [Tue, 8 Apr 2025 19:11:44 +0000 (15:11 -0400)] 
meson_options.txt: remove space before `:` for consistency

Essentially doing: `s/ : /: /g`

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
3 months agomeson_options.txt: don't use str when defining bool default values
Simon Deziel [Tue, 8 Apr 2025 19:10:33 +0000 (15:10 -0400)] 
meson_options.txt: don't use str when defining bool default values

Avoids this deprecation notice from `meson` 1.3.2:

```
:: NOTICE: Future-deprecated features used:
::  * 1.1.0: {'"boolean option" keyword argument "value" of type str'}
```

Other options already use this syntax so backward compat should remain unchanged.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
3 months agoMerge pull request #4537 from stgraber/main
Christian Brauner [Tue, 8 Apr 2025 18:44:05 +0000 (20:44 +0200)] 
Merge pull request #4537 from stgraber/main

Remove bionic/android support

3 months agobionic: Remove custom getline, openpty and prlimit 4537/head
Stéphane Graber [Tue, 8 Apr 2025 14:49:13 +0000 (10:49 -0400)] 
bionic: Remove custom getline, openpty and prlimit

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
3 months agobionic: Remove bionic detection and support
Stéphane Graber [Tue, 8 Apr 2025 14:36:14 +0000 (10:36 -0400)] 
bionic: Remove bionic detection and support

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
3 months agoREADME: Remove mention of old LXC version
Stéphane Graber [Tue, 8 Apr 2025 14:46:35 +0000 (10:46 -0400)] 
README: Remove mention of old LXC version

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
3 months agoMerge pull request #4536 from stgraber/main
Christian Brauner [Sat, 5 Apr 2025 12:12:52 +0000 (14:12 +0200)] 
Merge pull request #4536 from stgraber/main

start: Re-introduce first SET_DUMPABLE call

3 months agostart: Re-introduce first SET_DUMPABLE call 4536/head
Stéphane Graber [Sat, 5 Apr 2025 05:11:18 +0000 (01:11 -0400)] 
start: Re-introduce first SET_DUMPABLE call

Without it, we're running into issues with complex hooks like nvidia.

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
4 months agoMerge pull request #4535 from mihalicyn/core_sched_fail_fix
Stéphane Graber [Thu, 3 Apr 2025 13:07:05 +0000 (09:07 -0400)] 
Merge pull request #4535 from mihalicyn/core_sched_fail_fix

lxc/start: do prctl(PR_SET_DUMPABLE) after last uid/gid switch

4 months agolxc/start: do prctl(PR_SET_DUMPABLE) after last uid/gid switch 4535/head
Alexander Mikhalitsyn [Thu, 3 Apr 2025 11:26:42 +0000 (13:26 +0200)] 
lxc/start: do prctl(PR_SET_DUMPABLE) after last uid/gid switch

We need to do prctl(PR_SET_DUMPABLE) later, after last lxc_switch_uid_gid()
call. Because otherwise, our earlier call won't be effective as commit_creds()
in the kernel [1] will set_dumpable(task->mm, suid_dumpable) if UID/GID or capabilities
were affected by lxc_switch_uid_gid() call.

This only affects LXC API ->start(struct lxc_container *c, int useinit, char *const argv[])
call when useinit == 1 because in this case we don't perform additinal exec() and
task's dumpable bit remains set to 2 (default value taken from /proc/sys/fs/suid_dumpable).

If useinit == 0, then we do exec() (see start_ops->start callback) and then dumblable
flag will be reset in begin_new_exec() to SUID_DUMP_USER=1 [2]. Then everything will be fine.

Reproducer (problem with lxc-attach).

1. Create unprivileged container

$ ./normalbuild/src/lxc/tools/lxc-create -n testcaps -t download

with busybox template and config:

lxc.idmap = u 0 100000 65536
lxc.idmap = g 0 100000 65536
lxc.init.uid = 1234
lxc.init.gid = 4321
lxc.init.cwd = /
lxc.sched.core = 1

2. Run a container with useinit = 1

$ ./lxcbuild/src/lxc/tools/lxc-execute -n testcaps -l TRACE -o /home/ubuntu/debug.log -- /bin/sleep 100

1. Try to attach

$ strace -f -e prctl ./normalbuild/src/lxc/tools/lxc-attach -n testcaps

prctl(PR_CAPBSET_READ, CAP_MAC_OVERRIDE) = 1
prctl(PR_CAPBSET_READ, 0x30 /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, CAP_CHECKPOINT_RESTORE) = 1
prctl(PR_CAPBSET_READ, 0x2c /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x2a /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x29 /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_SCHED_CORE, PR_SCHED_CORE_GET, 4124, 0 /* PIDTYPE_PID */, [0xd00f7fff]) = 0
strace: Process 4165 attached
strace: Process 4166 attached
[pid  4166] +++ exited with 0 +++
[pid  4164] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=4166, si_uid=100000, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 4167 attached
[pid  4167] prctl(PR_SCHED_CORE, PR_SCHED_CORE_SHARE_FROM, 1, 0 /* PIDTYPE_PID */, NULL) = -1 EPERM (Operation not permitted)           <<<<< OOPS
[pid  4165] +++ exited with 0 +++
[pid  4164] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=4165, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
lxc-attach: testcaps: ../src/lxc/attach.c: do_attach: 1160 Operation not permitted - Failed to join core scheduling domain of 4124
lxc-attach: testcaps: ../src/lxc/attach.c: do_attach: 1382 Failed to attach to container

prctl(PR_SCHED_CORE, PR_SCHED_CORE_SHARE_FROM...) fails with EPERM, because:
- container's init task->mm: (get_dumpable(mm) != SUID_DUMP_USER)
AND
- mm->user_ns == init_user_ns (as there was no exec() and mm_struct->user_ns was set in the initial
user namespace when we run lxc-execute)
( for more details see [3] )

[1] https://github.com/torvalds/linux/blob/acc4d5ff0b61eb1715c498b6536c38c1feb7f3c1/kernel/cred.c#L412
[2] https://github.com/torvalds/linux/blob/a2cc6ff5ec8f91bc463fd3b0c26b61166a07eb11/fs/exec.c#L1331
[3] https://github.com/torvalds/linux/blob/acc4d5ff0b61eb1715c498b6536c38c1feb7f3c1/kernel/ptrace.c#L344

Reported-by: Stéphane Graber <stgraber@stgraber.org>
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
4 months agoMerge pull request #4533 from mihalicyn/bunch_of_fixes_apr2025
Stéphane Graber [Wed, 2 Apr 2025 13:32:38 +0000 (09:32 -0400)] 
Merge pull request #4533 from mihalicyn/bunch_of_fixes_apr2025

A bunch of small fixes

4 months agolxc/caps: fix open /proc/sys/kernel/cap_last_cap 4533/head
Alexander Mikhalitsyn [Wed, 2 Apr 2025 09:01:15 +0000 (11:01 +0200)] 
lxc/caps: fix open /proc/sys/kernel/cap_last_cap

Since 7418b27f1 ("tree-wide: use __u32 for capabilities") open
/proc/sys/kernel/cap_last_cap never worked, it was failing with
EXDEV and we were using a fallback codepath to get a last cap.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
4 months agolxc/conf: handle rootfs open_at error in lxc_mount_rootfs
Alexander Mikhalitsyn [Wed, 2 Apr 2025 08:52:16 +0000 (10:52 +0200)] 
lxc/conf: handle rootfs open_at error in lxc_mount_rootfs

If LXC build is misconfigured, for instance, --prefix=/
and /lib is a symlink to /usr/lib then open_at always fails
to open rootfs. Let's add error print to make it easier to
figure out this.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
4 months agotools/lxc_attach: fix ENFORCE_MEMFD_REXEC checks
Alexander Mikhalitsyn [Wed, 2 Apr 2025 08:45:11 +0000 (10:45 +0200)] 
tools/lxc_attach: fix ENFORCE_MEMFD_REXEC checks

We unconditionally define ENFORCE_MEMFD_REXEC in meson.build
to a corresponding boolean value, so we need to use #if
instead of #ifdef in the code.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
4 months agoMerge pull request #4532 from stgraber/main
Stéphane Graber [Tue, 1 Apr 2025 13:57:53 +0000 (09:57 -0400)] 
Merge pull request #4532 from stgraber/main

github: Add packaging workflow

4 months agogithub: Add packaging workflow 4532/head
Stéphane Graber [Tue, 1 Apr 2025 05:08:29 +0000 (01:08 -0400)] 
github: Add packaging workflow

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
4 months agoMerge pull request #4530 from stgraber/main
Serge Hallyn [Sun, 16 Mar 2025 14:18:15 +0000 (09:18 -0500)] 
Merge pull request #4530 from stgraber/main

Switch to new MAC address prefix

4 months agoglobal: Switch to new MAC prefix 4530/head
Stéphane Graber [Sun, 16 Mar 2025 06:23:00 +0000 (02:23 -0400)] 
global: Switch to new MAC prefix

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
4 months agoglobal: Switch MAC generation to Zabbly prefix
Stéphane Graber [Sun, 16 Mar 2025 06:20:02 +0000 (02:20 -0400)] 
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>
5 months agoMerge pull request #4527 from Managor/config
Stéphane Graber [Mon, 3 Mar 2025 03:10:54 +0000 (22:10 -0500)] 
Merge pull request #4527 from Managor/config

sysconfig/lxc: remove false comment

5 months agosysconfig/lxc: remove false comment 4527/head
Managor [Sat, 1 Mar 2025 18:33:43 +0000 (20:33 +0200)] 
sysconfig/lxc: remove false comment

Signed-off-by: Managor <42655600+Managor@users.noreply.github.com>
5 months agoMerge pull request #4521 from mathiasaerts/feature/option-disable-ipv6
Stéphane Graber [Thu, 20 Feb 2025 22:13:31 +0000 (17:13 -0500)] 
Merge pull request #4521 from mathiasaerts/feature/option-disable-ipv6

Added LXC_IPV6_ENABLE option for lxc-net to enable or disable IPv6

5 months agoAdded LXC_IPV6_ENABLE option for lxc-net to enable or disable IPv6 4521/head
Mathias Aerts [Thu, 20 Feb 2025 21:50:04 +0000 (22:50 +0100)] 
Added LXC_IPV6_ENABLE option for lxc-net to enable or disable IPv6

Signed-off-by: Mathias Aerts <mathias.aerts@delta.blue>
5 months agoMerge pull request #4524 from stgraber/main
Stéphane Graber [Thu, 20 Feb 2025 16:52:22 +0000 (11:52 -0500)] 
Merge pull request #4524 from stgraber/main

github: Switch to native arm64 runners

5 months agoMerge pull request #4523 from irnes/fix/bcast
Stéphane Graber [Thu, 20 Feb 2025 16:32:48 +0000 (11:32 -0500)] 
Merge pull request #4523 from irnes/fix/bcast

config-bcast: fix incorrect broadcast address calculation

5 months agogithub: Switch to native arm64 runners 4524/head
Stéphane Graber [Thu, 20 Feb 2025 16:27:49 +0000 (11:27 -0500)] 
github: Switch to native arm64 runners

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
5 months agoconfig-bcast: fix incorrect broadcast address calculation 4523/head
Irnes Mujkanovic [Thu, 20 Feb 2025 14:27:52 +0000 (15:27 +0100)] 
config-bcast: fix incorrect broadcast address calculation

Signed-off-by: Irnes Mujkanovic <irnes.mujkanovic@gmail.com>
6 months agoMerge pull request #4517 from mihalicyn/lxc_attach_regression_fix
Stéphane Graber [Fri, 24 Jan 2025 14:02:45 +0000 (09:02 -0500)] 
Merge pull request #4517 from mihalicyn/lxc_attach_regression_fix

lxc/attach: Revert "- LXC attach should exit on SIGCHLD"

6 months agolxc/attach: Revert "- LXC attach should exit on SIGCHLD" 4517/head
Alexander Mikhalitsyn [Fri, 24 Jan 2025 13:07:36 +0000 (14:07 +0100)] 
lxc/attach: Revert "- LXC attach should exit on SIGCHLD"

This reverts commit f02158439677d0c1d4b2ed2ed1ba9bc43923a05d.

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>
6 months agoMerge pull request #4512 from sdanailo-42/chore/add-useful-logging
Stéphane Graber [Thu, 9 Jan 2025 23:24:26 +0000 (18:24 -0500)] 
Merge pull request #4512 from sdanailo-42/chore/add-useful-logging

conf: useful logging for capabilities

6 months agoMerge pull request #4511 from sdanailo-42/fix/dbus-hard-coded-address
Stéphane Graber [Thu, 9 Jan 2025 23:05:20 +0000 (18:05 -0500)] 
Merge pull request #4511 from sdanailo-42/fix/dbus-hard-coded-address

dbus: replace hardcoded dbus address with environment variable

6 months agoconf: warn when capabilities are disabled or libcap is not found 4512/head
Sotir Danailov [Wed, 8 Jan 2025 23:07:17 +0000 (00:07 +0100)] 
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>
6 months agodbus: replace hardcoded dbus address with environment variable 4511/head
Sotir Danailov [Wed, 8 Jan 2025 22:51:15 +0000 (23:51 +0100)] 
dbus: replace hardcoded dbus address with environment variable

Signed-off-by: Sotir Danailov <sndanailov@gmail.com>
6 months agoconf: log name of invalid capability in error
Sotir Danailov [Wed, 8 Jan 2025 23:05:26 +0000 (00:05 +0100)] 
conf: log name of invalid capability in error

Signed-off-by: Sotir Danailov <sndanailov@gmail.com>
7 months agoMerge pull request #4510 from asainkujovic/undefisnotzero
Stéphane Graber [Fri, 3 Jan 2025 15:42:19 +0000 (10:42 -0500)] 
Merge pull request #4510 from asainkujovic/undefisnotzero

confile-vlanid: undefined is not a zero value

7 months agoconfile-vlanid: undefined is not a zero value 4510/head
Asain Kujovic [Thu, 2 Jan 2025 21:43:33 +0000 (22:43 +0100)] 
confile-vlanid: undefined is not a zero value

Signed-off-by: Asain Kujovic <asainnp@gmail.com>
7 months agoMerge pull request #4509 from asainkujovic/lxc-attach-exit
Serge Hallyn [Thu, 2 Jan 2025 20:21:52 +0000 (14:21 -0600)] 
Merge pull request #4509 from asainkujovic/lxc-attach-exit

- LXC attach should exit on SIGCHLD

7 months ago- LXC attach should exit on SIGCHLD 4509/head
Asain Kujovic [Tue, 24 Dec 2024 01:13:36 +0000 (02:13 +0100)] 
- LXC attach should exit on SIGCHLD

Signed-off-by: Asain Kujovic <asainnp@gmail.com>
7 months agoMerge pull request #4506 from stgraber/main
Christian Brauner [Thu, 19 Dec 2024 06:59:57 +0000 (07:59 +0100)] 
Merge pull request #4506 from stgraber/main

Github Actions improvements

7 months agogithub: Improve progress reporting 4506/head
Stéphane Graber [Thu, 19 Dec 2024 03:49:35 +0000 (22:49 -0500)] 
github: Improve progress reporting

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
7 months agogithub: Cleanup OSS-fuzz
Stéphane Graber [Thu, 19 Dec 2024 03:18:26 +0000 (22:18 -0500)] 
github: Cleanup OSS-fuzz

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
7 months agogithub: Rework test workflow
Stéphane Graber [Thu, 19 Dec 2024 03:13:05 +0000 (22:13 -0500)] 
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>
7 months agogithub: Introduce shared testsuite logic
Stéphane Graber [Thu, 19 Dec 2024 03:12:38 +0000 (22:12 -0500)] 
github: Introduce shared testsuite logic

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
7 months agogithub: Introduce shared build logic
Stéphane Graber [Thu, 19 Dec 2024 03:12:22 +0000 (22:12 -0500)] 
github: Introduce shared build logic

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
7 months agogithub: Update coverity workflow
Stéphane Graber [Wed, 18 Dec 2024 20:05:57 +0000 (15:05 -0500)] 
github: Update coverity workflow

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
7 months agoMerge pull request #4491 from gjaekel/patch-2
Stéphane Graber [Tue, 17 Dec 2024 15:42:48 +0000 (10:42 -0500)] 
Merge pull request #4491 from gjaekel/patch-2

fix return code of recursive all of cgroup_tree_prune

7 months agoMerge pull request #4503 from stgraber/main
Christian Brauner [Mon, 16 Dec 2024 22:36:15 +0000 (23:36 +0100)] 
Merge pull request #4503 from stgraber/main

init.lxc: Tweak signal handling

7 months agolxc.init: Allow SIGHUP from outside the container 4503/head
Stéphane Graber [Mon, 16 Dec 2024 19:25:24 +0000 (14:25 -0500)] 
lxc.init: Allow SIGHUP from outside the container

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
7 months agolxc.init: Ignore user signals coming from inside the contianer
Stéphane Graber [Mon, 16 Dec 2024 19:25:14 +0000 (14:25 -0500)] 
lxc.init: Ignore user signals coming from inside the contianer

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
7 months agolxc.init: Switch to sigaction
Stéphane Graber [Mon, 16 Dec 2024 19:24:14 +0000 (14:24 -0500)] 
lxc.init: Switch to sigaction

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
7 months agoMerge pull request #4497 from ElJeffe/enter_net_before_user_ns
Stéphane Graber [Fri, 13 Dec 2024 08:11:43 +0000 (03:11 -0500)] 
Merge pull request #4497 from ElJeffe/enter_net_before_user_ns

network config of unprivileged containers is not shown

7 months agolxccontainer: fix enter_net_ns helper to work when netns is inherited 4497/head
Jef Steelant [Fri, 6 Dec 2024 10:20:20 +0000 (11:20 +0100)] 
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>
8 months agoMerge pull request #4495 from stgraber/main
Stéphane Graber [Fri, 29 Nov 2024 06:03:56 +0000 (01:03 -0500)] 
Merge pull request #4495 from stgraber/main

lxc-net: Replace random IPv6 subnet

8 months agolxc-net: Replace random IPv6 subnet 4495/head
Stéphane Graber [Fri, 29 Nov 2024 04:06:09 +0000 (23:06 -0500)] 
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>
9 months agoMerge pull request #4493 from tttuuu888/work-issue-4492
Stéphane Graber [Fri, 25 Oct 2024 01:13:47 +0000 (21:13 -0400)] 
Merge pull request #4493 from tttuuu888/work-issue-4492

meson: fix minor typo

9 months agomeson: fix minor typo 4493/head
Seungki Kim [Thu, 24 Oct 2024 16:33:40 +0000 (01:33 +0900)] 
meson: fix minor typo

Fixes: https://github.com/lxc/lxc/issues/4492
Signed-off-by: Seungki Kim <tttuuu888@gmail.com>
9 months agofix return code of recursive all of cgroup_tree_prune 4491/head
Guido Jäkel [Wed, 23 Oct 2024 12:07:53 +0000 (14:07 +0200)] 
fix return code of recursive all of cgroup_tree_prune

Signed-off-by: Guido Jäkel <g.jaekel@dnb.de>
9 months agoMerge pull request #4488 from sgalgano/fix-4476
Stéphane Graber [Tue, 15 Oct 2024 00:09:59 +0000 (20:09 -0400)] 
Merge pull request #4488 from sgalgano/fix-4476

Avoid null pointer dereference when using shared rootfs

9 months agoAvoid null pointer dereference when using shared rootfs. 4488/head
Steven Galgano [Mon, 14 Oct 2024 19:16:36 +0000 (15:16 -0400)] 
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>
9 months agoMerge pull request #4487 from hallyn/kurt-cb/lxc
Stéphane Graber [Sun, 13 Oct 2024 22:54:43 +0000 (18:54 -0400)] 
Merge pull request #4487 from hallyn/kurt-cb/lxc

create_run_template: don't use txtuid and txtguid out of scope

9 months agocreate_run_template: don't use txtuid and txtguid out of scope 4487/head
Serge Hallyn [Thu, 10 Oct 2024 04:18:42 +0000 (23:18 -0500)] 
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>
9 months agoMerge pull request #4482 from hallyn/2024-09-16/static
Serge Hallyn [Wed, 9 Oct 2024 20:35:52 +0000 (15:35 -0500)] 
Merge pull request #4482 from hallyn/2024-09-16/static

meson.build: add -ffat-lto-objects

9 months agoMerge pull request #4483 from ariel-miculas/support_puzzlefs
Serge Hallyn [Sun, 6 Oct 2024 00:12:27 +0000 (19:12 -0500)] 
Merge pull request #4483 from ariel-miculas/support_puzzlefs

Add suppport for PuzzleFS images in the oci template

9 months agoAdd suppport for PuzzleFS images in the oci template 4483/head
Ariel Miculas-Trif [Wed, 18 Sep 2024 10:07:46 +0000 (13:07 +0300)] 
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>
10 months agomeson.build: drop suggest-attribute=noreturn build option 4482/head
Serge Hallyn [Thu, 3 Oct 2024 18:41:39 +0000 (13:41 -0500)] 
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>
10 months agomeson.build: add -ffat-lto-objects
Serge Hallyn [Mon, 16 Sep 2024 12:47:34 +0000 (07:47 -0500)] 
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>
10 months agoMerge pull request #4481 from yuncang123/main
Stéphane Graber [Mon, 16 Sep 2024 11:42:33 +0000 (07:42 -0400)] 
Merge pull request #4481 from yuncang123/main

fix possible clang compile error on AARCH

10 months agofix possible clang compile error in AARCH 4481/head
yuncang123 [Sat, 14 Sep 2024 18:03:01 +0000 (02:03 +0800)] 
fix possible clang compile error in AARCH

Signed-off-by: yuncang123 <135211779+yuncang123@users.noreply.github.com>
11 months agoMerge pull request #4475 from stgraber/main
Christian Brauner [Sun, 25 Aug 2024 19:21:38 +0000 (21:21 +0200)] 
Merge pull request #4475 from stgraber/main

README: Update security contact

11 months agoREADME: Update security contact 4475/head
Stéphane Graber [Sun, 25 Aug 2024 17:17:59 +0000 (13:17 -0400)] 
README: Update security contact

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
11 months agoMerge pull request #4472 from stgraber/main
Christian Brauner [Thu, 8 Aug 2024 06:21:26 +0000 (08:21 +0200)] 
Merge pull request #4472 from stgraber/main

doc: Fix definitions of get_config_path and set_config_path

11 months agodoc: Fix definitions of get_config_path and set_config_path 4472/head
Stéphane Graber [Wed, 7 Aug 2024 18:10:59 +0000 (14:10 -0400)] 
doc: Fix definitions of get_config_path and set_config_path

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
12 months agoMerge pull request #4462 from Jip-Hop/list-exit-code
Serge Hallyn [Tue, 16 Jul 2024 19:31:04 +0000 (14:31 -0500)] 
Merge pull request #4462 from Jip-Hop/list-exit-code

Exit 0 when there's no error

12 months agoExit 0 when there's no error 4462/head
Jip-Hop [Tue, 9 Jul 2024 10:33:36 +0000 (12:33 +0200)] 
Exit 0 when there's no error

Signed-off-by: Jip de Beer <2871973+Jip-Hop@users.noreply.github.com>
12 months agoMerge pull request #4463 from stgraber/main
Stéphane Graber [Tue, 16 Jul 2024 18:33:39 +0000 (20:33 +0200)] 
Merge pull request #4463 from stgraber/main

Reduce logging for newuidmap/newgidmap

12 months agoidmap: Lower logging level of newXidmap tools to INFO 4463/head
Stéphane Graber [Tue, 16 Jul 2024 14:08:31 +0000 (10:08 -0400)] 
idmap: Lower logging level of newXidmap tools to INFO

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
12 months agoRemove unused function
Stéphane Graber [Wed, 5 Jun 2024 22:40:15 +0000 (18:40 -0400)] 
Remove unused function

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
13 months agoMerge pull request #4459 from mihalicyn/lxc_nixos_build_fix2
Stéphane Graber [Wed, 26 Jun 2024 18:58:02 +0000 (20:58 +0200)] 
Merge pull request #4459 from mihalicyn/lxc_nixos_build_fix2

meson: fix build with -Dtools-multicall=true on NixOS

13 months agomeson: fix build with -Dtools-multicall=true on NixOS 4459/head
Alexander Mikhalitsyn [Wed, 26 Jun 2024 18:42:55 +0000 (20:42 +0200)] 
meson: fix build with -Dtools-multicall=true on NixOS

See also:
https://github.com/lxc/lxc/pull/4428

Fixes: #4427
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
13 months agoMerge pull request #4453 from mihalicyn/update_githubci_ubuntu24
Stéphane Graber [Wed, 26 Jun 2024 18:35:38 +0000 (20:35 +0200)] 
Merge pull request #4453 from mihalicyn/update_githubci_ubuntu24

Update GitHub Actions to use Ubuntu 24.04

13 months agogithub: exclude clang & ubuntu-24.04 combination 4453/head
Alexander Mikhalitsyn [Wed, 26 Jun 2024 17:47:31 +0000 (19:47 +0200)] 
github: exclude clang & ubuntu-24.04 combination

Temporary workaround for:
https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-18/+bug/2064187

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
13 months agolxc/storage/zfs: ignore false-positive use-after-free warning
Alexander Mikhalitsyn [Wed, 26 Jun 2024 17:28:03 +0000 (19:28 +0200)] 
lxc/storage/zfs: ignore false-positive use-after-free warning

free(dataset) is perfecly valid after failed realloc(dataset, len) call.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>