Commit b7bda69c authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-07-17' into staging



* Leak fixes
* One fix for running with --enable-werror on macOS
* Add fuzzer test to the Gitlab-CI

# gpg: Signature made Fri 17 Jul 2020 10:53:07 BST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2020-07-17:
  gitlab-ci.yml: Add fuzzer tests
  qom: Plug memory leak in "info qom-tree"
  configure: Fix for running with --enable-werror on macOS
  fuzz: Expect the cmdline in a freeable GString
  tests: qmp-cmd-test: fix memory leak
  qtest: bios-tables-test: fix a memory leak

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 151f76c6 b610eba3
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -161,9 +161,27 @@ build-clang:
    IMAGE: fedora
    CONFIGURE_ARGS: --cc=clang --cxx=clang++
    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
      ppc-softmmu s390x-softmmu x86_64-softmmu arm-linux-user
      ppc-softmmu s390x-softmmu arm-linux-user
    MAKE_CHECK_ARGS: check

build-fuzzer:
  <<: *native_build_job_definition
  variables:
    IMAGE: fedora
  script:
    - mkdir build
    - cd build
    - ../configure --cc=clang --cxx=clang++ --enable-fuzzing
                   --enable-sanitizers --target-list=x86_64-softmmu
    - make -j"$JOBS" all check-build x86_64-softmmu/fuzz
    - make check
    - for fuzzer in i440fx-qos-fork-fuzz i440fx-qos-noreset-fuzz
        i440fx-qtest-reboot-fuzz virtio-scsi-flags-fuzz virtio-scsi-fuzz ; do
          echo Testing ${fuzzer} ... ;
          x86_64-softmmu/qemu-fuzz-x86_64 --fuzz-target=${fuzzer} -runs=1000
            || exit 1 ;
      done

build-tci:
  <<: *native_build_job_definition
  variables:
+1 −1
Original line number Diff line number Diff line
@@ -4198,7 +4198,7 @@ pthread_setname_np_wo_tid=no
cat > $TMPC << EOF
#include <pthread.h>

static void *f(void *p) { pthread_setname_np("QEMU"); }
static void *f(void *p) { pthread_setname_np("QEMU"); return NULL; }
int main(void)
{
    pthread_t thread;
+4 −2
Original line number Diff line number Diff line
@@ -96,8 +96,10 @@ static void print_qom_composition(Monitor *mon, Object *obj, int indent);

static int qom_composition_compare(const void *a, const void *b, void *ignore)
{
    return g_strcmp0(a ? object_get_canonical_path_component(a) : NULL,
                     b ? object_get_canonical_path_component(b) : NULL);
    g_autofree char *ac = object_get_canonical_path_component(a);
    g_autofree char *bc = object_get_canonical_path_component(b);

    return g_strcmp0(ac, bc);
}

static int insert_qom_composition_child(Object *obj, void *opaque)
+1 −0
Original line number Diff line number Diff line
@@ -924,6 +924,7 @@ static void test_acpi_tcg_tpm(const char *machine, const char *tpm_if,
    g_free(variant);
    g_free(tmp_path);
    g_free(tmp_dir_name);
    g_free(args);
    free_test_data(&data);
#else
    g_test_skip("TPM disabled");
+6 −7
Original line number Diff line number Diff line
@@ -199,16 +199,15 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
    }

    /* Run QEMU's softmmu main with the fuzz-target dependent arguments */
    const char *init_cmdline = fuzz_target->get_init_cmdline(fuzz_target);
    init_cmdline = g_strdup_printf("%s -qtest /dev/null -qtest-log %s",
                                   init_cmdline,
                                   getenv("QTEST_LOG") ? "/dev/fd/2"
                                                       : "/dev/null");

    GString *cmd_line = fuzz_target->get_init_cmdline(fuzz_target);
    g_string_append_printf(cmd_line,
                           " -qtest /dev/null -qtest-log %s",
                           getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null");

    /* Split the runcmd into an argv and argc */
    wordexp_t result;
    wordexp(init_cmdline, &result, 0);
    wordexp(cmd_line->str, &result, 0);
    g_string_free(cmd_line, true);

    qemu_init(result.we_wordc, result.we_wordv, NULL);

Loading