Re: GCC-BPF triggers double free in libbpf Error: failed to link 'linked_maps2.bpf.o': Cannot allocate memory (12)

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

 



On Wed, Mar 22, 2023 at 9:26 PM James Hilliard
<james.hilliard1@xxxxxxxxx> wrote:
>
> I'm seeing this gen object error with gcc does not occur in llvm for a
> bpf test(which uses both linked_maps1.c and linked_maps2.c) in
> bpf-next.
>
> I presume there is a bug in GCC which is triggering a double free bug in libbpf.
>

Could you somehow share .o files for linked_maps1.c and
linked_maps2.c, so I can try to repro locally?

> GCC gen object failure:
>
> ==2125110== Command:
> /home/buildroot/bpf-next/tools/testing/selftests/bpf/tools/sbin/bpftool
> --debug gen object
> /home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/linked_maps.linked1.o
> /home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/linked_maps1.bpf.o
> /home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/linked_maps2.bpf.o
> ==2125110==
> libbpf: linker: adding object file
> '/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/linked_maps1.bpf.o'...
> libbpf: linker: adding object file
> '/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/linked_maps2.bpf.o'...
> Error: failed to link
> '/home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/linked_maps2.bpf.o':
> Cannot allocate memory (12)
> ==2125110== Invalid free() / delete / delete[] / realloc()
> ==2125110==    at 0x484B0C4: free (vg_replace_malloc.c:884)
> ==2125110==    by 0x17F8AB: bpf_linker__free (linker.c:204)
> ==2125110==    by 0x12833C: do_object (gen.c:1608)
> ==2125110==    by 0x12CDAB: cmd_select (main.c:206)
> ==2125110==    by 0x129B53: do_gen (gen.c:2332)
> ==2125110==    by 0x12CDAB: cmd_select (main.c:206)
> ==2125110==    by 0x12DB9E: main (main.c:539)
> ==2125110==  Address 0xda4b420 is 0 bytes after a block of size 0 free'd
> ==2125110==    at 0x484B027: free (vg_replace_malloc.c:883)
> ==2125110==    by 0x484D6F8: realloc (vg_replace_malloc.c:1451)
> ==2125110==    by 0x181FA3: extend_sec (linker.c:1117)
> ==2125110==    by 0x182326: linker_append_sec_data (linker.c:1201)
> ==2125110==    by 0x1803DC: bpf_linker__add_file (linker.c:453)
> ==2125110==    by 0x12829E: do_object (gen.c:1593)
> ==2125110==    by 0x12CDAB: cmd_select (main.c:206)
> ==2125110==    by 0x129B53: do_gen (gen.c:2332)
> ==2125110==    by 0x12CDAB: cmd_select (main.c:206)
> ==2125110==    by 0x12DB9E: main (main.c:539)
> ==2125110==  Block was alloc'd at
> ==2125110==    at 0x484876A: malloc (vg_replace_malloc.c:392)
> ==2125110==    by 0x484D6EB: realloc (vg_replace_malloc.c:1451)
> ==2125110==    by 0x181FA3: extend_sec (linker.c:1117)
> ==2125110==    by 0x182326: linker_append_sec_data (linker.c:1201)
> ==2125110==    by 0x1803DC: bpf_linker__add_file (linker.c:453)
> ==2125110==    by 0x12829E: do_object (gen.c:1593)
> ==2125110==    by 0x12CDAB: cmd_select (main.c:206)
> ==2125110==    by 0x129B53: do_gen (gen.c:2332)
> ==2125110==    by 0x12CDAB: cmd_select (main.c:206)
> ==2125110==    by 0x12DB9E: main (main.c:539)




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux