From: Laurent Vivier <lvivier@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: QEMU <qemu-devel@nongnu.org>, Eduardo Otubo <otubo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
Date: Mon, 29 Apr 2019 21:13:09 +0200 [thread overview]
Message-ID: <b34321fc-2c10-d930-c735-5490e704a101@redhat.com> (raw)
In-Reply-To: <CAJ+F1C+aXyC8UAaCKU7sD9LTZPDEaYhSufp9auxipxavDj3F+A@mail.gmail.com>
On 29/04/2019 16:46, Marc-André Lureau wrote:
> Hi
>
> On Mon, Apr 29, 2019 at 4:26 PM Laurent Vivier <lvivier@redhat.com> wrote:
>>
>> On 29/04/2019 15:47, Marc-André Lureau wrote:
>>> $ ./x86_64-softmmu/qemu-system-x86_64 -sandbox off
>>> qemu-system-x86_64: -sandbox off: There is no option group 'sandbox'
>>> Segmentation fault
>>>
>>> Commit 5780760f5e ("seccomp: check TSYNC host capability") wrapped one
>>> use of the sandbox option group to produce a sensible error, it didn't
>>> do the same for another call to qemu_opts_parse_noisily():
>>>
>>> (gdb) bt
>>> at util/qemu-option.c:829
>>> #0 0x00000000105b36d8 in opts_parse (list=0x0, params=0x3ffffffffab5 "off", permit_abbrev=true, defaults=false, errp=0x3ffffffff080)
>>> at util/qemu-option.c:829
>>> #1 0x00000000105b3b74 in qemu_opts_parse_noisily (list=<optimized out>, params=<optimized out>, permit_abbrev=<optimized out>) at util/qemu-option.c:890
>>> #2 0x0000000010024964 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:3589
>>>
>>> Fixes: 5780760f5ea6163939a5dabe7427318b4f07d1a2
>>> Cc: david@gibson.dropbear.id.au
>>> Cc: otubo@redhat.com
>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>>> ---
>>> vl.c | 18 ++++++++++--------
>>> 1 file changed, 10 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/vl.c b/vl.c
>>> index 4019a4387d..5fc4994d3c 100644
>>> --- a/vl.c
>>> +++ b/vl.c
>>> @@ -3866,17 +3866,19 @@ int main(int argc, char **argv, char **envp)
>>> qtest_log = optarg;
>>> break;
>>> case QEMU_OPTION_sandbox:
>>> -#ifdef CONFIG_SECCOMP
>>> - opts = qemu_opts_parse_noisily(qemu_find_opts("sandbox"),
>>> - optarg, true);
>>> + olist = qemu_find_opts("sandbox");
>>> + if (!olist) {
>>> +#ifndef CONFIG_SECCOMP
>>
>> Why do you move the #ifdef? We have two separate error cases here.
>> And it seems better no to check for "-sandbox" when seccomp is disabled.
>
> I tried to remove the #ifdef altogether to simplify the code, then
> realized the error message could be useful.
>
> I don't think it's a problem to lookup "-sandbox" when seccomp is disabled.
>
ok, so:
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Vivier <lvivier@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: Eduardo Otubo <otubo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, QEMU <qemu-devel@nongnu.org>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
Date: Mon, 29 Apr 2019 21:13:09 +0200 [thread overview]
Message-ID: <b34321fc-2c10-d930-c735-5490e704a101@redhat.com> (raw)
Message-ID: <20190429191309.hFChDrCzdd5FdYaIzzkwfJNWuIJc0q1p7tESqXuxz5E@z> (raw)
In-Reply-To: <CAJ+F1C+aXyC8UAaCKU7sD9LTZPDEaYhSufp9auxipxavDj3F+A@mail.gmail.com>
On 29/04/2019 16:46, Marc-André Lureau wrote:
> Hi
>
> On Mon, Apr 29, 2019 at 4:26 PM Laurent Vivier <lvivier@redhat.com> wrote:
>>
>> On 29/04/2019 15:47, Marc-André Lureau wrote:
>>> $ ./x86_64-softmmu/qemu-system-x86_64 -sandbox off
>>> qemu-system-x86_64: -sandbox off: There is no option group 'sandbox'
>>> Segmentation fault
>>>
>>> Commit 5780760f5e ("seccomp: check TSYNC host capability") wrapped one
>>> use of the sandbox option group to produce a sensible error, it didn't
>>> do the same for another call to qemu_opts_parse_noisily():
>>>
>>> (gdb) bt
>>> at util/qemu-option.c:829
>>> #0 0x00000000105b36d8 in opts_parse (list=0x0, params=0x3ffffffffab5 "off", permit_abbrev=true, defaults=false, errp=0x3ffffffff080)
>>> at util/qemu-option.c:829
>>> #1 0x00000000105b3b74 in qemu_opts_parse_noisily (list=<optimized out>, params=<optimized out>, permit_abbrev=<optimized out>) at util/qemu-option.c:890
>>> #2 0x0000000010024964 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:3589
>>>
>>> Fixes: 5780760f5ea6163939a5dabe7427318b4f07d1a2
>>> Cc: david@gibson.dropbear.id.au
>>> Cc: otubo@redhat.com
>>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>>> ---
>>> vl.c | 18 ++++++++++--------
>>> 1 file changed, 10 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/vl.c b/vl.c
>>> index 4019a4387d..5fc4994d3c 100644
>>> --- a/vl.c
>>> +++ b/vl.c
>>> @@ -3866,17 +3866,19 @@ int main(int argc, char **argv, char **envp)
>>> qtest_log = optarg;
>>> break;
>>> case QEMU_OPTION_sandbox:
>>> -#ifdef CONFIG_SECCOMP
>>> - opts = qemu_opts_parse_noisily(qemu_find_opts("sandbox"),
>>> - optarg, true);
>>> + olist = qemu_find_opts("sandbox");
>>> + if (!olist) {
>>> +#ifndef CONFIG_SECCOMP
>>
>> Why do you move the #ifdef? We have two separate error cases here.
>> And it seems better no to check for "-sandbox" when seccomp is disabled.
>
> I tried to remove the #ifdef altogether to simplify the code, then
> realized the error message could be useful.
>
> I don't think it's a problem to lookup "-sandbox" when seccomp is disabled.
>
ok, so:
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
next prev parent reply other threads:[~2019-04-29 19:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-29 13:47 [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled Marc-André Lureau
2019-04-29 13:47 ` Marc-André Lureau
2019-04-29 14:08 ` Philippe Mathieu-Daudé
2019-04-29 14:08 ` Philippe Mathieu-Daudé
2019-04-29 14:24 ` Laurent Vivier
2019-04-29 14:24 ` Laurent Vivier
2019-04-29 14:46 ` Marc-André Lureau
2019-04-29 14:46 ` Marc-André Lureau
2019-04-29 19:13 ` Laurent Vivier [this message]
2019-04-29 19:13 ` Laurent Vivier
2019-04-29 14:36 ` Andrea Bolognani
2019-04-29 14:36 ` Andrea Bolognani
2019-04-30 18:46 ` Paolo Bonzini
2019-04-30 18:46 ` Paolo Bonzini
2019-05-01 10:51 ` no-reply
2019-05-01 10:51 ` no-reply
2019-05-01 12:33 ` no-reply
2019-05-01 12:33 ` no-reply
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=b34321fc-2c10-d930-c735-5490e704a101@redhat.com \
--to=lvivier@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=marcandre.lureau@gmail.com \
--cc=otubo@redhat.com \
--cc=pbonzini@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).