From: "Bruce Ashfield" <bruce.ashfield@gmail.com>
To: sana kazi <sanakazisk19@gmail.com>
Cc: meta-virtualization@lists.yoctoproject.org
Subject: Re: [meta-virtualization][master-next][PATCH] lxc: Fix -c command for lxc-attach
Date: Thu, 16 Sep 2021 18:20:10 -0400 [thread overview]
Message-ID: <20210916222009.GE25504@gmail.com> (raw)
In-Reply-To: <20210916050653.23238-1-sanakazisk19@gmail.com>
merged.
Bruce
In message: [meta-virtualization][master-next][PATCH] lxc: Fix -c command for lxc-attach
on 16/09/2021 sana kazi wrote:
> Added fix_c_command.patch the -c command seems to be broken because
> the passed context is ignored and always overwritten by the context
> specified in the config file.
>
> Signed-off-by: Sana Kazi <Sana.Kazi@kpit.com>
> Signed-off-by: Sana Kazi <sanakazisk19@gmail.com>
> ---
> .../lxc/files/fix_c_command.patch | 36 +++++++++++++++++++
> recipes-containers/lxc/lxc_git.bb | 1 +
> 2 files changed, 37 insertions(+)
> create mode 100644 recipes-containers/lxc/files/fix_c_command.patch
>
> diff --git a/recipes-containers/lxc/files/fix_c_command.patch b/recipes-containers/lxc/files/fix_c_command.patch
> new file mode 100644
> index 0000000..1ed8daf
> --- /dev/null
> +++ b/recipes-containers/lxc/files/fix_c_command.patch
> @@ -0,0 +1,36 @@
> +From 9becf309a81806ef08acf9ca99ab95c1bcfa1f65 Mon Sep 17 00:00:00 2001
> +From: Maximilian Blenk <Maximilian.Blenk@bmw.de>
> +Date: Mon, 23 Aug 2021 15:39:28 +0200
> +Subject: [PATCH] attach: Fix -c command
> +
> +Currently, the -c command (to set the selinux context) seems to be
> +broken because the passed context is ignored and always overwritten by
> +the context specified in the config file. The intention behind the -c
> +imho was to be able to manually overwrite this behavior. This patch
> +ensures that the selinux context will be set if passed via the command
> +line.
> +
> +Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
> +---
> + src/lxc/tools/lxc_attach.c | 5 ++++-
> + 1 file changed, 4 insertions(+), 1 deletion(-)
> +
> +Upstream-Status: Backport [https://github.com/lxc/lxc/commit/9becf309a81806ef08acf9ca99ab95c1bcfa1f65.patch]
> +Comment: No change in any hunk
> +
> +diff --git a/src/lxc/tools/lxc_attach.c b/src/lxc/tools/lxc_attach.c
> +index 0374d980b4..e6b388b20c 100644
> +--- a/src/lxc/tools/lxc_attach.c
> ++++ b/src/lxc/tools/lxc_attach.c
> +@@ -379,7 +379,10 @@ int main(int argc, char *argv[])
> + attach_options.gid = my_args.gid;
> +
> + // selinux_context will be NULL if not set
> +- attach_options.lsm_label = selinux_context;
> ++ if (selinux_context) {
> ++ attach_options.attach_flags |= LXC_ATTACH_LSM_LABEL;
> ++ attach_options.lsm_label = selinux_context;
> ++ }
> +
> + if (command.program) {
> + ret = c->attach_run_wait(c, &attach_options, command.program,
> diff --git a/recipes-containers/lxc/lxc_git.bb b/recipes-containers/lxc/lxc_git.bb
> index 3215928..f5b5128 100644
> --- a/recipes-containers/lxc/lxc_git.bb
> +++ b/recipes-containers/lxc/lxc_git.bb
> @@ -50,6 +50,7 @@ SRC_URI = "git://github.com/lxc/lxc.git;branch=stable-4.0 \
> file://dnsmasq.conf \
> file://lxc-net \
> file://enable_seccomp_profile_when_compiled_libseccomp.patch \
> + file://fix_c_command.patch \
> "
>
> SRCREV = "cec7cb14b2a4367d4cb21a90e1b90d0f98a9d874"
> --
> 2.17.1
>
>
>
>
prev parent reply other threads:[~2021-09-16 22:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-16 5:06 [meta-virtualization][master-next][PATCH] lxc: Fix -c command for lxc-attach sana kazi
2021-09-16 22:20 ` Bruce Ashfield [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210916222009.GE25504@gmail.com \
--to=bruce.ashfield@gmail.com \
--cc=meta-virtualization@lists.yoctoproject.org \
--cc=sanakazisk19@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.