Skip to content

memory leak in virtio-crypto

Host environment

  • Operating system: Ubuntu 22.04.4 LTS

  • OS/kernel version: Linux 6.5.0-25-generic

  • Architecture: x86_64

  • QEMU flavor: 8.2.92

  • QEMU version: commit: v9.0.0-rc3

  • QEMU command line:

    ./qemu-system-x86_64 -display none -machine accel=qtest -m 512M -machine q35 -nodefaults -object cryptodev-backend-builtin,id=cryptodev0 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 -qtest stdio

Emulated/Virtualized environment

  • Operating system: Debian GNU/Linux 10 (buster)
  • OS/kernel version: Linux syzkaller 6.6.0
  • Architecture: x86_64

Description of problem

The following log reveals it:

==1878896==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x5646565ec262 in __interceptor_calloc llvm/compiler-rt/lib/asan/asan_malloc_linux.cpp:138:3
    #1 0x7f591ec3bc50 in g_malloc0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5ec50)
    #2 0x564659227db7 in error_setg_internal qemu/util/error.c:105:5
    #3 0x56465794ad35 in cryptodev_builtin_operation qemu/backends/cryptodev-builtin.c:557:9
    #4 0x5646579550b5 in cryptodev_backend_operation qemu/backends/cryptodev.c:180:16
    #5 0x564657953640 in cryptodev_backend_crypto_operation qemu/backends/cryptodev.c:289:12
    #6 0x56465773a647 in virtio_crypto_handle_request qemu/hw/virtio/virtio-crypto.c:911:19
    #7 0x5646577386a0 in virtio_crypto_handle_dataq qemu/hw/virtio/virtio-crypto.c:938:13
    #8 0x564657734f87 in virtio_crypto_dataq_bh qemu/hw/virtio/virtio-crypto.c:963:9
    #9 0x56465928a6b1 in aio_bh_call qemu/util/async.c:171:5
    #10 0x56465928b58c in aio_bh_poll qemu/util/async.c:218:13
    #11 0x5646591eb398 in aio_dispatch qemu/util/aio-posix.c:423:5
    #12 0x5646592919ce in aio_ctx_dispatch qemu/util/async.c:360:5
    #13 0x7f591ec32d3a in g_main_context_dispatch (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x55d3a)

Indirect leak of 36 byte(s) in 1 object(s) allocated from:
    #0 0x5646565ec0cd in malloc llvm/compiler-rt/lib/asan/asan_malloc_linux.cpp:129:3
    #1 0x7f591e488157 in __vasprintf_internal libio/./libio/vasprintf.c:71:30

Steps to reproduce

qemu-system-x86_64 -display none -machine accel=qtest -m 512M -machine q35 -nodefaults -object cryptodev-backend-builtin,id=cryptodev0 -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 -qtest stdio < /tmp/reproducer

reproducer

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information