From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A2BF7385781A; Thu, 23 Mar 2023 04:06:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A2BF7385781A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679544362; bh=ydAhOCuu+KTb+KnXjfir5ej1UzbMQRp35RKc8dAQTi8=; h=From:To:Subject:Date:From; b=SuSdUWHnK14Y19PDa1ZiW5qmQBC004Vqf7BcijlBDGNjKp0r54Nxjh9p2KH5IMTOb ugR99kPt+dSQLfWzYjyFhBwk6I9MupdX8QGXtb0JAfOPvAo7Oc4KJolqhydYDvrUN2 lC6XK6d5au4fkf2o1RJTq++SBD+UUAP7H9BeiC3g= From: "james.hilliard1 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109256] New: Error: failed to link 'linked_maps2.bpf.o': Cannot allocate memory (12) Date: Thu, 23 Mar 2023 04:06:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: james.hilliard1 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109256 Bug ID: 109256 Summary: Error: failed to link 'linked_maps2.bpf.o': Cannot allocate memory (12) Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: james.hilliard1 at gmail dot com Target Milestone: --- I'm seeing this gen object error which does not occur in llvm for a bpf test(which uses both linked_maps1.c and linked_maps2.c) in bpf-next. It seems this is triggering a double free in libbpf, not entirely clear if = this is a gcc issue or libbpf issue. GCC gen object failure: =3D=3D2125110=3D=3D Command: /home/buildroot/bpf-next/tools/testing/selftests/bpf/tools/sbin/bpftool --d= ebug gen object /home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/linked_maps.li= nked1.o /home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/linked_maps1.b= pf.o /home/buildroot/bpf-next/tools/testing/selftests/bpf/bpf_gcc/linked_maps2.b= pf.o =3D=3D2125110=3D=3D=20 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) =3D=3D2125110=3D=3D Invalid free() / delete / delete[] / realloc() =3D=3D2125110=3D=3D at 0x484B0C4: free (vg_replace_malloc.c:884) =3D=3D2125110=3D=3D by 0x17F8AB: bpf_linker__free (linker.c:204) =3D=3D2125110=3D=3D by 0x12833C: do_object (gen.c:1608) =3D=3D2125110=3D=3D by 0x12CDAB: cmd_select (main.c:206) =3D=3D2125110=3D=3D by 0x129B53: do_gen (gen.c:2332) =3D=3D2125110=3D=3D by 0x12CDAB: cmd_select (main.c:206) =3D=3D2125110=3D=3D by 0x12DB9E: main (main.c:539) =3D=3D2125110=3D=3D Address 0xda4b420 is 0 bytes after a block of size 0 f= ree'd =3D=3D2125110=3D=3D at 0x484B027: free (vg_replace_malloc.c:883) =3D=3D2125110=3D=3D by 0x484D6F8: realloc (vg_replace_malloc.c:1451) =3D=3D2125110=3D=3D by 0x181FA3: extend_sec (linker.c:1117) =3D=3D2125110=3D=3D by 0x182326: linker_append_sec_data (linker.c:1201) =3D=3D2125110=3D=3D by 0x1803DC: bpf_linker__add_file (linker.c:453) =3D=3D2125110=3D=3D by 0x12829E: do_object (gen.c:1593) =3D=3D2125110=3D=3D by 0x12CDAB: cmd_select (main.c:206) =3D=3D2125110=3D=3D by 0x129B53: do_gen (gen.c:2332) =3D=3D2125110=3D=3D by 0x12CDAB: cmd_select (main.c:206) =3D=3D2125110=3D=3D by 0x12DB9E: main (main.c:539) =3D=3D2125110=3D=3D Block was alloc'd at =3D=3D2125110=3D=3D at 0x484876A: malloc (vg_replace_malloc.c:392) =3D=3D2125110=3D=3D by 0x484D6EB: realloc (vg_replace_malloc.c:1451) =3D=3D2125110=3D=3D by 0x181FA3: extend_sec (linker.c:1117) =3D=3D2125110=3D=3D by 0x182326: linker_append_sec_data (linker.c:1201) =3D=3D2125110=3D=3D by 0x1803DC: bpf_linker__add_file (linker.c:453) =3D=3D2125110=3D=3D by 0x12829E: do_object (gen.c:1593) =3D=3D2125110=3D=3D by 0x12CDAB: cmd_select (main.c:206) =3D=3D2125110=3D=3D by 0x129B53: do_gen (gen.c:2332) =3D=3D2125110=3D=3D by 0x12CDAB: cmd_select (main.c:206) =3D=3D2125110=3D=3D by 0x12DB9E: main (main.c:539)=