From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C17CC3858D39; Mon, 15 Nov 2021 01:17:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C17CC3858D39 From: "wcohen at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/103241] New: Odd 0 length entries in location lists Date: Mon, 15 Nov 2021 01:17:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 11.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wcohen at redhat 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Nov 2021 01:17:33 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103241 Bug ID: 103241 Summary: Odd 0 length entries in location lists Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: wcohen at redhat dot com Target Milestone: --- I wrote a dwgrep (https://pmachata.github.io/dwgrep/) script to examine the location lists of function parameters of the kernel and print out each func= tion and parameter that had zero length entries in the location lists: dwgrep /usr/lib/debug/lib/modules/5.14.15-200.fc34.x86_64/vmlinux -e ' let A :=3D entry (?TAG_subprogram) (?AT_ranges || ?AT_low_pc); let FSTART :=3D (A ?AT_ranges @AT_ranges low) || ( A low); let PARM :=3D A child ?TAG_formal_parameter; (PARM ?AT_location @AT_location address length=3D=3D0) ([A name, FSTART, PA= RM name])' | grep \\[ | more Some of the functions in the kernel that were flagged may have been confuse= d by the constant propagation, irsa, or partial inlining optimization. However, There were some functions parameters that included entries with 0 length entries in the location list for the parameter. Focusing on one function, static_protections: ["static_protections", 0xffffffff8107a540, "prot"] ["static_protections", 0xffffffff8107a540, "start"] ["static_protections", 0xffffffff8107a540, "pfn"] ["static_protections", 0xffffffff8107a540, "npg"] ["static_protections", 0xffffffff8107a540, "warnlvl"] Using The following to look at the section of the debuginfo associated with= the function: llvm-dwarfdump -c --name=3D"static_protection" /usr/lib/debug/lib/modules/5.14.15-200.fc34.x86_64/vmlinux | more See the following for static_protection where first entry for "prot" parame= ter is 0 length and overlaps the next entry: 0x00e44d5c: DW_TAG_formal_parameter DW_AT_abstract_origin (0x00e3fb6d "prot") DW_AT_location (0x002c83db:=20 [0xffffffff8107a540, 0xffffffff8107a540): DW_OP_reg5 RDI [0xffffffff8107a540, 0xffffffff8107a569): DW_OP_reg5 RDI, DW_OP_piece 0x8 [0xffffffff8107a5a0, 0xffffffff8107a5f3): DW_OP_reg5 RDI [0xffffffff8107a617, 0xffffffff8107a65b): DW_OP_reg3 RBX [0xffffffff8107a66a, 0xffffffff8107a67e): DW_OP_reg3 RBX, DW_OP_piece 0x8 [0xffffffff8107a67e, 0xffffffff8107a68c): DW_OP_reg5 RDI [0xffffffff8107a68c, 0xffffffff8107a6a1): DW_OP_reg3 RBX, DW_OP_piece 0x8 [0xffffffff8107a6a1, 0xffffffff8107a6a1): DW_OP_reg3 RBX, DW_OP_piece 0x8 [0xffffffff8107a6a1, 0xffffffff8107a6cb): DW_OP_reg3 RBX [0xffffffff8107a6cb, 0xffffffff8107a6cb): DW_OP_reg3 RBX, DW_OP_piece 0x8 [0xffffffff81bc6967, 0xffffffff81bc6994): DW_OP_reg3 RBX, DW_OP_piece 0x8 [0xffffffff81bc69b5, 0xffffffff81bc6a24): DW_OP_reg3 RBX, DW_OP_piece 0x8) DW_AT_unknown_2137 (0x002c83c3) 0x00e44d69: DW_TAG_formal_parameter DW_AT_abstract_origin (0x00e3fb7a "start") DW_AT_location (0x002c84ed:=20 [0xffffffff8107a540, 0xffffffff8107a5a0): DW_OP_reg4 RSI [0xffffffff8107a5a0, 0xffffffff8107a65b): DW_OP_reg12 R12 [0xffffffff8107a65b, 0xffffffff8107a66a): DW_OP_GNU_entry_value(DW_OP_reg4 RSI), DW_OP_s tack_value [0xffffffff8107a66a, 0xffffffff8107a68c): DW_OP_reg4 RSI [0xffffffff8107a68c, 0xffffffff8107a6cb): DW_OP_reg12 R12 [0xffffffff8107a6cb, 0xffffffff8107a6cb): DW_OP_reg4 RSI [0xffffffff81bc6967, 0xffffffff81bc698c): DW_OP_reg4 RSI [0xffffffff81bc698c, 0xffffffff81bc6a24): DW_OP_reg12 R1= 2) DW_AT_unknown_2137 (0x002c84dd) 0x00e44d76: DW_TAG_formal_parameter DW_AT_abstract_origin (0x00e3fb87 "pfn") DW_AT_location (0x002c85a8:=20 [0xffffffff8107a540, 0xffffffff8107a5a0): DW_OP_reg1 RDX [0xffffffff8107a5a0, 0xffffffff8107a65b): DW_OP_reg15 R15 [0xffffffff8107a65b, 0xffffffff8107a66a): DW_OP_GNU_entry_value(DW_OP_reg1 RDX), DW_OP_s tack_value [0xffffffff8107a66a, 0xffffffff8107a68c): DW_OP_reg1 RDX [0xffffffff8107a68c, 0xffffffff8107a6cb): DW_OP_reg15 R15 [0xffffffff8107a6cb, 0xffffffff8107a6cb): DW_OP_reg1 RDX [0xffffffff81bc6967, 0xffffffff81bc6983): DW_OP_reg1 RDX [0xffffffff81bc6983, 0xffffffff81bc6a24): DW_OP_reg15 R1= 5) DW_AT_unknown_2137 (0x002c8598) 0x00e44d83: DW_TAG_formal_parameter DW_AT_abstract_origin (0x00e3fb94 "npg") DW_AT_location (0x002c8663:=20 [0xffffffff8107a540, 0xffffffff8107a5a0): DW_OP_reg2 RCX [0xffffffff8107a5a0, 0xffffffff8107a65b): DW_OP_reg13 R13 [0xffffffff8107a65b, 0xffffffff8107a66a): DW_OP_GNU_entry_value(DW_OP_reg2 RCX), DW_OP_s tack_value [0xffffffff8107a66a, 0xffffffff8107a68c): DW_OP_reg2 RCX [0xffffffff8107a68c, 0xffffffff8107a6cb): DW_OP_reg13 R13 [0xffffffff8107a6cb, 0xffffffff8107a6cb): DW_OP_reg2 RCX [0xffffffff81bc6967, 0xffffffff81bc6977): DW_OP_reg2 RCX [0xffffffff81bc6977, 0xffffffff81bc6a24): DW_OP_reg13 R1= 3) DW_AT_unknown_2137 (0x002c8653) 0x00e44d90: DW_TAG_formal_parameter DW_AT_abstract_origin (0x00e3fba1 "lpsize") DW_AT_location (0x002c8718:=20 [0xffffffff8107a540, 0xffffffff8107a585): DW_OP_reg8 R8 [0xffffffff8107a585, 0xffffffff8107a65b): DW_OP_reg14 R14 [0xffffffff8107a65b, 0xffffffff8107a66a): DW_OP_GNU_entry_value(DW_OP_reg8 R8), DW_OP_st ack_value [0xffffffff8107a66a, 0xffffffff8107a6cb): DW_OP_reg14 R14 [0xffffffff81bc6967, 0xffffffff81bc6a24): DW_OP_reg14 R1= 4) DW_AT_unknown_2137 (0x002c870e) 0x00e44d9d: DW_TAG_formal_parameter DW_AT_abstract_origin (0x00e3fbae "warnlvl") DW_AT_location (0x002c8798:=20 [0xffffffff8107a540, 0xffffffff8107a5a0): DW_OP_reg9 R9 [0xffffffff8107a5a0, 0xffffffff8107a66a): DW_OP_fbreg -72 [0xffffffff8107a66a, 0xffffffff8107a68c): DW_OP_reg9 R9 [0xffffffff8107a68c, 0xffffffff8107a6cb): DW_OP_fbreg -72 [0xffffffff8107a6cb, 0xffffffff8107a6cb): DW_OP_reg9 R9 [0xffffffff81bc6967, 0xffffffff81bc6974): DW_OP_reg9 R9 [0xffffffff81bc6974, 0xffffffff81bc6a24): DW_OP_fbreg -7= 2) DW_AT_unknown_2137 (0x002c878a) It looks like that first "prot" entry [0xffffffff8107a540, 0xffffffff8107a5= 40): DW_OP_reg5 RDI isn't useful as it is 0 length and the next entry covers its start. The entries for [0xffffffff8107a6cb, 0xffffffff8107a6cb) for "start= ", "pfn", "lpsize", and "warnlvl" look questionable as that would be an area outside the function's first entry [0xffffffff8107a540, 0xffffffff8107a6cb). The source code associated with with this function https://elixir.bootlin.com/linux/v5.14.15/source/arch/x86/mm/pat/set_memory= .c#L534 has a struct being passed in and the other cases seem to also have a struct= as the parameter.=