[Qemu-devel] [PATCH 0/2] qom: Fix ambiguous path detection when ambiguous=NULL

Eduardo Habkost posted 2 patches 8 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170707213052.13087-1-ehabkost@redhat.com
Test FreeBSD passed
Test checkpatch passed
Test docker passed
Test s390x passed
qom/object.c               | 17 ++++++++---------
tests/check-qom-proplist.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 9 deletions(-)
[Qemu-devel] [PATCH 0/2] qom: Fix ambiguous path detection when ambiguous=NULL
Posted by Eduardo Habkost 8 years, 4 months ago
object_resolve_path*() ambiguous path detection breaks when
ambiguous==NULL and the object tree have 3 objects of the same type and
only 2 of them are under the same parent.  e.g.:

 /container/obj1 (TYPE_FOO)
 /container/obj2 (TYPE_FOO)
 /obj2 (TYPE_FOO)

With the above tree, object_resolve_path_type("", TYPE_FOO, NULL) will
incorrectly return /obj2, because the search inside "/container" will
return NULL, and the match at "/obj2" won't be detected as ambiguous.

Fix that by always calling object_resolve_partial_path() with a non-NULL
ambiguous parameter.

Test case included.

Reported-by: Igor Mammedov <imammedo@redhat.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Eduardo Habkost (2):
  tests: Test case for object_resolve_path*()
  qom: Fix ambiguous path detection when ambiguous=NULL

 qom/object.c               | 17 ++++++++---------
 tests/check-qom-proplist.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 9 deletions(-)

-- 
2.9.4


Re: [Qemu-devel] [PATCH 0/2] qom: Fix ambiguous path detection when ambiguous=NULL
Posted by Mark Cave-Ayland 8 years, 3 months ago
On 07/07/17 22:30, Eduardo Habkost wrote:

> object_resolve_path*() ambiguous path detection breaks when
> ambiguous==NULL and the object tree have 3 objects of the same type and
> only 2 of them are under the same parent.  e.g.:
> 
>  /container/obj1 (TYPE_FOO)
>  /container/obj2 (TYPE_FOO)
>  /obj2 (TYPE_FOO)
> 
> With the above tree, object_resolve_path_type("", TYPE_FOO, NULL) will
> incorrectly return /obj2, because the search inside "/container" will
> return NULL, and the match at "/obj2" won't be detected as ambiguous.
> 
> Fix that by always calling object_resolve_partial_path() with a non-NULL
> ambiguous parameter.
> 
> Test case included.
> 
> Reported-by: Igor Mammedov <imammedo@redhat.com>
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> 
> Eduardo Habkost (2):
>   tests: Test case for object_resolve_path*()
>   qom: Fix ambiguous path detection when ambiguous=NULL
> 
>  qom/object.c               | 17 ++++++++---------
>  tests/check-qom-proplist.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 52 insertions(+), 9 deletions(-)

I've done a quick test here and I get a pass on "make check" with these
patches applied so:

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Later on I'll also rework my fw_cfg patchset and send out a v8 which
should hopefully be the last iteration.


ATB,

Mark.


Re: [Qemu-devel] [PATCH 0/2] qom: Fix ambiguous path detection when ambiguous=NULL
Posted by Eduardo Habkost 8 years, 3 months ago
On Fri, Jul 07, 2017 at 06:30:50PM -0300, Eduardo Habkost wrote:
> object_resolve_path*() ambiguous path detection breaks when
> ambiguous==NULL and the object tree have 3 objects of the same type and
> only 2 of them are under the same parent.  e.g.:
> 
>  /container/obj1 (TYPE_FOO)
>  /container/obj2 (TYPE_FOO)
>  /obj2 (TYPE_FOO)
> 
> With the above tree, object_resolve_path_type("", TYPE_FOO, NULL) will
> incorrectly return /obj2, because the search inside "/container" will
> return NULL, and the match at "/obj2" won't be detected as ambiguous.
> 
> Fix that by always calling object_resolve_partial_path() with a non-NULL
> ambiguous parameter.
> 
> Test case included.
> 
> Reported-by: Igor Mammedov <imammedo@redhat.com>
> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> 
> Eduardo Habkost (2):
>   tests: Test case for object_resolve_path*()

I'm queueing patch 1/2 on my machine-next tree.  I will wait a
little longer for additional feedback on patch 2/2 before merging
it.

>   qom: Fix ambiguous path detection when ambiguous=NULL
> 
>  qom/object.c               | 17 ++++++++---------
>  tests/check-qom-proplist.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 52 insertions(+), 9 deletions(-)
> 
> -- 
> 2.9.4
> 
> 

-- 
Eduardo

Re: [Qemu-devel] [PATCH 0/2] qom: Fix ambiguous path detection when ambiguous=NULL
Posted by Paolo Bonzini 8 years, 3 months ago
On 10/07/2017 20:23, Eduardo Habkost wrote:
> On Fri, Jul 07, 2017 at 06:30:50PM -0300, Eduardo Habkost wrote:
>> object_resolve_path*() ambiguous path detection breaks when
>> ambiguous==NULL and the object tree have 3 objects of the same type and
>> only 2 of them are under the same parent.  e.g.:
>>
>>  /container/obj1 (TYPE_FOO)
>>  /container/obj2 (TYPE_FOO)
>>  /obj2 (TYPE_FOO)
>>
>> With the above tree, object_resolve_path_type("", TYPE_FOO, NULL) will
>> incorrectly return /obj2, because the search inside "/container" will
>> return NULL, and the match at "/obj2" won't be detected as ambiguous.
>>
>> Fix that by always calling object_resolve_partial_path() with a non-NULL
>> ambiguous parameter.
>>
>> Test case included.
>>
>> Reported-by: Igor Mammedov <imammedo@redhat.com>
>> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>
>> Eduardo Habkost (2):
>>   tests: Test case for object_resolve_path*()
> 
> I'm queueing patch 1/2 on my machine-next tree.  I will wait a
> little longer for additional feedback on patch 2/2 before merging
> it.

Please apply both (with or without fixup, it's fine either way).

Paolo

>>   qom: Fix ambiguous path detection when ambiguous=NULL
>>
>>  qom/object.c               | 17 ++++++++---------
>>  tests/check-qom-proplist.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 52 insertions(+), 9 deletions(-)
>>
>> -- 
>> 2.9.4
>>
>>
>