Skip to contentSkip to conversation

fuzz: only use generic-fuzz targets on oss-fuzz

PATCH Superseded Alexander Bulekov 3 participants 5 messages Jun 22, 2022 – Jun 23, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fuzz: only use generic-fuzz targets on oss-fuzz

The non-generic-fuzz targets often time-out, or run out of memory. Additionally, they create unreproducible bug-reports. It is possible that this is resulting in failing coverage-reports on OSS-Fuzz. In the future, these test-cases should be fixed, or removed.

---
 scripts/oss-fuzz/build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/oss-fuzz/build.sh +1 -1
index 98b56e0521..d8b4446d24 100755
@@ -105,7 +105,7 @@ do
     # to be configured. We have some generic-fuzz-{pc-q35, floppy, ...} targets
     # that are thin wrappers around this target that set the required
     # environment variables according to predefined configs.
-    if [ "$target" != "generic-fuzz" ]; then
+    if echo "$target" | grep -q "generic-fuzz-"; then
         ln  $base_copy \
             "$DEST_DIR/qemu-fuzz-i386-target-$target"
     fi
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Alex,

This looks good to me, so:

But, if it is at all possible to use Bash glob in a '[[ ... ]]' test such as:

if [[ $target == generic-fuzz-* ]]; then

that might read better - but it seems the default is that we don't assume that, or am I wrong? (This is probably a question for others on the CC-list)

Thanks,

Darren.

Quoted 25 lines · Alexander Bulekov

The non-generic-fuzz targets often time-out, or run out of memory. Additionally, they create unreproducible bug-reports. It is possible that this is resulting in failing coverage-reports on OSS-Fuzz. In the future, these test-cases should be fixed, or removed.

---
 scripts/oss-fuzz/build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/oss-fuzz/build.sh +1 -1
index 98b56e0521..d8b4446d24 100755
@@ -105,7 +105,7 @@ do
     # to be configured. We have some generic-fuzz-{pc-q35, floppy, ...} targets
     # that are thin wrappers around this target that set the required
     # environment variables according to predefined configs.
-    if [ "$target" != "generic-fuzz" ]; then
+    if echo "$target" | grep -q "generic-fuzz-"; then
         ln  $base_copy \
             "$DEST_DIR/qemu-fuzz-i386-target-$target"
     fi
Signature · 1 line
2.27.0
#2 lore raw
Quoted 6 lines · Darren Kenny

Hi Alex,

This looks good to me, so:

Quoted 8 lines

But, if it is at all possible to use Bash glob in a '[[ ... ]]' test such as:

if [[ $target == generic-fuzz-* ]]; then

that might read better - but it seems the default is that we don't assume that, or am I wrong? (This is probably a question for others on the CC-list)

That sounds good to me. Should we change the script to #!/bin/bash, to be safe?
-Alex

Quoted 31 lines

Thanks,

Darren.

Quoted 25 lines · Alexander Bulekov

The non-generic-fuzz targets often time-out, or run out of memory. Additionally, they create unreproducible bug-reports. It is possible that this is resulting in failing coverage-reports on OSS-Fuzz. In the future, these test-cases should be fixed, or removed.

---
 scripts/oss-fuzz/build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/oss-fuzz/build.sh +1 -1
index 98b56e0521..d8b4446d24 100755
@@ -105,7 +105,7 @@ do
     # to be configured. We have some generic-fuzz-{pc-q35, floppy, ...} targets
     # that are thin wrappers around this target that set the required
     # environment variables according to predefined configs.
-    if [ "$target" != "generic-fuzz" ]; then
+    if echo "$target" | grep -q "generic-fuzz-"; then
         ln  $base_copy \
             "$DEST_DIR/qemu-fuzz-i386-target-$target"
     fi
Signature · 1 line
2.27.0
#3 lore raw
Quoted 10 lines · Alexander Bulekov
Quoted 9 lines · Darren Kenny

Hi Alex,

This looks good to me, so:

But, if it is at all possible to use Bash glob in a '[[ ... ]]' test such as:

Quoted 8 lines
Quoted 5 lines

if [[ $target == generic-fuzz-* ]]; then

that might read better - but it seems the default is that we don't assume that, or am I wrong? (This is probably a question for others on the CC-list)

That sounds good to me. Should we change the script to #!/bin/bash, to be safe?

If it is acceptable to use the '[[ ... ]]' syntax then you'd definitely want to ensure that it is bash that is used.

Thanks,

Darren.

Quoted 33 lines

-Alex

Quoted 31 lines

Thanks,

Darren.

Quoted 25 lines · Alexander Bulekov

The non-generic-fuzz targets often time-out, or run out of memory. Additionally, they create unreproducible bug-reports. It is possible that this is resulting in failing coverage-reports on OSS-Fuzz. In the future, these test-cases should be fixed, or removed.

---
 scripts/oss-fuzz/build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/oss-fuzz/build.sh +1 -1
index 98b56e0521..d8b4446d24 100755
@@ -105,7 +105,7 @@ do
     # to be configured. We have some generic-fuzz-{pc-q35, floppy, ...} targets
     # that are thin wrappers around this target that set the required
     # environment variables according to predefined configs.
-    if [ "$target" != "generic-fuzz" ]; then
+    if echo "$target" | grep -q "generic-fuzz-"; then
         ln  $base_copy \
             "$DEST_DIR/qemu-fuzz-i386-target-$target"
     fi
Signature · 1 line
2.27.0
#4 lore raw
Quoted 17 lines · Darren Kenny
Quoted 16 lines · Alexander Bulekov
Quoted 14 lines · Darren Kenny

Hi Alex,

This looks good to me, so:

But, if it is at all possible to use Bash glob in a '[[ ... ]]' test such as:

   if [[ $target == generic-fuzz-* ]]; then

that might read better - but it seems the default is that we don't assume that, or am I wrong? (This is probably a question for others on the CC-list)

Quoted 5 lines
Quoted 2 lines

That sounds good to me. Should we change the script to #!/bin/bash, to be safe?

If it is acceptable to use the '[[ ... ]]' syntax then you'd definitely want to ensure that it is bash that is used.

This is not a script that has to run on arbitrary host types, so I think it's OK to change the shebang line to use bash here.

Thomas