Re: [PATCH] kexec-tools: Add some missing free() calls

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

 





On 09/17/2020 04:20 AM, Bhupesh SHARMA wrote:
Hi Youling,

See some comments inline:

On Sat, Sep 12, 2020 at 7:11 AM Youling Tang <tangyouling@xxxxxxxxxxx> wrote:
Add some missing free() calls.

Signed-off-by: Youling Tang <tangyouling@xxxxxxxxxxx>
---
  kexec/arch/i386/crashdump-x86.c    | 22 +++++++++++++++++-----
  kexec/arch/mips/crashdump-mips.c   |  5 ++++-
  kexec/arch/ppc64/crashdump-ppc64.c |  8 ++++++--
  3 files changed, 27 insertions(+), 8 deletions(-)
First, I think this is a step in the right direction, however, earlier
also while running 'valgrind' on an x86_64 kexec elf I saw the
following memory leaks reported:

==596886== 15,604 bytes in 1 blocks are indirectly lost in loss record 4 of 12
==596886==    at 0x483A809: malloc (vg_replace_malloc.c:307)
==596886==    by 0x40396D: xmalloc (kexec.c:101)
==596886==    by 0x410D35: do_bzImage64_load (kexec-bzImage64.c:182)
==596886==    by 0x410D35: bzImage64_load (kexec-bzImage64.c:391)
==596886==    by 0x404410: my_load (kexec.c:774)
==596886==    by 0x402D2D: main (kexec.c:1605)

==596886== 15,732 (128 direct, 15,604 indirect) bytes in 1 blocks are
definitely lost in loss record 5 of 12
==596886==    at 0x483CCE8: realloc (vg_replace_malloc.c:834)
==596886==    by 0x403FB9: xrealloc (kexec.c:112)
==596886==    by 0x403FB9: add_segment_phys_virt (kexec.c:357)
==596886==    by 0x40410F: add_buffer_phys_virt (kexec.c:392)
==596886==    by 0x404153: add_buffer_virt (kexec.c:401)
==596886==    by 0x40CD11: setup_linux_bootloader_parameters_high
(x86-linux-setup.c:80)
==596886==    by 0x410E6A: do_bzImage64_load (kexec-bzImage64.c:214)
==596886==    by 0x410E6A: bzImage64_load (kexec-bzImage64.c:391)
==596886==    by 0x404410: my_load (kexec.c:774)
==596886==    by 0x402D2D: main (kexec.c:1605)

==596886== 28,896 bytes in 1 blocks are indirectly lost in loss record 7 of 12
==596886==    at 0x483A809: malloc (vg_replace_malloc.c:307)
==596886==    by 0x40396D: xmalloc (kexec.c:101)
==596886==    by 0x406781: elf_rel_load (kexec-elf-rel.c:254)
==596886==    by 0x406EEA: elf_rel_build_load (kexec-elf-rel.c:432)
==596886==    by 0x410CFE: do_bzImage64_load (kexec-bzImage64.c:173)
==596886==    by 0x410CFE: bzImage64_load (kexec-bzImage64.c:391)
==596886==    by 0x404410: my_load (kexec.c:774)
==596886==    by 0x402D2D: main (kexec.c:1605)

==596886== 30,048 (1,152 direct, 28,896 indirect) bytes in 1 blocks
are definitely lost in loss record 8 of 12
==596886==    at 0x483A809: malloc (vg_replace_malloc.c:307)
==596886==    by 0x40396D: xmalloc (kexec.c:101)
==596886==    by 0x405735: build_mem_shdrs (kexec-elf.c:618)
==596886==    by 0x405735: build_elf_info (kexec-elf.c:774)
==596886==    by 0x406EB9: build_elf_rel_info (kexec-elf-rel.c:142)
==596886==    by 0x406EB9: elf_rel_build_load (kexec-elf-rel.c:427)
==596886==    by 0x410CFE: do_bzImage64_load (kexec-bzImage64.c:173)
==596886==    by 0x410CFE: bzImage64_load (kexec-bzImage64.c:391)
==596886==    by 0x404410: my_load (kexec.c:774)
==596886==    by 0x402D2D: main (kexec.c:1605)
==596886==

Note that there were 12 issues highlighted via valgrind out of which I
have removed the zlib related issue reports.

You can run 'valgrind' on mips, i386 and ppc64 executables (as shown
below) to see if all such issues are fixed by your patch:
$ sudo valgrind --leak-check=full --show-leak-kinds=all
--track-origins=yes --verbose --log-file=valgrind-out.txt ./kexec -l
/boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname -r`.img
--reuse-cmdline -d

Hi Bhupesh,

Thank you for your advice.
But it fails when installing 'valgrind' tool (arch: mips64),
the compilation error message is as follows:
...
/tmp/ccF1OhPy.s:6605: Error: unrecognized opcode `cfcmsa $4,$1'
/tmp/ccF1OhPy.s:6606: Error: unrecognized opcode `ctcmsa $1,$t0'
/tmp/ccF1OhPy.s:6656: Warning: tried to set unrecognized symbol: msa
/tmp/ccF1OhPy.s:6658: Error: unrecognized opcode `cfcmsa $2,$0'
Makefile:1625: recipe for target 'priv/libvex_mips64_linux_a-guest_mips_helpers.o' failed
make[3]: *** [priv/libvex_mips64_linux_a-guest_mips_helpers.o] Error 1
...

Youling,
Thanks.


_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux