From: Eduardo Otubo <otubo@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, berrange@redhat.com
Subject: Re: [Qemu-devel] [PATCH] seccomp: check TSYNC host capability
Date: Mon, 10 Sep 2018 10:36:33 +0200 [thread overview]
Message-ID: <20180910083633.GD5786@vader> (raw)
In-Reply-To: <20180830143348.10595-1-marcandre.lureau@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1918 bytes --]
On 30/08/2018 - 16:33:48, Marc-André Lureau wrote:
> Remove -sandbox option if the host is not capable of TSYNC, since the
> sandbox will fail at setup time otherwise. This will help libvirt, for
> ex, to figure out if -sandbox will work.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> qemu-seccomp.c | 19 ++++++++++++++++++-
> vl.c | 4 ++--
> 2 files changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/qemu-seccomp.c b/qemu-seccomp.c
> index 4729eb107f..1baa5c69ed 100644
> --- a/qemu-seccomp.c
> +++ b/qemu-seccomp.c
> @@ -282,7 +282,24 @@ static QemuOptsList qemu_sandbox_opts = {
>
> static void seccomp_register(void)
> {
> - qemu_add_opts(&qemu_sandbox_opts);
> + bool add = false;
> +
> + /* FIXME: use seccomp_api_get() >= 2 check when released */
> +
> +#if defined(SECCOMP_FILTER_FLAG_TSYNC)
> + int check;
> +
> + /* check host TSYNC capability, it returns errno == ENOSYS if unavailable */
> + check = qemu_seccomp(SECCOMP_SET_MODE_FILTER,
> + SECCOMP_FILTER_FLAG_TSYNC, NULL);
> + if (check < 0 && errno == EFAULT) {
> + add = true;
> + }
> +#endif
> +
> + if (add) {
> + qemu_add_opts(&qemu_sandbox_opts);
> + }
> }
> opts_init(seccomp_register);
> #endif
> diff --git a/vl.c b/vl.c
> index 408bff9c1e..70c2449b86 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4007,8 +4007,8 @@ int main(int argc, char **argv, char **envp)
> }
>
> #ifdef CONFIG_SECCOMP
> - if (qemu_opts_foreach(qemu_find_opts("sandbox"),
> - parse_sandbox, NULL, NULL)) {
> + olist = qemu_find_opts_err("sandbox", NULL);
> + if (olist && qemu_opts_foreach(olist, parse_sandbox, NULL, NULL)) {
> exit(1);
> }
> #endif
> --
> 2.19.0.rc0.48.gb9dfa238d5
>
Acked-by: Eduardo Otubo <otubo@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
next prev parent reply other threads:[~2018-09-10 8:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-30 14:33 [Qemu-devel] [PATCH] seccomp: check TSYNC host capability Marc-André Lureau
2018-09-10 8:36 ` Eduardo Otubo [this message]
2018-12-13 3:24 ` David Gibson
2019-04-29 13:21 ` Thomas Huth
2019-04-29 13:21 ` Thomas Huth
2019-04-29 13:49 ` Marc-André Lureau
2019-04-29 13:49 ` Marc-André Lureau
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=20180910083633.GD5786@vader \
--to=otubo@redhat.com \
--cc=berrange@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).