* [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-04-29 13:47 ` Marc-André Lureau
0 siblings, 0 replies; 15+ messages in thread
From: Marc-André Lureau @ 2019-04-29 13:47 UTC (permalink / raw)
To: qemu-devel; +Cc: Marc-André Lureau, david, otubo, Paolo Bonzini
$ ./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
+ error_report("-sandbox support is not enabled "
+ "in this QEMU binary");
+#endif
+ exit(1);
+ }
+
+ opts = qemu_opts_parse_noisily(olist, optarg, true);
if (!opts) {
exit(1);
}
-#else
- error_report("-sandbox support is not enabled "
- "in this QEMU binary");
- exit(1);
-#endif
break;
case QEMU_OPTION_add_fd:
#ifndef _WIN32
--
2.21.0.777.g83232e3864
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-04-29 13:47 ` Marc-André Lureau
0 siblings, 0 replies; 15+ messages in thread
From: Marc-André Lureau @ 2019-04-29 13:47 UTC (permalink / raw)
To: qemu-devel; +Cc: otubo, Marc-André Lureau, Paolo Bonzini, david
$ ./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
+ error_report("-sandbox support is not enabled "
+ "in this QEMU binary");
+#endif
+ exit(1);
+ }
+
+ opts = qemu_opts_parse_noisily(olist, optarg, true);
if (!opts) {
exit(1);
}
-#else
- error_report("-sandbox support is not enabled "
- "in this QEMU binary");
- exit(1);
-#endif
break;
case QEMU_OPTION_add_fd:
#ifndef _WIN32
--
2.21.0.777.g83232e3864
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
2019-04-29 13:47 ` Marc-André Lureau
(?)
@ 2019-04-29 14:08 ` Philippe Mathieu-Daudé
-1 siblings, 0 replies; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-04-29 14:08 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel; +Cc: otubo, Paolo Bonzini, david
On 4/29/19 3:47 PM, 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>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@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
> + error_report("-sandbox support is not enabled "
> + "in this QEMU binary");
> +#endif
> + exit(1);
> + }
> +
> + opts = qemu_opts_parse_noisily(olist, optarg, true);
> if (!opts) {
> exit(1);
> }
> -#else
> - error_report("-sandbox support is not enabled "
> - "in this QEMU binary");
> - exit(1);
> -#endif
> break;
> case QEMU_OPTION_add_fd:
> #ifndef _WIN32
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
2019-04-29 13:47 ` Marc-André Lureau
(?)
(?)
@ 2019-04-29 14:24 ` Laurent Vivier
2019-04-29 14:46 ` Marc-André Lureau
-1 siblings, 1 reply; 15+ messages in thread
From: Laurent Vivier @ 2019-04-29 14:24 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel; +Cc: otubo, Paolo Bonzini, david
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.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
2019-04-29 13:47 ` Marc-André Lureau
` (2 preceding siblings ...)
(?)
@ 2019-04-29 14:36 ` Andrea Bolognani
-1 siblings, 0 replies; 15+ messages in thread
From: Andrea Bolognani @ 2019-04-29 14:36 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel; +Cc: otubo, Paolo Bonzini, david
On Mon, 2019-04-29 at 15:47 +0200, 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(-)
This fixes the crash for me, so
Tested-by: Andrea Bolognani <abologna@redhat.com>
--
Andrea Bolognani / Red Hat / Virtualization
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-04-29 14:46 ` Marc-André Lureau
0 siblings, 0 replies; 15+ messages in thread
From: Marc-André Lureau @ 2019-04-29 14:46 UTC (permalink / raw)
To: Laurent Vivier; +Cc: QEMU, Eduardo Otubo, Paolo Bonzini, David Gibson
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.
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-04-29 14:46 ` Marc-André Lureau
0 siblings, 0 replies; 15+ messages in thread
From: Marc-André Lureau @ 2019-04-29 14:46 UTC (permalink / raw)
To: Laurent Vivier; +Cc: Eduardo Otubo, Paolo Bonzini, QEMU, David Gibson
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.
--
Marc-André Lureau
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-04-29 19:13 ` Laurent Vivier
0 siblings, 0 replies; 15+ messages in thread
From: Laurent Vivier @ 2019-04-29 19:13 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: QEMU, Eduardo Otubo, Paolo Bonzini, David Gibson
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>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-04-29 19:13 ` Laurent Vivier
0 siblings, 0 replies; 15+ messages in thread
From: Laurent Vivier @ 2019-04-29 19:13 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: Eduardo Otubo, Paolo Bonzini, QEMU, David Gibson
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>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-04-30 18:46 ` Paolo Bonzini
0 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-04-30 18:46 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel; +Cc: david, otubo
On 29/04/19 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
> + error_report("-sandbox support is not enabled "
> + "in this QEMU binary");
> +#endif
> + exit(1);
> + }
> +
> + opts = qemu_opts_parse_noisily(olist, optarg, true);
> if (!opts) {
> exit(1);
> }
> -#else
> - error_report("-sandbox support is not enabled "
> - "in this QEMU binary");
> - exit(1);
> -#endif
> break;
> case QEMU_OPTION_add_fd:
> #ifndef _WIN32
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-04-30 18:46 ` Paolo Bonzini
0 siblings, 0 replies; 15+ messages in thread
From: Paolo Bonzini @ 2019-04-30 18:46 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel; +Cc: otubo, david
On 29/04/19 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
> + error_report("-sandbox support is not enabled "
> + "in this QEMU binary");
> +#endif
> + exit(1);
> + }
> +
> + opts = qemu_opts_parse_noisily(olist, optarg, true);
> if (!opts) {
> exit(1);
> }
> -#else
> - error_report("-sandbox support is not enabled "
> - "in this QEMU binary");
> - exit(1);
> -#endif
> break;
> case QEMU_OPTION_add_fd:
> #ifndef _WIN32
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-05-01 10:51 ` no-reply
0 siblings, 0 replies; 15+ messages in thread
From: no-reply @ 2019-05-01 10:51 UTC (permalink / raw)
To: marcandre.lureau; +Cc: fam, qemu-devel, otubo, pbonzini, david
Patchew URL: https://patchew.org/QEMU/20190429134757.13570-1-marcandre.lureau@redhat.com/
Hi,
This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===
The full log is available at
http://patchew.org/logs/20190429134757.13570-1-marcandre.lureau@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-05-01 10:51 ` no-reply
0 siblings, 0 replies; 15+ messages in thread
From: no-reply @ 2019-05-01 10:51 UTC (permalink / raw)
To: marcandre.lureau
Cc: fam, otubo, qemu-devel, marcandre.lureau, pbonzini, david
Patchew URL: https://patchew.org/QEMU/20190429134757.13570-1-marcandre.lureau@redhat.com/
Hi,
This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===
The full log is available at
http://patchew.org/logs/20190429134757.13570-1-marcandre.lureau@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-05-01 12:33 ` no-reply
0 siblings, 0 replies; 15+ messages in thread
From: no-reply @ 2019-05-01 12:33 UTC (permalink / raw)
To: marcandre.lureau; +Cc: fam, qemu-devel, otubo, pbonzini, david
Patchew URL: https://patchew.org/QEMU/20190429134757.13570-1-marcandre.lureau@redhat.com/
Hi,
This series failed the asan build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
=== TEST SCRIPT END ===
The full log is available at
http://patchew.org/logs/20190429134757.13570-1-marcandre.lureau@redhat.com/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Qemu-devel] [PATCH] vl: fix -sandbox parsing crash when seccomp support is disabled
@ 2019-05-01 12:33 ` no-reply
0 siblings, 0 replies; 15+ messages in thread
From: no-reply @ 2019-05-01 12:33 UTC (permalink / raw)
To: marcandre.lureau
Cc: fam, otubo, qemu-devel, marcandre.lureau, pbonzini, david
Patchew URL: https://patchew.org/QEMU/20190429134757.13570-1-marcandre.lureau@redhat.com/
Hi,
This series failed the asan build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.
=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-debug@fedora TARGET_LIST=x86_64-softmmu J=14 NETWORK=1
=== TEST SCRIPT END ===
The full log is available at
http://patchew.org/logs/20190429134757.13570-1-marcandre.lureau@redhat.com/testing.asan/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2019-05-02 8:43 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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: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
2019-04-29 19:13 ` Laurent Vivier
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
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.