diff options
Diffstat (limited to 'gitlab/issues_toml/target_missing/host_missing/accel_missing/866.toml')
| -rw-r--r-- | gitlab/issues_toml/target_missing/host_missing/accel_missing/866.toml | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/gitlab/issues_toml/target_missing/host_missing/accel_missing/866.toml b/gitlab/issues_toml/target_missing/host_missing/accel_missing/866.toml new file mode 100644 index 000000000..77517513e --- /dev/null +++ b/gitlab/issues_toml/target_missing/host_missing/accel_missing/866.toml @@ -0,0 +1,61 @@ +id = 866 +title = "linux-user: substantial memory leak when threads are created and destroyed" +state = "closed" +created_at = "2022-02-11T03:11:59.674Z" +closed_at = "2023-02-04T19:12:11.704Z" +labels = ["Closed::Fixed", "linux-user"] +url = "https://gitlab.com/qemu-project/qemu/-/issues/866" +host-os = "Fedora 35 Workstation, Windows 11 21H2 22000.469 WSL2" +host-arch = "x86_64" +qemu-version = "6.1.0-10.fc35, and on master@0a301624c2f4ced3331ffd5bce85b4274fe132af" +guest-os = "QEMU Linux User Mode Emulation" +guest-arch = "ARM" +description = """Substantial memory leak when the following simple program is executed on `qemu-arm`, +```c +// compile with `arm-none-linux-gnueabihf-gcc test_qemu.c -o test_qemu.out -pthread` + +#include <assert.h> +#include <pthread.h> + +#define MAGIC_RETURN ((void *)42) + +void *thread_main(void *arg) +{ + return MAGIC_RETURN; +} + +int main(int argc, char *argv[]) +{ + size_t i; + for (i = 0;; i++) + { + pthread_t thread; + assert(pthread_create(&thread, NULL, thread_main, NULL) == 0); + void *ret; + assert(pthread_join(thread, &ret) == 0); + assert(ret == MAGIC_RETURN); + } + + return 0; +} +```""" +reproduce = """1. +``` +export TOOLCHAIN_PREFIX=arm-none-linux-gnueabihf +export ARMSDK=/${TOOLCHAIN_PREFIX} +export SYSROOT=${ARMSDK}/${TOOLCHAIN_PREFIX}/libc +export CC=${ARMSDK}/bin/${TOOLCHAIN_PREFIX}-gcc +``` +2. Download the arm toolchain: `curl --output ${TOOLCHAIN_PREFIX}.tar.xz -L 'https://developer.arm.com/-/media/Files/downloads/gnu-a/10.2-2020.11/binrel/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf.tar.xz?revision=d0b90559-3960-4e4b-9297-7ddbc3e52783&la=en&hash=985078B758BC782BC338DB947347107FBCF8EF6B'` +3. `mkdir -p ${ARMSDK} && tar xf ${TOOLCHAIN_PREFIX}.tar.xz -C ${ARMSDK} --strip-components=1` +4. `$CC test_qemu.c -o test_qemu.out -pthread` +5. `qemu-arm -L $SYSROOT ./test_qemu.out` +6. Observe memory usage keeps ramping up and crashes the process once out of memory.""" +additional = """Valgrind annotation logs [annot.log](/uploads/f8d05d8f216d5a589e8da0758a345de6/annot.log) generated by a local build on master@0a301624c2f4ced3331ffd5bce85b4274fe132af from +```bash +valgrind --xtree-memory=full --xtree-memory-file=xtmemory.kcg bin/debug/native/qemu-arm -L $SYSROOT /mnt/f/test_qemu3.out +# Send CTRL-C before the process crashes due to oom +callgrind_annotate --auto=yes --inclusive=yes --sort=curB:100,curBk:100,totB:100,totBk:100,totFdB:100,totFdBk:100 xtmemory.kcg > annot.log +``` + +#""" |