diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 4978c8f54d..fcc620b007 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -86,7 +86,7 @@ jobs: mv ../lxc_* out/ - name: Upload resulting build - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 continue-on-error: true with: name: ${{ matrix.os }} diff --git a/.github/workflows/fuzzing.yml b/.github/workflows/fuzzing.yml index efd074feb9..a747524ac0 100644 --- a/.github/workflows/fuzzing.yml +++ b/.github/workflows/fuzzing.yml @@ -37,7 +37,7 @@ jobs: sanitizer: ${{ matrix.sanitizer }} - name: Upload Crash - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 if: failure() && steps.build.outcome == 'success' with: name: ${{ matrix.sanitizer }}-artifacts diff --git a/doc/ja/lxc-create.sgml.in b/doc/ja/lxc-create.sgml.in index 5e086202e6..738177be7e 100644 --- a/doc/ja/lxc-create.sgml.in +++ b/doc/ja/lxc-create.sgml.in @@ -185,10 +185,12 @@ You can specify the following options : --rbdname RBDNAME will create a blockdevice named RBDNAME rather than the default, which is the container name. --rbdpool POOL will create the blockdevice in the pool named POOL, rather than the default, which is 'lxc'. + \-\-rbduser RBDUSER will specify the ceph user RBDUSER creating the blockdevice, rather than the default, which is 'admin'. --> backingstore が 'rbd' の場合、ceph.conf に有効な設定がされており、ceph.client.admin.keyring が定義されている必要があります。 --rbdname RBDNAME を指定すると、RBDNAME という名前のブロックデバイスを作成します。このオプションを指定しない場合のデフォルトのブロックデバイス名はコンテナ名です。 --rbdpool POOL を指定すると、POOL という名前のプール内にブロックデバイスを作成します。このオプションを指定しない場合のデフォルトのプール名は 'lxc' です。 + --rbduser RBDUSER を指定すると、RBDUSER という ceph ユーザを指定してブロックデバイスを作成します。このオプションを指定しない場合のデフォルトのユーザ名は 'admin' です。 非特権コンテナ + + + 非特権 LXC コンテナは、ユーザ名前空間内で root のホストレベルの特権がない状態で実行されます。コンテナの UID 0 は、root ではないホストの ID にマッピングされ、コンテナのアクセス可能なデバイスとファイルシステムが厳密に制限されます。非特権コンテナ内で rootfs をマウントするためには、マッピングされたホストのユーザが、rootfs ディレクトリ自身を含む、rootfs までのパス上にあるすべてのディレクトリに対して実行権限を持っている必要があります。さらに、rootfs 以下のすべてのファイルとディレクトリは、正しいユーザ ID とグループ ID が所有している必要があります。正しいユーザ ID とグループ ID とは、lxc.idmap でコンテナの root(UID 0)にマッピングされているホストの ID です。 + + + <!-- Creating / Destroying containers -->コンテナの作成と削除 diff --git a/meson.build b/meson.build index 83818993cd..63a36d1ed9 100644 --- a/meson.build +++ b/meson.build @@ -576,10 +576,12 @@ foreach ident: [ ['personality', '''#include '''], ['pidfd_open', '''#include #include + #include #include #include '''], ['pidfd_send_signal', '''#include #include + #include #include #include '''], ['pivot_root', '''#include @@ -809,7 +811,7 @@ found_headers = [] missing_headers = [] foreach tuple: [ ['sys/resource.h'], - ['sys/memfd.h'], + ['linux/memfd.h'], ['sys/personality.h'], ['sys/pidfd.h'], ['sys/signalfd.h'], diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index ef92b943da..d192445c0e 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -1521,6 +1521,9 @@ static int unpriv_systemd_create_scope(struct cgroup_ops *ops, struct lxc_conf * __attribute__((__cleanup__(_dbus_connection_free))) DBusConnection *connection = NULL; unsigned int len; + if (!file_exists("/run/systemd/system")) + return log_info(SYSTEMD_SCOPE_UNSUPP, "Not a systemd system or systemd not running"); + if (geteuid() == 0) return log_info(SYSTEMD_SCOPE_UNSUPP, "Running privileged, not using a systemd unit"); diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 1e41d642a1..cab8e893bd 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -600,13 +600,13 @@ int run_script_argv(const char *name, unsigned int hook_version, if (hook_version == 0) { size += strlen(hookname); - size++; + size += 3; size += strlen(name); - size++; + size += 3; size += strlen(section); - size++; + size += 3; if (size > INT_MAX) return -EFBIG; @@ -617,7 +617,7 @@ int run_script_argv(const char *name, unsigned int hook_version, return -ENOMEM; if (hook_version == 0) - buf_pos = strnprintf(buffer, size, "exec %s %s %s %s", script, name, section, hookname); + buf_pos = strnprintf(buffer, size, "exec %s '%s' '%s' '%s'", script, name, section, hookname); else buf_pos = strnprintf(buffer, size, "exec %s", script); if (buf_pos < 0) @@ -706,13 +706,13 @@ int run_script(const char *name, const char *section, const char *script, ...) size += strlen(script); size += strlen(name); size += strlen(section); - size += 4; + size += 8; if (size > INT_MAX) return -1; buffer = must_realloc(NULL, size); - ret = strnprintf(buffer, size, "exec %s %s %s", script, name, section); + ret = strnprintf(buffer, size, "exec %s '%s' '%s'", script, name, section); if (ret < 0) return -1; diff --git a/src/tests/mount_injection.c b/src/tests/mount_injection.c index e9db05d521..551095c573 100644 --- a/src/tests/mount_injection.c +++ b/src/tests/mount_injection.c @@ -409,20 +409,24 @@ static void lxc_teardown_shmount(char *shmount_path) int main(int argc, char *argv[]) { + int ret = EXIT_SUCCESS; + if (!lxc_setup_shmount("/tmp/mount_injection_test")) exit(EXIT_FAILURE); if (do_priv_container_test()) { fprintf(stderr, "Privileged mount injection test failed\n"); - exit(EXIT_FAILURE); + ret = EXIT_FAILURE; + goto out; } if (do_unpriv_container_test()) { fprintf(stderr, "Unprivileged mount injection test failed\n"); - exit(EXIT_FAILURE); + ret = EXIT_FAILURE; + goto out; } +out: lxc_teardown_shmount("/tmp/mount_injection_test"); - - exit(EXIT_SUCCESS); + exit(ret); }