Message ID | 20180307180358.30393-1-marcandre.lureau@redhat.com |
---|---|
State | New |
Headers | show |
Series | [1/2] arm: fix load ELF error leak | expand |
On 7 March 2018 at 18:03, Marc-André Lureau <marcandre.lureau@redhat.com> wrote: > Spotted by ASAN: > QTEST_QEMU_BINARY=aarch64-softmmu/qemu-system-aarch64 tests/boot-serial-test > > Direct leak of 48 byte(s) in 1 object(s) allocated from: > #0 0x7ff8a9b0ca38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38) > #1 0x7ff8a8ea7f75 in g_malloc0 ../glib/gmem.c:124 > #2 0x55fef3d99129 in error_setv /home/elmarco/src/qemu/util/error.c:59 > #3 0x55fef3d99738 in error_setg_internal /home/elmarco/src/qemu/util/error.c:95 > #4 0x55fef323acb2 in load_elf_hdr /home/elmarco/src/qemu/hw/core/loader.c:393 > #5 0x55fef2d15776 in arm_load_elf /home/elmarco/src/qemu/hw/arm/boot.c:830 > #6 0x55fef2d16d39 in arm_load_kernel_notify /home/elmarco/src/qemu/hw/arm/boot.c:1022 > #7 0x55fef3dc634d in notifier_list_notify /home/elmarco/src/qemu/util/notify.c:40 > #8 0x55fef2fc3182 in qemu_run_machine_init_done_notifiers /home/elmarco/src/qemu/vl.c:2716 > #9 0x55fef2fcbbd1 in main /home/elmarco/src/qemu/vl.c:4679 > #10 0x7ff89dfed009 in __libc_start_main (/lib64/libc.so.6+0x21009) > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Thanks, applied patches 1 and 2 to target-arm.next. For the future, when you're sending a patchset that's more than one patch can you make sure you send a cover letter, please? The automated tooling wants to see the cover letter, and if there isn't one I have to mess about with fishing the patches out of email and applying them by hand, which is a faff. thanks -- PMM
diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 6d0c92ab88..784d301683 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -829,6 +829,7 @@ static uint64_t arm_load_elf(struct arm_boot_info *info, uint64_t *pentry, load_elf_hdr(info->kernel_filename, &elf_header, &elf_is64, &err); if (err) { + error_free(err); return ret; }
Spotted by ASAN: QTEST_QEMU_BINARY=aarch64-softmmu/qemu-system-aarch64 tests/boot-serial-test Direct leak of 48 byte(s) in 1 object(s) allocated from: #0 0x7ff8a9b0ca38 in __interceptor_calloc (/lib64/libasan.so.4+0xdea38) #1 0x7ff8a8ea7f75 in g_malloc0 ../glib/gmem.c:124 #2 0x55fef3d99129 in error_setv /home/elmarco/src/qemu/util/error.c:59 #3 0x55fef3d99738 in error_setg_internal /home/elmarco/src/qemu/util/error.c:95 #4 0x55fef323acb2 in load_elf_hdr /home/elmarco/src/qemu/hw/core/loader.c:393 #5 0x55fef2d15776 in arm_load_elf /home/elmarco/src/qemu/hw/arm/boot.c:830 #6 0x55fef2d16d39 in arm_load_kernel_notify /home/elmarco/src/qemu/hw/arm/boot.c:1022 #7 0x55fef3dc634d in notifier_list_notify /home/elmarco/src/qemu/util/notify.c:40 #8 0x55fef2fc3182 in qemu_run_machine_init_done_notifiers /home/elmarco/src/qemu/vl.c:2716 #9 0x55fef2fcbbd1 in main /home/elmarco/src/qemu/vl.c:4679 #10 0x7ff89dfed009 in __libc_start_main (/lib64/libc.so.6+0x21009) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- hw/arm/boot.c | 1 + 1 file changed, 1 insertion(+)