From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 6C08A3857375 for ; Wed, 15 Jun 2022 20:58:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6C08A3857375 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25FHXtw1009843; Wed, 15 Jun 2022 20:58:03 GMT Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gmkkthmrj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Jun 2022 20:58:02 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25FKkCpq031680; Wed, 15 Jun 2022 20:58:01 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2046.outbound.protection.outlook.com [104.47.66.46]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gpqq1pw1d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Jun 2022 20:58:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f2Y1qT16Zbpfah18pMFGzGJlpgGit58rrsOoDI5q/2usn4bEjgzI/Vh7vOEts99M0d1MYK26Qne7TIM3ISzEHspEr8PXebVnRWU/MgZUMIt7a028pfn+6bx2ZhB/O5WZRvuvkiIprTCmzDHAHapPs9AhbE5g1Qh54y/3VMZbQYQ2IIPVicVRBpxE/VDnOVvuceL3bagSBBxYhaylGHQcIrDF+/mRWoU6Ku6bZGV5uyWJkWaZcGSlv6Dz71RiogmGN2qWnwhzp+P0pNV/q7xZ2ylUGoku1pw/L1urUqi4GJQ8p3gu2UXuXRlcbwk0vpgN5xw7/dUOmMMPD9HIk5W9jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YpgXjQjufMGPBVcLL5jiteihUHRPTTBgzTKBYEsjgh0=; b=DcvCfiKC/WpQdXRUpiQojLpEenlAf8L7vFd+cIY7L3sdh14Fjb9nY6KHfi8Zn3lN2251LRoqzvFGw9VwPZSMjK3Ur2CNJMMXHaGGi8Cun+4ahVH7b9iNankkKYZrSkhBFi0mT5yyFgcJwynkGkj9ik5pRwj0YitewT1ymSrFm+BQeT5SZfnqxCPoGClf0jHU/PEtKf3vuSUiufm7UZ5iQ0dzbvg8eUfYop2Flky5SYxc2utO0xrJbcg2jKCFDgJt1vT+zMQPLjvooGxchOoTKGM1TO7noB/FcGcplhPteLOgW6K26aMmOZQQyikxveKoR9kzI7X9ao1/g/iwY3YzLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) by CH2PR10MB4037.namprd10.prod.outlook.com (2603:10b6:610:3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.16; Wed, 15 Jun 2022 20:57:59 +0000 Received: from MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb]) by MN2PR10MB3213.namprd10.prod.outlook.com ([fe80::4939:15e0:57cb:87fb%5]) with mapi id 15.20.5332.022; Wed, 15 Jun 2022 20:57:59 +0000 Message-ID: <9bd41e20-5c39-0d35-bd6e-c10c65280da7@oracle.com> Date: Wed, 15 Jun 2022 13:57:55 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 0/9] Add debug_annotate attributes Content-Language: en-US To: Yonghong Song Cc: jose.marchesi@oracle.com, gcc-patches@gcc.gnu.org References: <20220607214342.19463-1-david.faust@oracle.com> <2ab1d9a1-0077-a1e7-f212-556fcf8c8883@fb.com> From: David Faust In-Reply-To: <2ab1d9a1-0077-a1e7-f212-556fcf8c8883@fb.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BYAPR05CA0095.namprd05.prod.outlook.com (2603:10b6:a03:e0::36) To MN2PR10MB3213.namprd10.prod.outlook.com (2603:10b6:208:131::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 82bc9fef-5481-4baf-1e4c-08da4f11baab X-MS-TrafficTypeDiagnostic: CH2PR10MB4037:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6PhUy6KmL/X8cMtGcaibScy+8dD2O+bRhgffxEMzNKKi5oQnhpPjR0D7fODiZwijMTa/qnDvXtmJ+k+jhcuJed0g48Wc2dTVKq/KZgXrpdbMVA/x9mmavC60f9aY6AmPoVs6Jkg12bl7TEMhZwn7+vfzBpkD11uGq7qS0ByYn4j8on+dUzGTieqAKAsa+iUol0hlqeuvMdbs9Bo/tOixqbGnjXTCC/h9A2oqbysh631Be05X6cVD6Ji+kSfGhYV7UTZAb7fLRz0UJLUlgW1FS1Kj/9KX+tx6nL1VCCERoNnu/QLKBmIaEUFmd1p9RYO70/jgun72/VUjHWummOhbz/j7gSIhCF1nVzNb+G+YrMJRa2EFis+7vYDNrcC0ut0r2Ez1x1iY4wPOrZeFjP3Lvs6tdhzZB9Anf4xd7bMFQNyCCgEKgAxtZiJwsYZEdPDml2ltJx7JzX9L2ZXZI8NPdms8wYpa1u/r9Z75dLHpimFQNUaygPG8saJLO3zGH8rWV8Yjn3qHMcazo/uRQsVfC6+0Qgfb3RElVh1+DEFjWYjLzJi3MfDU4hj+HuABMznRz1rY5/L3WrO6iO2OfgZ0ILhmZo0d+NFCzgUD+2dMjuLmZSRy2+GmQ0abTOh+VMUscvmkMs2aaOHUZlG9mt7b1cuXT++hMBM7p0XhYy8FGbG9ATLVbe7HlGcQQhO2mmjkWKZ8VE/ZxCbDvqtJHot3O++mfFwkf5M0QIIzLly4C1W/t+lPTtVs0NHSZaOgbO/3EbWyRGnNXx1UKZdJY4frWXZW1u56hvHfC+5a+urEUqWA2tujliL7oayYQ5R+cdBFGv+fZC1I+SQAKKjdb7z9v4MiD80yVBsJ4fykNpTYoJ0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR10MB3213.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(31696002)(6506007)(6512007)(2616005)(6916009)(2906002)(53546011)(66476007)(6666004)(4326008)(316002)(36756003)(8676002)(31686004)(66946007)(66556008)(38100700002)(8936002)(6486002)(86362001)(966005)(44832011)(186003)(508600001)(5660300002)(83380400001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VDRNRTdhaFB1bEtFTWNuQWg2bDlCTEU5dVZSVmd1YUswY0s1MHdCTEdzVXoz?= =?utf-8?B?NWtwTi85WHRLeVZIWnN1WlY1Umx6SW1TNTBub3F6cVZDYVRKbVg2SUJLTD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DJ4cFgrYnYwNWthZXhxLytla2k4cEJBSU9GSnhFZTltUzUx?= =?utf-8?B?QTNoRjNLZHVvRVFWZVpvc3lYU0I3cE5MYk5MQmhCZ0NKaXdaK3dsRU42RkdL?= =?utf-8?B?NTBGOGV1dTlVNXZ0TEU5ZVlJU216MHp2d1dDN01ybnlpckd1M0o5bGdEQ3V2?= =?utf-8?B?SmZ2Z29FZDBjQjZEQ3Rabk1mZG9UZGJoT2dnc1VHZVFlZzRuNFRxV3cxWmJx?= =?utf-8?B?ZXpTSjh1NDJzdGIzUmRUK0s4c2FPdFdDb2FYSkp1RFl5akZsM2NtSUcwT0N3?= =?utf-8?B?SEN5Z2lZVmpjQi9HRVdWQjdZei9KYUViM1hWci85dXI3S2RjMlo1NHpkK3FP?= =?utf-8?B?ckc2bk1hRGtaSG9aaHZvQ01ZNXZBSTY3TXZUZjU1bmlmeXVQTDFwNkV1Qnls?= =?utf-8?B?b1AybDlodFZkdDhOaUZETklNSTI0c3FTVFVXN1NMVG9rNGZPS1pkNWw5VUJF?= =?utf-8?Q?9Mo2CwB5ArRbhBJV+uT6nxtYyKk/WsmqyG+He?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82bc9fef-5481-4baf-1e4c-08da4f11baab X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB3213.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2022 20:57:59.2723 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Y+GtBKK99Mb8g3afzxo1RlU45fauH4i9pgGLABJZ9FAAr2HO7Z45Rz5p0to3KZV89f9Izym0O5mL0gWcg9LJXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4037 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517, 18.0.874 definitions=2022-06-15_07:2022-06-15, 2022-06-15 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 bulkscore=0 spamscore=0 phishscore=0 adultscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206150075 X-Proofpoint-GUID: IHgagKvbWhf5BVC2cVnrqYmeb2RuyVsq X-Proofpoint-ORIG-GUID: IHgagKvbWhf5BVC2cVnrqYmeb2RuyVsq X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jun 2022 20:58:07 -0000 On 6/14/22 22:53, Yonghong Song wrote: > > > On 6/7/22 2:43 PM, David Faust wrote: >> Hello, >> >> This patch series adds support for: >> >> - Two new C-language-level attributes that allow to associate (to "annotate" or >> to "tag") particular declarations and types with arbitrary strings. As >> explained below, this is intended to be used to, for example, characterize >> certain pointer types. >> >> - The conveyance of that information in the DWARF output in the form of a new >> DIE: DW_TAG_GNU_annotation. >> >> - The conveyance of that information in the BTF output in the form of two new >> kinds of BTF objects: BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG. >> >> All of these facilities are being added to the eBPF ecosystem, and support for >> them exists in some form in LLVM. >> >> Purpose >> ======= >> >> 1) Addition of C-family language constructs (attributes) to specify free-text >> tags on certain language elements, such as struct fields. >> >> The purpose of these annotations is to provide additional information about >> types, variables, and function parameters of interest to the kernel. A >> driving use case is to tag pointer types within the linux kernel and eBPF >> programs with additional semantic information, such as '__user' or '__rcu'. >> >> For example, consider the linux kernel function do_execve with the >> following declaration: >> >> static int do_execve(struct filename *filename, >> const char __user *const __user *__argv, >> const char __user *const __user *__envp); >> >> Here, __user could be defined with these annotations to record semantic >> information about the pointer parameters (e.g., they are user-provided) in >> DWARF and BTF information. Other kernel facilites such as the eBPF verifier >> can read the tags and make use of the information. >> >> 2) Conveying the tags in the generated DWARF debug info. >> >> The main motivation for emitting the tags in DWARF is that the Linux kernel >> generates its BTF information via pahole, using DWARF as a source: >> >> +--------+ BTF BTF +----------+ >> | pahole |-------> vmlinux.btf ------->| verifier | >> +--------+ +----------+ >> ^ ^ >> | | >> DWARF | BTF | >> | | >> vmlinux +-------------+ >> module1.ko | BPF program | >> module2.ko +-------------+ >> ... >> >> This is because: >> >> a) Unlike GCC, LLVM will only generate BTF for BPF programs. >> >> b) GCC can generate BTF for whatever target with -gbtf, but there is no >> support for linking/deduplicating BTF in the linker. >> >> In the scenario above, the verifier needs access to the pointer tags of >> both the kernel types/declarations (conveyed in the DWARF and translated >> to BTF by pahole) and those of the BPF program (available directly in BTF). >> >> Another motivation for having the tag information in DWARF, unrelated to >> BPF and BTF, is that the drgn project (another DWARF consumer) also wants >> to benefit from these tags in order to differentiate between different >> kinds of pointers in the kernel. >> >> 3) Conveying the tags in the generated BTF debug info. >> >> This is easy: the main purpose of having this info in BTF is for the >> compiled eBPF programs. The kernel verifier can then access the tags >> of pointers used by the eBPF programs. >> >> >> For more information about these tags and the motivation behind them, please >> refer to the following linux kernel discussions: >> >> https://lore.kernel.org/bpf/20210914223004.244411-1-yhs@fb.com/ >> https://lore.kernel.org/bpf/20211012164838.3345699-1-yhs@fb.com/ >> https://lore.kernel.org/bpf/20211112012604.1504583-1-yhs@fb.com/ >> >> >> Implementation Overview >> ======================= >> >> To enable these annotations, two new C language attributes are added: >> __attribute__((debug_annotate_decl("foo"))) and >> __attribute__((debug_annotate_type("bar"))). Both attributes accept a single >> arbitrary string constant argument, which will be recorded in the generated >> DWARF and/or BTF debug information. They have no effect on code generation. >> >> Note that we are not using the same attribute names as LLVM (btf_decl_tag and >> btf_type_tag, respectively). While these attributes are functionally very >> similar, they have grown beyond purely BTF-specific uses, so inclusion of "btf" >> in the attribute name seems misleading. >> >> DWARF support is enabled via a new DW_TAG_GNU_annotation. When generating DWARF, >> declarations and types will be checked for the corresponding attributes. If >> present, a DW_TAG_GNU_annotation DIE will be created as a child of the DIE for >> the annotated type or declaration, one for each tag. These DIEs link the >> arbitrary tag value to the item they annotate. >> >> For example, the following variable declaration: >> >> #define __typetag1 __attribute__((debug_annotate_type ("typetag1"))) >> >> #define __decltag1 __attribute__((debug_annotate_decl ("decltag1"))) >> #define __decltag2 __attribute__((debug_annotate_decl ("decltag2"))) >> >> int * __typetag1 x __decltag1 __decltag2; > > Based on the above example > static int do_execve(struct filename *filename, > const char __user *const __user *__argv, > const char __user *const __user *__envp); > > Should the above example should be the below? > int __typetag1 * x __decltag1 __decltag2 > This example is not related to the one above. It is just meant to show the behavior of both attributes. My apologies for not making that clear. >> >> Produces the following DWARF information: >> >> <1><1e>: Abbrev Number: 3 (DW_TAG_variable) >> <1f> DW_AT_name : x >> <21> DW_AT_decl_file : 1 >> <22> DW_AT_decl_line : 7 >> <23> DW_AT_decl_column : 18 >> <24> DW_AT_type : <0x49> >> <28> DW_AT_external : 1 >> <28> DW_AT_location : 9 byte block: 3 0 0 0 0 0 0 0 0 (DW_OP_addr: 0) >> <32> DW_AT_sibling : <0x49> >> <2><36>: Abbrev Number: 1 (User TAG value: 0x6000) >> <37> DW_AT_name : (indirect string, offset: 0xd6): debug_annotate_decl >> <3b> DW_AT_const_value : (indirect string, offset: 0xcd): decltag2 >> <2><3f>: Abbrev Number: 1 (User TAG value: 0x6000) >> <40> DW_AT_name : (indirect string, offset: 0xd6): debug_annotate_decl >> <44> DW_AT_const_value : (indirect string, offset: 0x0): decltag1 >> <2><48>: Abbrev Number: 0 >> <1><49>: Abbrev Number: 4 (DW_TAG_pointer_type) >> <4a> DW_AT_byte_size : 8 >> <4b> DW_AT_type : <0x5d> >> <4f> DW_AT_sibling : <0x5d> >> <2><53>: Abbrev Number: 1 (User TAG value: 0x6000) >> <54> DW_AT_name : (indirect string, offset: 0x9): debug_annotate_type >> <58> DW_AT_const_value : (indirect string, offset: 0x1d): typetag1 >> <2><5c>: Abbrev Number: 0 >> <1><5d>: Abbrev Number: 5 (DW_TAG_base_type) >> <5e> DW_AT_byte_size : 4 >> <5f> DW_AT_encoding : 5 (signed) >> <60> DW_AT_name : int >> <1><64>: Abbrev Number: 0 > > Maybe you can also show what dwarf debug_info looks like I am not sure what you mean. This is the .debug_info section as output by readelf -w. I did trim some information not relevant to the discussion such as the DW_TAG_compile_unit DIE, for brevity. > >> >> In the case of BTF, the annotations are recorded in two type kinds recently >> added to the BTF specification: BTF_KIND_DECL_TAG and BTF_KIND_TYPE_TAG. >> The above example declaration prodcues the following BTF information: >> >> [1] INT 'int' size=4 bits_offset=0 nr_bits=32 encoding=SIGNED >> [2] PTR '(anon)' type_id=3 >> [3] TYPE_TAG 'typetag1' type_id=1 >> [4] DECL_TAG 'decltag1' type_id=6 component_idx=-1 >> [5] DECL_TAG 'decltag2' type_id=6 component_idx=-1 >> [6] VAR 'x' type_id=2, linkage=global >> [7] DATASEC '.bss' size=0 vlen=1 >> type_id=6 offset=0 size=8 (VAR 'x') >> >> > [...]