From: Peter Maydell <peter.maydell@linaro.org>
To: Stefan Berger <stefanb@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, marcandre.lureau@gmail.com,
clg@redhat.com, lena.voytek@canonical.com,
Stefan Berger <stefanb@linux.ibm.com>
Subject: Re: [PATCH] tests: Adjust path for swtpm state to use path under /var/tmp/
Date: Thu, 7 Nov 2024 11:09:07 +0000 [thread overview]
Message-ID: <CAFEAcA8P-a5XyACAovFLwCSPT-s0CX74aMKoPtHku0G89cYgkA@mail.gmail.com> (raw)
In-Reply-To: <20241106180751.6859-1-stefanb@linux.vnet.ibm.com>
On Wed, 6 Nov 2024 at 18:08, Stefan Berger <stefanb@linux.vnet.ibm.com> wrote:
>
> From: Stefan Berger <stefanb@linux.ibm.com>
>
> To avoid AppArmor-related test failures when functional test are run from
> somewhere under /mnt, adjust the path to swtpm's state to use an AppArmor-
> supported path, such as /var/tmp, which is provided by the python function
> tempfile.TemporaryDirectory().
>
> An update to swtpm's AppArmor profile is also being done to support /var/tmp.
>
> Link: https://lore.kernel.org/qemu-devel/CAFEAcA8A=kWLtTZ+nua-MpzqkaEjW5srOYZruZnE2tB6vmoMig@mail.gmail.com/
> Link: https://github.com/stefanberger/swtpm/pull/944
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Thanks for writing this patch. I can confirm that the test now
runs OK on my Ubuntu setup, so
Tested-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> tests/functional/test_arm_aspeed.py | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_arm_aspeed.py
> index 9761fc06a4..a574b1e521 100644
> --- a/tests/functional/test_arm_aspeed.py
> +++ b/tests/functional/test_arm_aspeed.py
> @@ -227,11 +227,11 @@ def test_arm_ast2600_evb_buildroot_tpm(self):
>
> image_path = self.ASSET_BR2_202302_AST2600_TPM_FLASH.fetch()
>
> - socket_dir = tempfile.TemporaryDirectory(prefix="qemu_")
> - socket = os.path.join(socket_dir.name, 'swtpm-socket')
I think it would be helpful to add a brief comment here:
# We must put the TPM state dir in /tmp/, not the build dir,
# because some distros use AppArmor to lock down swtpm and
# restrict the set of locations it can write to.
just as a guard against somebody in future coming along and
trying to clean up/rationalize where tests are creating their
temporary files.
> + tpmstate_dir = tempfile.TemporaryDirectory(prefix="qemu_")
> + socket = os.path.join(tpmstate_dir.name, 'swtpm-socket')
>
> subprocess.run(['swtpm', 'socket', '-d', '--tpm2',
> - '--tpmstate', f'dir={self.vm.temp_dir}',
> + '--tpmstate', f'dir={tpmstate_dir.name}',
> '--ctrl', f'type=unixio,path={socket}'])
>
> self.vm.add_args('-chardev', f'socket,id=chrtpm,path={socket}')
> --
> 2.34.1
thanks
-- PMM
next prev parent reply other threads:[~2024-11-07 11:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 18:07 [PATCH] tests: Adjust path for swtpm state to use path under /var/tmp/ Stefan Berger
2024-11-07 7:15 ` Cédric Le Goater
2024-11-07 11:09 ` Peter Maydell [this message]
2024-11-07 11:58 ` Stefan Berger
2024-11-07 14:44 ` Peter Maydell
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=CAFEAcA8P-a5XyACAovFLwCSPT-s0CX74aMKoPtHku0G89cYgkA@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=clg@redhat.com \
--cc=lena.voytek@canonical.com \
--cc=marcandre.lureau@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.ibm.com \
--cc=stefanb@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).