qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 82e258: qtest: bios-tables-test: fix a memory


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 82e258: qtest: bios-tables-test: fix a memory leak
Date: Fri, 17 Jul 2020 06:45:29 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 82e258db15dc563e1d015c19b3af2d585695a7b1
      
https://github.com/qemu/qemu/commit/82e258db15dc563e1d015c19b3af2d585695a7b1
  Author: Li Qiang <liq3ea@163.com>
  Date:   2020-07-17 (Fri, 17 Jul 2020)

  Changed paths:
    M tests/qtest/bios-tables-test.c

  Log Message:
  -----------
  qtest: bios-tables-test: fix a memory leak

Fixes: 5da7c35e25a("bios-tables-test: Add Q35/TPM-TIS test")
Signed-off-by: Li Qiang <liq3ea@163.com>
Message-Id: <20200714153536.66060-1-liq3ea@163.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: 15c51f724ec61ab6a6910c41113d6d07164b6ca4
      
https://github.com/qemu/qemu/commit/15c51f724ec61ab6a6910c41113d6d07164b6ca4
  Author: Li Qiang <liq3ea@163.com>
  Date:   2020-07-17 (Fri, 17 Jul 2020)

  Changed paths:
    M tests/qtest/qmp-cmd-test.c

  Log Message:
  -----------
  tests: qmp-cmd-test: fix memory leak

Properly free each test response to avoid memory leak and separate
qtest_qmp() calls with spare lines, in a consistent manner.

Fixes: 5b88849e7b9("tests/qmp-cmd-test: Add qmp/object-add-failure-modes")
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Li Qiang <liq3ea@163.com>
Message-Id: <20200715154117.15456-1-liq3ea@163.com>
Fixes: 9fc719b869 ("tests/qmp-cmd-test: Add qmp/object-add-duplicate-id")
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: f5ec79f5e0a3a307fc2a11b3ba8066a2d0a90233
      
https://github.com/qemu/qemu/commit/f5ec79f5e0a3a307fc2a11b3ba8066a2d0a90233
  Author: Alexander Bulekov <alxndr@bu.edu>
  Date:   2020-07-17 (Fri, 17 Jul 2020)

  Changed paths:
    M tests/qtest/fuzz/fuzz.c
    M tests/qtest/fuzz/fuzz.h
    M tests/qtest/fuzz/i440fx_fuzz.c
    M tests/qtest/fuzz/qos_fuzz.c

  Log Message:
  -----------
  fuzz: Expect the cmdline in a freeable GString

In the initial FuzzTarget, get_init_cmdline returned a char *. With this
API, we had no guarantee about where the string came from. For example,
i440fx-qtest-reboot-fuzz simply returned a pointer to a string literal,
while the QOS-based targets build the arguments out in a GString an
return the gchar *str pointer. Since we did not try to free the cmdline,
we have a leak for any targets that do not simply return string
literals. Clean up this mess by forcing fuzz-targets to return
a GString, that we can free.

Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20200714174616.20709-1-alxndr@bu.edu>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: 12a9b8d8240aaddf14774b9fb03af5e2e0b9f60a
      
https://github.com/qemu/qemu/commit/12a9b8d8240aaddf14774b9fb03af5e2e0b9f60a
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-07-17 (Fri, 17 Jul 2020)

  Changed paths:
    M configure

  Log Message:
  -----------
  configure: Fix for running with --enable-werror on macOS

The configure script currently refuses to succeed when run on macOS
with --enable-werror:

 ERROR: configure test passed without -Werror but failed with -Werror.

The information in config.log indicates:

 config-temp/qemu-conf.c:3:55: error: control reaches end of non-void
 function [-Werror,-Wreturn-type]
 static void *f(void *p) { pthread_setname_np("QEMU"); }
                                                      ^
And indeed, the return statement is missing here.

Fixes: 479a57475e ("util: Implement debug-threads for macOS")
Message-Id: <20200716055655.24507-1-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: ab2d185d6b1d3aa1ab2416a896347d235e32ac3d
      
https://github.com/qemu/qemu/commit/ab2d185d6b1d3aa1ab2416a896347d235e32ac3d
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2020-07-17 (Fri, 17 Jul 2020)

  Changed paths:
    M qom/qom-hmp-cmds.c

  Log Message:
  -----------
  qom: Plug memory leak in "info qom-tree"

Commit e8c9e65816 "qom: Make "info qom-tree" show children sorted"
created a memory leak, because I didn't realize
object_get_canonical_path_component()'s value needs to be freed.

Reproducer:

    $ qemu-system-x86_64 -nodefaults -display none -S -monitor stdio
    QEMU 5.0.50 monitor - type 'help' for more information
    (qemu) info qom-tree

This leaks some 4500 path components, 12-13 characters on average,
i.e. roughly 100kBytes depending on the allocator.  A couple of
hundred "info qom-tree" here, a couple of hundred there, and soon
enough we're talking about real memory.

Plug the leak.

Fixes: e8c9e65816f5dbfe18ad3b2be938d0d8192d459a
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reported-by: Reviewed-by: Li Qiang <liq3ea@gmail.com> [sent same patch]
Message-Id: <20200714160202.3121879-3-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: b610eba335d5c8ac7484dbb1c886b125e2dea058
      
https://github.com/qemu/qemu/commit/b610eba335d5c8ac7484dbb1c886b125e2dea058
  Author: Thomas Huth <thuth@redhat.com>
  Date:   2020-07-17 (Fri, 17 Jul 2020)

  Changed paths:
    M .gitlab-ci.yml

  Log Message:
  -----------
  gitlab-ci.yml: Add fuzzer tests

So far we neither compile-tested nor run any of the new fuzzers in our CI,
which led to some build failures of the fuzzer code in the past weeks.
To avoid this problem, add a job to compile the fuzzer code and run some
loops (which likely don't find any new bugs via fuzzing, but at least we
know that the code can still be run).

A nice side-effect of this test is that the leak tests are enabled here,
so we should now notice some of the memory leaks in our code base earlier.

Message-Id: <20200716100950.27396-1-thuth@redhat.com>
Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Thomas Huth <thuth@redhat.com>


  Commit: b7bda69c4ef46c57480f6e378923f5215b122778
      
https://github.com/qemu/qemu/commit/b7bda69c4ef46c57480f6e378923f5215b122778
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2020-07-17 (Fri, 17 Jul 2020)

  Changed paths:
    M .gitlab-ci.yml
    M configure
    M qom/qom-hmp-cmds.c
    M tests/qtest/bios-tables-test.c
    M tests/qtest/fuzz/fuzz.c
    M tests/qtest/fuzz/fuzz.h
    M tests/qtest/fuzz/i440fx_fuzz.c
    M tests/qtest/fuzz/qos_fuzz.c
    M tests/qtest/qmp-cmd-test.c

  Log Message:
  -----------
  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: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/151f76c689b1...b7bda69c4ef4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]