]> git.ipfire.org Git - thirdparty/lxc.git/log
thirdparty/lxc.git
18 months agoFix error message. 4382/head
Peter Michaux [Sat, 6 Jan 2024 18:08:06 +0000 (10:08 -0800)] 
Fix error message.

Signed-off-by: Peter Michaux <petermichaux@gmail.com>
18 months agoAdd verbose output in download template.
Peter Michaux [Sat, 6 Jan 2024 17:51:13 +0000 (09:51 -0800)] 
Add verbose output in download template.

Signed-off-by: Peter Michaux <petermichaux@gmail.com>
18 months agoMerge pull request #4381 from petermichaux/patch-1
Stéphane Graber [Sat, 6 Jan 2024 15:12:24 +0000 (16:12 +0100)] 
Merge pull request #4381 from petermichaux/patch-1

Align columns in lxc-download.in template

18 months agoAlign columns in lxc-download.in template 4381/head
Peter Michaux [Sat, 6 Jan 2024 06:10:34 +0000 (22:10 -0800)] 
Align columns in lxc-download.in template

Signed-off-by: Peter Michaux <petermichaux@gmail.com>
19 months agoMerge pull request #4375 from lxc/dependabot/github_actions/actions/upload-artifact-4
Stéphane Graber [Mon, 18 Dec 2023 13:56:58 +0000 (08:56 -0500)] 
Merge pull request #4375 from lxc/dependabot/github_actions/actions/upload-artifact-4

build(deps): bump actions/upload-artifact from 3 to 4

19 months agobuild(deps): bump actions/upload-artifact from 3 to 4 4375/head
dependabot[bot] [Mon, 18 Dec 2023 13:13:10 +0000 (13:13 +0000)] 
build(deps): bump actions/upload-artifact from 3 to 4

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
19 months agoMerge pull request #3236 from xinhua9569/master
Stéphane Graber [Wed, 13 Dec 2023 18:18:29 +0000 (13:18 -0500)] 
Merge pull request #3236 from xinhua9569/master

config: try to create workdir if not exist

19 months agoconfig: try to create workdir if not exist 3236/head
dongxinhua [Mon, 23 Dec 2019 10:59:29 +0000 (18:59 +0800)] 
config: try to create workdir if not exist

Signed-off-by: dongxinhua <dongxinhua@huawei.com>
19 months agoMerge pull request #4368 from desultory/main
Stéphane Graber [Mon, 11 Dec 2023 22:23:55 +0000 (17:23 -0500)] 
Merge pull request #4368 from desultory/main

Updated lxc-local template

19 months agolxc-local: Add --no-dev option to exclude /dev from the fstree 4368/head
Zen [Thu, 16 Nov 2023 17:49:43 +0000 (11:49 -0600)] 
lxc-local: Add --no-dev option to exclude /dev from the fstree

Signed-off-by: Zen <z@pyl.onl>
19 months agolxc-local: Re-organize code to use more functions
Zen [Thu, 16 Nov 2023 16:35:53 +0000 (10:35 -0600)] 
lxc-local: Re-organize code to use more functions

Signed-off-by: Zen <z@pyl.onl>
19 months agolxc-local: Improve usage info
Zen [Thu, 16 Nov 2023 16:45:02 +0000 (10:45 -0600)] 
lxc-local: Improve usage info

Signed-off-by: Zen <z@pyl.onl>
19 months agolxc-local: Change LXC_CONFIG to LXC_METADATA to match args and be more clear
Zen [Thu, 16 Nov 2023 16:33:54 +0000 (10:33 -0600)] 
lxc-local: Change LXC_CONFIG to LXC_METADATA to match args and be more clear

Signed-off-by: Zen <z@pyl.onl>
19 months agoMerge pull request #3430 from Der-Jan/master-zfs-fix
Stéphane Graber [Mon, 11 Dec 2023 03:37:39 +0000 (22:37 -0500)] 
Merge pull request #3430 from Der-Jan/master-zfs-fix

Read list until process exits

19 months agoMerge pull request #4351 from flisk/fix-untagged-vlans-on-bridges-without-default...
Stéphane Graber [Mon, 11 Dec 2023 02:48:06 +0000 (21:48 -0500)] 
Merge pull request #4351 from flisk/fix-untagged-vlans-on-bridges-without-default-pvids

don't try to delete vlan 0 from veth

19 months agoMerge pull request #4169 from cole-miller/link-local
Stéphane Graber [Mon, 11 Dec 2023 02:46:33 +0000 (21:46 -0500)] 
Merge pull request #4169 from cole-miller/link-local

Disable IPv6 link-local addresses for bridged veth

19 months agoDisable IPv6 link-local addresses for bridged veth 4169/head
Cole Miller [Fri, 15 Jul 2022 17:52:52 +0000 (13:52 -0400)] 
Disable IPv6 link-local addresses for bridged veth

When creating a bridged veth tunnel, disable assignment of IPv6
link-local addresses on the host's end by writing 1 to
/proc/sys/net/ipv6/conf/NAME/disable_ipv6, if it exists.

Signed-off-by: Cole Miller <m@cole-miller.net>
19 months agodon't try to delete vlan 0 from veth 4351/head
flisk [Thu, 5 Oct 2023 10:28:03 +0000 (12:28 +0200)] 
don't try to delete vlan 0 from veth

vid 0 is a special value that indicates the absence of a default pvid

Signed-off-by: flisk <self@flisk.xyz>
19 months agoMerge pull request #4321 from lkomurcub/libarchive_tar_exclude
Stéphane Graber [Sun, 10 Dec 2023 20:21:52 +0000 (15:21 -0500)] 
Merge pull request #4321 from lkomurcub/libarchive_tar_exclude

Add libarchive tar support for lxc download

20 months agoMerge pull request #4344 from gibmat/fix-ephemeral-copy
Stéphane Graber [Wed, 29 Nov 2023 15:35:13 +0000 (10:35 -0500)] 
Merge pull request #4344 from gibmat/fix-ephemeral-copy

lxc_storage_prepare(): Fix ephemeral copies

20 months agoconf: fix ephemeral copies 4344/head
Christian Brauner [Wed, 29 Nov 2023 14:57:04 +0000 (15:57 +0100)] 
conf: fix ephemeral copies

Don't rely on rootfs->bdev_type because that may be NULL. Use storage->type
instead which can't be NULL.

Co-Developed-by: Mathias Gibbens <gibmat@debian.org>
Signed-off-by: Mathias Gibbens <gibmat@debian.org>
Reported-by: Mathias Gibbens <gibmat@debian.org>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
20 months agoMerge pull request #4370 from simondeziel/no-upstart
Stéphane Graber [Mon, 27 Nov 2023 06:01:02 +0000 (01:01 -0500)] 
Merge pull request #4370 from simondeziel/no-upstart

Remove support for upstart

20 months agoconfig/init: Drop upstart files 4370/head
Simon Deziel [Fri, 24 Nov 2023 19:19:44 +0000 (14:19 -0500)] 
config/init: Drop upstart files

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
20 months agodoc: remove the warning mentionning upstart
Simon Deziel [Fri, 24 Nov 2023 19:21:21 +0000 (14:21 -0500)] 
doc: remove the warning mentionning upstart

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
20 months agohooks/ubuntu-cloud-prep: remove upstart handling
Simon Deziel [Fri, 24 Nov 2023 19:20:43 +0000 (14:20 -0500)] 
hooks/ubuntu-cloud-prep: remove upstart handling

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
20 months agomeson: Remove support for upstart
Simon Deziel [Fri, 24 Nov 2023 19:20:09 +0000 (14:20 -0500)] 
meson: Remove support for upstart

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
21 months agoMerge pull request #4357 from ElJeffe/fix-idmap-clear
Stéphane Graber [Thu, 12 Oct 2023 05:25:13 +0000 (01:25 -0400)] 
Merge pull request #4357 from ElJeffe/fix-idmap-clear

reset root_nsuid_map and root_nsgid_map when idmaps is cleared

21 months agoreset root_nsuid_map and root_nsgid_map when idmaps is cleared 4357/head
Jef Steelant [Wed, 11 Oct 2023 09:56:58 +0000 (09:56 +0000)] 
reset root_nsuid_map and root_nsgid_map when idmaps is cleared

Signed-off-by: Jef Steelant <jef@steelant.be>
21 months agoMerge pull request #4352 from simondeziel/shellcheck-checkconfig
Stéphane Graber [Sat, 7 Oct 2023 08:06:36 +0000 (04:06 -0400)] 
Merge pull request #4352 from simondeziel/shellcheck-checkconfig

Make `lxc-checkconfig` shellcheck clean

21 months agolxc/checkconfig: use multiline `echo` 4352/head
Simon Deziel [Fri, 6 Oct 2023 05:19:33 +0000 (01:19 -0400)] 
lxc/checkconfig: use multiline `echo`

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
21 months agolxc/checkconfig: replace `echo -n` by printf
Simon Deziel [Fri, 6 Oct 2023 05:16:38 +0000 (01:16 -0400)] 
lxc/checkconfig: replace `echo -n` by printf

printf is already used for color output.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
21 months agolxc/checkconfig: minor cosmetic change
Simon Deziel [Fri, 6 Oct 2023 04:57:44 +0000 (00:57 -0400)] 
lxc/checkconfig: minor cosmetic change

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
21 months agolxc/checkconfig: avoid subshell (SC2235)
Simon Deziel [Fri, 6 Oct 2023 04:31:27 +0000 (00:31 -0400)] 
lxc/checkconfig: avoid subshell (SC2235)

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
21 months agolxc/checkconfig: remove superfluous (..) around test command (SC2234)
Simon Deziel [Fri, 6 Oct 2023 04:27:47 +0000 (00:27 -0400)] 
lxc/checkconfig: remove superfluous (..) around test command (SC2234)

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
21 months agolxc/checkconfig: check exit code directly (SC2181)
Simon Deziel [Fri, 6 Oct 2023 04:25:16 +0000 (00:25 -0400)] 
lxc/checkconfig: check exit code directly (SC2181)

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
21 months agolxc/checkconfig: replace `! -z` by `-n` (SC2236)
Simon Deziel [Fri, 6 Oct 2023 04:24:08 +0000 (00:24 -0400)] 
lxc/checkconfig: replace `! -z` by `-n` (SC2236)

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
21 months agolxc/checkconfig: add missing quotes to please shellcheck
Simon Deziel [Fri, 6 Oct 2023 04:22:46 +0000 (00:22 -0400)] 
lxc/checkconfig: add missing quotes to please shellcheck

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
21 months agolxc/checkconfig: remove some unneeded `echo -n`
Simon Deziel [Fri, 6 Oct 2023 04:18:21 +0000 (00:18 -0400)] 
lxc/checkconfig: remove some unneeded `echo -n`

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
21 months agolxc/checkconfig: replace `type` by `command`
Simon Deziel [Fri, 6 Oct 2023 04:03:35 +0000 (00:03 -0400)] 
lxc/checkconfig: replace `type` by `command`

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
21 months agolxc/checkconfig: replace `cat | grep` with `grep`
Simon Deziel [Fri, 6 Oct 2023 05:43:04 +0000 (01:43 -0400)] 
lxc/checkconfig: replace `cat | grep` with `grep`

Also speedup `grep` invokations while at it.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
22 months agoMerge pull request #4349 from mihalicyn/set_timeout_fixup
Stéphane Graber [Tue, 26 Sep 2023 18:33:20 +0000 (14:33 -0400)] 
Merge pull request #4349 from mihalicyn/set_timeout_fixup

lxc/lxccontainer: fix do_lxcapi_set_timeout retval

22 months agolxc/lxccontainer: fix do_lxcapi_set_timeout retval 4349/head
Alexander Mikhalitsyn [Tue, 26 Sep 2023 17:08:45 +0000 (19:08 +0200)] 
lxc/lxccontainer: fix do_lxcapi_set_timeout retval

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
23 months agoMerge pull request #4345 from lxc/dependabot/github_actions/actions/checkout-4
Christian Brauner [Mon, 4 Sep 2023 15:04:34 +0000 (17:04 +0200)] 
Merge pull request #4345 from lxc/dependabot/github_actions/actions/checkout-4

build(deps): bump actions/checkout from 3 to 4

23 months agobuild(deps): bump actions/checkout from 3 to 4 4345/head
dependabot[bot] [Mon, 4 Sep 2023 13:53:54 +0000 (13:53 +0000)] 
build(deps): bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
23 months agoMerge pull request #4343 from stgraber/main
Christian Brauner [Thu, 31 Aug 2023 06:25:23 +0000 (08:25 +0200)] 
Merge pull request #4343 from stgraber/main

lxccontainer.h: Move new fields to the end

23 months agolxccontainer.h: Move new fields to the end 4343/head
Stéphane Graber [Thu, 31 Aug 2023 04:46:14 +0000 (00:46 -0400)] 
lxccontainer.h: Move new fields to the end

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
23 months agoMerge pull request #4341 from stgraber/main
Christian Brauner [Wed, 30 Aug 2023 21:25:40 +0000 (23:25 +0200)] 
Merge pull request #4341 from stgraber/main

Remove references to LXD

23 months agoRemove references to LXD 4341/head
Stéphane Graber [Wed, 30 Aug 2023 21:06:23 +0000 (17:06 -0400)] 
Remove references to LXD

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
23 months agoMerge pull request #4339 from hallyn/2023-08-29/consoleperms
Christian Brauner [Tue, 29 Aug 2023 22:18:57 +0000 (00:18 +0200)] 
Merge pull request #4339 from hallyn/2023-08-29/consoleperms

Update console perms to 0600

23 months agoUpdate console perms to 0600 4339/head
Serge Hallyn [Tue, 29 Aug 2023 21:14:28 +0000 (16:14 -0500)] 
Update console perms to 0600

Closes #4338

We should not give execute permissions to console output.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
23 months agoMerge pull request #4336 from smoser/fix/api-start-split-better
Serge Hallyn [Wed, 23 Aug 2023 15:11:00 +0000 (10:11 -0500)] 
Merge pull request #4336 from smoser/fix/api-start-split-better

Fix start api call to split quoted strings in execute or init command.

23 months agoFix start api call to split quoted strings in execute or init command. 4336/head
Scott Moser [Tue, 22 Aug 2023 18:07:36 +0000 (14:07 -0400)] 
Fix start api call to split quoted strings in execute or init command.

If a user of the container.start api call provided NULL for the argv
argument, then lxc would load either 'lxc.execute.cmd' or
'lxc.init.cmd' configuration items as the command.

Given a config like:

    lxc.execute.cmd = /usr/bin/touch "file one" "file 2"

lxc would just split the string on spaces and end up executing array:

  ['touch', 'file"', 'one"', '"file', '2"']

This differs from the experience with the `lxc-start` command which
would use lxc_string_split_quoted and execute:

  ['touch', 'file one', 'file 2']

Note that as described in lxc_string_split_quoted, commands that include
nested quotes and possibly other characters are still a problem.  In
those cases, the caller of 'start' can provide an argv array.

Signed-off-by: Scott Moser <smoser@brickies.net>
23 months agoMerge pull request #4260 from mihalicyn/lxcapi_set_timeout
Christian Brauner [Tue, 22 Aug 2023 13:22:29 +0000 (15:22 +0200)] 
Merge pull request #4260 from mihalicyn/lxcapi_set_timeout

LXC API extension: set_timeout

23 months agoMerge pull request #4295 from mihalicyn/apparmor_mount_propagation
Stéphane Graber [Thu, 17 Aug 2023 16:31:16 +0000 (12:31 -0400)] 
Merge pull request #4295 from mihalicyn/apparmor_mount_propagation

Apparmor mount propagation

2 years agogithub: Update for main branch
Stéphane Graber [Mon, 24 Jul 2023 15:37:53 +0000 (11:37 -0400)] 
github: Update for main branch

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2 years agoMerge pull request #4327 from hallyn/2023-07-17/ai
Christian Brauner [Mon, 17 Jul 2023 17:04:37 +0000 (19:04 +0200)] 
Merge pull request #4327 from hallyn/2023-07-17/ai

CONTRIBUTING: add a note on AI generated code

2 years agoCONTRIBUTING: add a note on AI generated code 4327/head
Serge Hallyn [Mon, 17 Jul 2023 12:57:17 +0000 (07:57 -0500)] 
CONTRIBUTING: add a note on AI generated code

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
2 years agoMerge pull request #4324 from hallyn/2023-07-06/bequiet
Christian Brauner [Fri, 7 Jul 2023 10:48:59 +0000 (12:48 +0200)] 
Merge pull request #4324 from hallyn/2023-07-06/bequiet

get_hierarchy: dont WARN about no usable controller

2 years agoget_hierarchy: dont WARN about no usable controller 4324/head
Serge Hallyn [Thu, 6 Jul 2023 23:34:59 +0000 (18:34 -0500)] 
get_hierarchy: dont WARN about no usable controller

If I start a container with loglevel WARN, and (on a pretty
stock ubuntu) do lxc-info -n $c, I get

lxc-start media 20230706233337.765 WARN     cgfsng - cgroups/cgfsng.c:get_hierarchy:142 - There is no useable cpuacct controller
lxc-start media 20230706233337.765 WARN     cgfsng - cgroups/cgfsng.c:get_hierarchy:142 - There is no useable blkio controller

I don't think that's worth WARNing about, so change it to
INFO.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
2 years agoAdd libarchive tar support for lxc download 4321/head
Levent Komurcu [Mon, 26 Jun 2023 07:23:30 +0000 (09:23 +0200)] 
Add libarchive tar support for lxc download

This patch fixes unpacking images when the system provided tar is libarchive (bsd-tar). bsd-tar  doesn't support 'exclude' flags (--anchored) like gnu-tar does. Instead each exclude path is prepended with ^ to simulate behavior of --anchored when bsd tar is detected.

Signed-off-by: Levent Komurcu <levent.komurcu@nl.bosch.com>
2 years agogithub: Add DCO/target tests
Stéphane Graber [Thu, 22 Jun 2023 01:45:21 +0000 (21:45 -0400)] 
github: Add DCO/target tests

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #4313 from mosbrew-ag/master
Christian Brauner [Fri, 26 May 2023 06:34:49 +0000 (08:34 +0200)] 
Merge pull request #4313 from mosbrew-ag/master

explicitly convert *mainloop_handler to __u64

2 years agoexplicitly convert *mainloop_handler to __u64 4313/head
Anatolii Gryzlov [Wed, 24 May 2023 23:26:14 +0000 (02:26 +0300)] 
explicitly convert *mainloop_handler to __u64

GCC treats such conversion as warning, while Clang-15 aborts compilation

Signed-off-by: Anatolii Gryzlov <agryzlov.mosbrew@gmail.com>
2 years agoMerge pull request #4310 from magalilemes/parse-config-file
Stéphane Graber [Tue, 16 May 2023 17:37:40 +0000 (13:37 -0400)] 
Merge pull request #4310 from magalilemes/parse-config-file

tests: fix parse_config_file seccomp test

2 years agotests: fix parse_config_file seccomp test 4310/head
Magali Lemes [Mon, 15 May 2023 23:31:37 +0000 (20:31 -0300)] 
tests: fix parse_config_file seccomp test

Link: https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/1980218
Check if seccomp is enabled before throwing error.

Signed-off-by: Magali Lemes <magali.lemes@canonical.com>
2 years agoMerge pull request #4309 from stgraber/master
Christian Brauner [Fri, 5 May 2023 07:33:22 +0000 (09:33 +0200)] 
Merge pull request #4309 from stgraber/master

src/tests: Fix container creation errors

2 years agosrc/tests: Fix container creation errors 4309/head
Stéphane Graber [Thu, 4 May 2023 14:58:40 +0000 (16:58 +0200)] 
src/tests: Fix container creation errors

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2 years agoMerge pull request #4305 from hallyn/2023-04-21/private_symbols
Christian Brauner [Sat, 22 Apr 2023 06:34:03 +0000 (08:34 +0200)] 
Merge pull request #4305 from hallyn/2023-04-21/private_symbols

rename functions which clash with libsystemd's

2 years agorename functions which clash with libsystemd's 4305/head
Serge Hallyn [Sat, 22 Apr 2023 00:10:14 +0000 (19:10 -0500)] 
rename functions which clash with libsystemd's

If statically linking against both liblxc and libsystemd, some
function names conflict:

mkdir_p fd_cloexec path_simplify is_dir is_fs_type

Rename those to lxc_\0, as:

for sym in mkdir_p fd_cloexec path_simplify is_dir is_fs_type; do
git grep "$sym" | awk -F: '{ print $1 }' | sort | uniq | xargs sed -i "s/$sym/lxc_$sym/g"
done

(the above loop wrongly replaces is_dir in meson.build, but
c'est la vie)

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
2 years agocommands: support timeout in LXC_CMD_GET_STATE 4260/head
Alexander Mikhalitsyn [Tue, 17 Jan 2023 17:10:46 +0000 (18:10 +0100)] 
commands: support timeout in LXC_CMD_GET_STATE

Issue #4257

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 years agolxccontainer: extend lxccontainer API with set_timeout
Alexander Mikhalitsyn [Tue, 17 Jan 2023 16:27:40 +0000 (17:27 +0100)] 
lxccontainer: extend lxccontainer API with set_timeout

lxccontainer set_timeout method allows to set LXC client
timeout for waiting monitor response.

Right now, it's implemented using the SO_RCVTIMEO client
socket option. (But it's the implementation detail that
can be changed in the future.)

This commit doesn't change behavior, because it's just
adds a new option and setter, but not changes any existing
LXC commands implementation. It's also extends internal API
function lxc_cmd with lxc_cmd_timeout.

Issue #4257

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 years agoMerge pull request #4304 from mihalicyn/io_uring_stuck_fix
Stéphane Graber [Fri, 21 Apr 2023 18:12:44 +0000 (14:12 -0400)] 
Merge pull request #4304 from mihalicyn/io_uring_stuck_fix

mainloop: fix stuck when io_uring is enabled

2 years agomainloop: io_uring: disable IORING_POLL_ADD_MULTI 4304/head
Alexander Mikhalitsyn [Fri, 21 Apr 2023 17:23:06 +0000 (19:23 +0200)] 
mainloop: io_uring: disable IORING_POLL_ADD_MULTI

Let's disable IORING_POLL_ADD_MULTI to workaround an issue
with false-positive POLLIN events in CQ.

In my local setup I managed to fix an issue without this
by making terminal FDs non-blocking, but during full
testsuite execution in Jenkins it was found that issue
still persists. So, let's add this ugly workaround too.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 years agoterminal: make a terminal FDs non-blocking
Alexander Mikhalitsyn [Fri, 21 Apr 2023 16:38:53 +0000 (18:38 +0200)] 
terminal: make a terminal FDs non-blocking

Let's prevent freezes on read(2) by making a terminal FDs non-blocking.

It was discovered that there is an issue with io_uring mainloop when
multishot poll (IORING_POLL_ADD_MULTI) mode is enabled. Sometimes
false-positive poll events are put into a CQ. It makes further read(2)
stuck forever and blocks all mainloop processing for an infinite time.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 years agofile_utils: add fd_make_nonblocking helper
Alexander Mikhalitsyn [Fri, 21 Apr 2023 16:11:46 +0000 (18:11 +0200)] 
file_utils: add fd_make_nonblocking helper

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 years agofile_utils: rename fd_make_nonblocking to fd_make_blocking
Alexander Mikhalitsyn [Fri, 21 Apr 2023 16:08:27 +0000 (18:08 +0200)] 
file_utils: rename fd_make_nonblocking to fd_make_blocking

Currently, fd_make_nonblocking does exactly the opposite thing,
it clears O_NONBLOCK flag and makes fd blocking.

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 years agoMerge pull request #4300 from solardiz/setproctitle
Christian Brauner [Tue, 11 Apr 2023 15:25:35 +0000 (17:25 +0200)] 
Merge pull request #4300 from solardiz/setproctitle

setproctitle(): Handle potential NULL return from strrchr()

2 years agosetproctitle(): Handle potential NULL return from strrchr() 4300/head
Solar Designer [Tue, 11 Apr 2023 13:29:46 +0000 (15:29 +0200)] 
setproctitle(): Handle potential NULL return from strrchr()

Signed-off-by: Solar Designer <solar@openwall.com>
2 years agoMerge pull request #4299 from tych0/make-setproctitle-safe
Christian Brauner [Tue, 11 Apr 2023 05:47:32 +0000 (07:47 +0200)] 
Merge pull request #4299 from tych0/make-setproctitle-safe

make setproctitle()'s /proc/pid/stat parsing safe

2 years agomake setproctitle()'s /proc/pid/stat parsing safe 4299/head
Tycho Andersen [Mon, 10 Apr 2023 23:12:24 +0000 (17:12 -0600)] 
make setproctitle()'s /proc/pid/stat parsing safe

it turns out that our parsing of /proc/pid/stat was not safe in general
(though probably safe for lxc, since our executable names do not contain
spaces).

Let's fix this by looking backwards through the file for ), and then
continuing on from there.

This was reported to me by Solar Designer, who pointed me to this thread:
https://twitter.com/solardiz/status/1634204168545001473

Indeed, this is a lot of tap dancing to work around the kernel's 16
character executable limit. Perhaps I'll send a kernel patch to raise that
limit next.

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
2 years agolsm: apparmor: allow to change mount propagation 4295/head
Alexander Mikhalitsyn [Fri, 31 Mar 2023 11:25:37 +0000 (13:25 +0200)] 
lsm: apparmor: allow to change mount propagation

Long story behind this. Many years ago, Stéphane Graber
discovered an issue with apparmor mount rules.

Since
https://github.com/lxc/lxc/commit/7f2b13275daf68b173474900b1ce2c04105da33f
commit ("apparmor: Update mount states handling") it was prohibited
to change mount propagation flags, just because adding rules which
allow mount propagation user inside the container gets an ability
to mount everything [1].

Now with modern systemd versions this problem become more critical than
before. For instance, ArchLinux containers fail to start without
nesting apparmor profile enabled (because nesting profile effectively
just allow all mounts). Of course, that's a security issue.

We've also enabled sharing on the container rootfs:
https://github.com/lxc/lxc/pull/4229

Now for many workloads it's needed to change propagation flag to
private (see https://github.com/canonical/craft-parts/pull/400).

Issue:
$ lxc-start -F archlinux-test

systemd 253-1-arch running in system mode (+PAM +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified)
Detected virtualization lxc.
Detected architecture x86-64.

Welcome to Arch Linux!

bpf-lsm: BPF LSM hook not enabled in the kernel, BPF LSM not supported
Failed to remount root directory as MS_SLAVE: Permission denied
(sd-gens) failed with exit status 1.
[!!!!!!] Failed to start up manager.
Exiting PID 1...

Workaround (unsafe):
$ lxc-start -s lxc.apparmor.allow_nesting=1 -s lxc.apparmor.profile=generated -F arch-test

John Johansen (Apparmor maintainer) and LXD team worked on fix [2].
It was merged to stable AppArmor 3.0 and 3.1 branches already.
There is no stable AppArmor version tag for that, but I think it will
be in the AppArmor version 3.0.10.

See also:
[1] https://bugs.launchpad.net/apparmor/+bug/1597017
[2] https://gitlab.com/apparmor/apparmor/-/merge_requests/333

Fixes: #4280
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 years agoMerge pull request #4287 from hallyn/2023-03-10/dbus
Serge Hallyn [Sun, 19 Mar 2023 22:05:06 +0000 (17:05 -0500)] 
Merge pull request #4287 from hallyn/2023-03-10/dbus

switch from libsystemd's dbus to dbus-1

2 years agoconsole-log test: make sure container is stopped before restarting 4287/head
Serge Hallyn [Sun, 19 Mar 2023 20:31:18 +0000 (15:31 -0500)] 
console-log test: make sure container is stopped before restarting

Closes #4237

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2 years agoswitch from libsystemd's dbus to dbus-1
Serge Hallyn [Wed, 8 Mar 2023 05:53:59 +0000 (23:53 -0600)] 
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.

2 years agoMerge pull request #4290 from mihalicyn/sk_cloexec
Stéphane Graber [Fri, 17 Mar 2023 15:20:54 +0000 (11:20 -0400)] 
Merge pull request #4290 from mihalicyn/sk_cloexec

tree-wide: convert fcntl(FD_CLOEXEC) to SOCK_CLOEXEC

2 years agotree-wide: convert fcntl(FD_CLOEXEC) to SOCK_CLOEXEC 4290/head
Alexander Mikhalitsyn [Fri, 17 Mar 2023 12:43:34 +0000 (13:43 +0100)] 
tree-wide: convert fcntl(FD_CLOEXEC) to SOCK_CLOEXEC

- replace accept() + fcntl(FD_CLOEXEC) with accept4(..., SOCK_CLOEXEC)
- remove fcntl(FD_CLOEXEC) in lxc_server_init() as we already set
SOCK_CLOEXEC in lxc_abstract_unix_open().

See also: ad9429e52 ("tree-wide: make socket SOCK_CLOEXEC")
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 years agoMerge pull request #4281 from smoser/feature/oci-squashfs
Serge Hallyn [Mon, 27 Feb 2023 19:57:45 +0000 (13:57 -0600)] 
Merge pull request #4281 from smoser/feature/oci-squashfs

Add support for squashfs images in oci via atomfs

2 years agoAllow fuse mounts in apparmor start-container. 4281/head
Scott Moser [Fri, 24 Feb 2023 21:48:10 +0000 (16:48 -0500)] 
Allow fuse mounts in apparmor start-container.

Unprivledged user should be able to do fuse mounts during start-container.
Specifically this solves the problem for un-priv fuse mounting via
pre-hook.

Signed-off-by: Scott Moser <smoser@brickies.net>
2 years agoAdd support for squashfs images in oci via atomfs
Scott Moser [Tue, 21 Feb 2023 18:31:06 +0000 (13:31 -0500)] 
Add support for squashfs images in oci via atomfs

This adds support to the oci template for squashfs images.
It uses 'atomfs' from [1] to accomplish this.

Squashfs images (media type
application/vnd.stacker.image.layer.squashfs+zstd+verity) have several
benefits compared to tar+gz:

 * immediately mountable
 * read-only filesystem
 * verity data present in oci manifest.

I presented this at Fosdem 2023 at [2].

The 'atomfs' program can be replaced by passing '--mount-helper'
argument to the oci template.

    mount-helper mount oci:<oci_dir>:<oci_name> <mountpoint>
    mount-helper umount <mountpoint>

[1] https://github.com/project-machine/atomfs
[2] https://fosdem.org/2023/schedule/event/container_secure_storage/

Signed-off-by: Scott Moser <smoser@brickies.net>
2 years agoMerge pull request #4284 from Blub/2023-02-27/empty-apparmor-files
Christian Brauner [Mon, 27 Feb 2023 12:23:13 +0000 (13:23 +0100)] 
Merge pull request #4284 from Blub/2023-02-27/empty-apparmor-files

apparmor: don't try to mmap empty files

2 years agoapparmor: don't try to mmap empty files 4284/head
Wolfgang Bumiller [Mon, 27 Feb 2023 10:02:43 +0000 (11:02 +0100)] 
apparmor: don't try to mmap empty files

In case empty profile files linger somehow (eg. powerloss or
oom killer etc. between creating and writing the file) we
tried to use mmap() with a length of 0 which is invalid.
Let's treat this as if it did not exist.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoMerge pull request #4279 from mihalicyn/setproctitle_fix_fmt_spec
Stéphane Graber [Thu, 16 Feb 2023 16:15:00 +0000 (11:15 -0500)] 
Merge pull request #4279 from mihalicyn/setproctitle_fix_fmt_spec

initutils: use PRIu64 for uint64_t in setproctitle

2 years agoinitutils: use PRIu64 for uint64_t in setproctitle 4279/head
Alexander Mikhalitsyn [Thu, 16 Feb 2023 12:29:56 +0000 (13:29 +0100)] 
initutils: use PRIu64 for uint64_t in setproctitle

Kernel UAPI provides as with the following declaration:
/*
 * This structure provides new memory descriptor
 * map which mostly modifies /proc/pid/stat[m]
 * output for a task. This mostly done in a
 * sake of checkpoint/restore functionality.
 */
struct prctl_mm_map {
__u64 start_code; /* code section bounds */
__u64 end_code;
__u64 start_data; /* data section bounds */
__u64 end_data;
__u64 start_brk; /* heap for brk() syscall */
__u64 brk;
__u64 start_stack; /* stack starts at */
__u64 arg_start; /* command line arguments bounds */
__u64 arg_end;
__u64 env_start; /* environment variables bounds */
__u64 env_end;
__u64 *auxv; /* auxiliary vector */
__u32 auxv_size; /* vector size */
__u32 exe_fd; /* /proc/$pid/exe link file */
};

Let's use appropriate types/format specifiers everywhere.

Issue #4268

Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
2 years agoMerge pull request #4277 from n0p90/fix-nft-ip6-nat
Stéphane Graber [Mon, 13 Feb 2023 21:36:09 +0000 (16:36 -0500)] 
Merge pull request #4277 from n0p90/fix-nft-ip6-nat

lxc-net.in: fix nftables syntax for IPv6 NAT

2 years agolxc-net.in: fix nftables syntax for IPv6 NAT 4277/head
Quentin Lyons [Sun, 12 Feb 2023 02:03:42 +0000 (02:03 +0000)] 
lxc-net.in: fix nftables syntax for IPv6 NAT

The nftables masquarade rule for IPv6 was using the IPv4 syntax. This
resulted in the following error when starting the lxc-net.service with
LXC_IPV6_NAT="true" and nftables:

    Feb 11 18:54:54 pc lxc-net[4936]: Error: conflicting protocols specified: ip6 vs. ip
    Feb 11 18:54:54 pc lxc-net[4936]:                              ^^^^^^^^
    Feb 11 18:54:54 pc lxc-net[4917]: Failed to setup lxc-net.
    Feb 11 18:54:54 pc systemd[1]: lxc-net.service: Main process exited, code=exited, status=1/FAILURE
    Feb 11 18:54:54 pc systemd[1]: lxc-net.service: Failed with result 'exit-code'.
    Feb 11 18:54:54 pc systemd[1]: Failed to start LXC network bridge setup.

Signed-off-by: Quentin Lyons <36303164+n0p90@users.noreply.github.com>
2 years agoMerge pull request #4275 from ariel-miculas/fix_strl_rc_checks
Christian Brauner [Tue, 7 Feb 2023 13:16:27 +0000 (14:16 +0100)] 
Merge pull request #4275 from ariel-miculas/fix_strl_rc_checks

Fix strlcat's return value checks

2 years agoFix strlcat's return value checks 4275/head
Ariel Miculas [Tue, 7 Feb 2023 11:10:50 +0000 (13:10 +0200)] 
Fix strlcat's return value checks

Alternatively we could have used safe_strlcat, but it's not used
anywhere and there's also no safe_strlcpy

Signed-off-by: Ariel Miculas <amiculas@cisco.com>
2 years agoMerge pull request #4270 from ariel-miculas/fix_typo
Christian Brauner [Mon, 30 Jan 2023 16:45:12 +0000 (17:45 +0100)] 
Merge pull request #4270 from ariel-miculas/fix_typo

Fix typo: bev_type -> bdev_type

2 years agoFix typo: bev_type -> bdev_type 4270/head
Ariel Miculas [Mon, 30 Jan 2023 16:20:31 +0000 (18:20 +0200)] 
Fix typo: bev_type -> bdev_type

Signed-off-by: Ariel Miculas <amiculas@cisco.com>
2 years agoMerge pull request #4263 from hallyn/2023-01-18/drop-fuzz-test
Christian Brauner [Mon, 23 Jan 2023 22:59:12 +0000 (23:59 +0100)] 
Merge pull request #4263 from hallyn/2023-01-18/drop-fuzz-test

drop broken lxc-test-fuzzers