]>
git.ipfire.org Git - thirdparty/lxc.git/log
Alexander Mikhalitsyn [Tue, 29 Jul 2025 10:41:11 +0000 (12:41 +0200)]
lxc/conf: do not leak opts.data memory in __lxc_idmapped_mounts_child()
Fixes: Coverity 1641425
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Alexander Mikhalitsyn [Tue, 29 Jul 2025 10:39:34 +0000 (12:39 +0200)]
lxc/network: null-terminate ifname string in lxc_network_recv_name_and_ifindex_from_child()
Fixes: Coverity 1486538
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Alexander Mikhalitsyn [Tue, 29 Jul 2025 09:58:53 +0000 (11:58 +0200)]
tests/lxc-test-snapdeps: try to load overlay kernel module
We don't want test to be skipped just because overlay module
isn't loaded yet.
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Alexander Mikhalitsyn [Tue, 29 Jul 2025 09:32:13 +0000 (11:32 +0200)]
tests/lxc-test-rootfs: add idmapped rootfs testcase
I've discovered that we have no test coverage for rootfs
"lxc.rootfs.options = idmap=container" at all.
Let's add this basic test at least.
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Stéphane Graber [Mon, 28 Jul 2025 18:01:53 +0000 (14:01 -0400)]
Merge pull request #4566 from mihalicyn/enter_net_ns_errors_fix
lxc/lxccontainer: stop printing misleading errors in enter_net_ns()
Alexander Mikhalitsyn [Mon, 28 Jul 2025 17:00:29 +0000 (19:00 +0200)]
lxc/lxccontainer: stop printing misleading errors in enter_net_ns()
In enter_net_ns() we try to enter network namespace at first, before
entering a user namespace to support inherited netns case properly.
It is expected to get EPERM for unprivileged container with non-shared
network namespace at first try. Let's take this into account
and stop misleading users with these error messages.
Link: https://discuss.linuxcontainers.org/t/lxc-ls-fancy-command-shows-operation-not-permitted/24080
Fixes: 3011e79f92ef ("lxccontainer: fix enter_net_ns helper to work when netns is inherited")
Fixes: #4560
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Stéphane Graber [Mon, 28 Jul 2025 15:03:32 +0000 (11:03 -0400)]
Merge pull request #4564 from Container-On-Android/fix/meson.build
meson.build: fix checks for fsconfig and calls
DreamConnected [Fri, 25 Jul 2025 16:05:43 +0000 (00:05 +0800)]
meson.build: use has_header_symbol() instead of get_define() to improve compatibility
Signed-off-by: DreamConnected <1487442471@qq.com>
Li Lu [Thu, 24 Jul 2025 02:06:41 +0000 (10:06 +0800)]
meson.build: fix checks for fsconfig and calls
move Headers checks up to Calls. keep fsconfig checks on openSUSE #4176
Signed-off-by: Li Lu <1487442471@qq.com>
Stéphane Graber [Mon, 2 Jun 2025 15:22:02 +0000 (11:22 -0400)]
Merge pull request #4557 from RomanGenexis/meson-specfile-distrosysconfdir
meson.build: set `LXC_DISTRO_SYSCONF` when `-Dspecfile=true`
Roman Azarenko [Sat, 31 May 2025 12:55:01 +0000 (14:55 +0200)]
meson.build: set `LXC_DISTRO_SYSCONF` when `-Dspecfile=true`
Before the change, the `setup` meson step would fail when disabling the
`install-init-files` option:
$ meson setup -Dinstall-init-files=false build
<snip>
meson.build:936:44: ERROR: Entry LXC_DISTRO_SYSCONF not in configuration data.
This is because setting the `LXC_DISTRO_SYSCONF` option is conditional
and requires `install-init-files` to be enabled.
Meanwhile the `specfile` option (default enabled) also requires the
variable above, resulting in a failure when it is unset.
Amend the conditional to also set `LXC_DISTRO_SYSCONF` when `specfile`
option is `true`.
Fixes: 872db5424363 ("build: add more options for customizing install")
Signed-off-by: Roman Azarenko <roman.azarenko+gh@genexis.eu>
Stéphane Graber [Thu, 22 May 2025 01:44:54 +0000 (21:44 -0400)]
Merge pull request #4555 from gibmat/add-loong64-personality
Add loong64 to list of recognized architectures
Mathias Gibbens [Wed, 21 May 2025 23:29:30 +0000 (23:29 +0000)]
Add loong64 to list of recognized architectures
Debian refers to the loong architecture as "loong64".
Signed-off-by: Mathias Gibbens <gibmat@debian.org>
Stéphane Graber [Tue, 13 May 2025 17:39:58 +0000 (13:39 -0400)]
Merge pull request #4554 from mihalicyn/no-new-privs-regression-fix
Revert (delay assumption of apparmor labels) to fix a regression
Alexander Mikhalitsyn [Tue, 13 May 2025 12:59:35 +0000 (14:59 +0200)]
Revert "re-add onexec for apparmor, move label assumption until after container has been setup for attach"
This reverts commit
50dee37cfe3201ed51f477356f81941c960a5511 .
Fixes: #4553
Bisected-by: Simon Deziel <simon.deziel@canonical.com>
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Stéphane Graber [Tue, 13 May 2025 03:19:16 +0000 (23:19 -0400)]
Merge pull request #4552 from mihalicyn/fix_fuzzing_stuff
src/tests/oss-fuzz: pin meson to 1.7.2 to workaround build failures
Alexander Mikhalitsyn [Mon, 12 May 2025 10:05:59 +0000 (12:05 +0200)]
src/tests/oss-fuzz: pin meson to 1.7.2 to workaround build failures
See also
https://github.com/google/oss-fuzz/pull/13286/commits/
093b2480ce44c38c2418c20df2212f56b9e7fbd2
Thanks to Evgeny Vereshchagin
Fixes: #4551
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Stéphane Graber [Sat, 10 May 2025 16:42:28 +0000 (12:42 -0400)]
Merge pull request #4547 from mihalicyn/mnt_opts_parsing_impr
Mount options (lxc.mount.entry) handling improvements
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>
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>
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
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>
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
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>
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>
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>
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
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>
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
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>
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>
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
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>
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)
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>
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
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>
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>
Christian Brauner [Tue, 8 Apr 2025 18:44:05 +0000 (20:44 +0200)]
Merge pull request #4537 from stgraber/main
Remove bionic/android support
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>
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>
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>
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
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>
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
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>
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
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>
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>
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>
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
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>
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
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>
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>
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
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>
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
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>
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
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
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>
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>
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"
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>
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
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
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>
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>
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>
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
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>
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
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>
Christian Brauner [Thu, 19 Dec 2024 06:59:57 +0000 (07:59 +0100)]
Merge pull request #4506 from stgraber/main
Github Actions improvements
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>
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>
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>
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>
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>
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>
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
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
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>
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>
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>
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
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>
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
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>
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
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>
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>
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
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>
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
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>
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
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
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>