From: Darren Kenny <darren.kenny@oracle.com>
To: Alexander Bulekov <alxndr@bu.edu>, qemu-devel@nongnu.org
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Bandan Das" <bsd@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH v4 3/3] fuzz: make object-name matching case-insensitive
Date: Tue, 29 Jun 2021 11:07:46 +0100 [thread overview]
Message-ID: <m21r8lrnkd.fsf@oracle.com> (raw)
In-Reply-To: <20210629011151.7vz2a7d7j7a653pk@mozz.bu.edu>
On Monday, 2021-06-28 at 21:11:51 -04, Alexander Bulekov wrote:
> On 210628 0123, Alexander Bulekov wrote:
>> We have some configs for devices such as the AC97 and ES1370 that were
>> not matching memory-regions correctly, because the configs provided
>> lowercase names. To resolve these problems and prevent them from
>> occurring again in the future, convert both the pattern and names to
>> lower-case, prior to checking for a match.
>>
>> Suggested-by: Darren Kenny <darren.kenny@oracle.com>
>> Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
>> ---
>> tests/qtest/fuzz/generic_fuzz.c | 24 ++++++++++++++++++++----
>> 1 file changed, 20 insertions(+), 4 deletions(-)
>>
>> diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c
>> index 71d36e8f6f..0695a349b2 100644
>> --- a/tests/qtest/fuzz/generic_fuzz.c
>> +++ b/tests/qtest/fuzz/generic_fuzz.c
>> @@ -751,8 +751,13 @@ static int locate_fuzz_memory_regions(Object *child, void *opaque)
>>
>> static int locate_fuzz_objects(Object *child, void *opaque)
>> {
>> + GString *type_name;
>> + GString *path_name;
>> char *pattern = opaque;
>> - if (g_pattern_match_simple(pattern, object_get_typename(child))) {
>> +
>> + type_name = g_string_new(object_get_typename(child));
>> + g_string_ascii_down(type_name);
>> + if (g_pattern_match_simple(pattern, type_name->str)) {
>> /* Find and save ptrs to any child MemoryRegions */
>> object_child_foreach_recursive(child, locate_fuzz_memory_regions, NULL);
>>
>> @@ -769,8 +774,9 @@ static int locate_fuzz_objects(Object *child, void *opaque)
>> g_ptr_array_add(fuzzable_pci_devices, PCI_DEVICE(child));
>> }
>> } else if (object_dynamic_cast(OBJECT(child), TYPE_MEMORY_REGION)) {
>> - if (g_pattern_match_simple(pattern,
>> - object_get_canonical_path_component(child))) {
>> + path_name = g_string_new(object_get_canonical_path_component(child));
>> + g_string_ascii_down(path_name);
>> + if (g_pattern_match_simple(pattern, path_name->str)) {
>> MemoryRegion *mr;
>> mr = MEMORY_REGION(child);
>> if ((memory_region_is_ram(mr) ||
>> @@ -779,7 +785,9 @@ static int locate_fuzz_objects(Object *child, void *opaque)
>> g_hash_table_insert(fuzzable_memoryregions, mr, (gpointer)true);
>> }
>> }
>> + g_string_free(path_name, true);
>> }
>> + g_string_free(type_name, true);
>> return 0;
>> }
>>
>> @@ -807,6 +815,7 @@ static void generic_pre_fuzz(QTestState *s)
>> MemoryRegion *mr;
>> QPCIBus *pcibus;
>> char **result;
>> + GString *pattern;
> ^
> Just noticed that this collides with struct pattern through a
> sizeof(pattern) call below, causing nasty heap issues during fuzzing.
> I'll send a v4 with a better name.
>
Certainly wasn't obvious from the diff :)
Fair enough.
Thanks,
Darren.
next prev parent reply other threads:[~2021-06-29 10:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 5:23 [PATCH v4 0/3] Fuzzer pattern-matching, timeouts, and instrumentation-filtering Alexander Bulekov
2021-06-28 5:23 ` [PATCH v4 1/3] fuzz: adjust timeout to allow for longer inputs Alexander Bulekov
2021-06-28 5:23 ` [PATCH v4 2/3] fuzz: add an instrumentation filter Alexander Bulekov
2021-06-28 5:23 ` [PATCH v4 3/3] fuzz: make object-name matching case-insensitive Alexander Bulekov
2021-06-29 1:11 ` Alexander Bulekov
2021-06-29 10:07 ` Darren Kenny [this message]
2021-06-29 10:03 ` Darren Kenny
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=m21r8lrnkd.fsf@oracle.com \
--to=darren.kenny@oracle.com \
--cc=alxndr@bu.edu \
--cc=bsd@redhat.com \
--cc=f4bug@amsat.org \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.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).