From patchwork Mon Jul 14 07:59:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu-Ianculescu X-Patchwork-Id: 116218 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2BE443858435 for ; Mon, 14 Jul 2025 08:01:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BE443858435 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2025-04-25 header.b=rj4PUbu5; dkim=pass (1024-bit key, unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=vcpgu/Mm X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id C4B3B3858C31 for ; Mon, 14 Jul 2025 08:00:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C4B3B3858C31 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C4B3B3858C31 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480021; cv=pass; b=C6K4+CCZTCRqZhQ33u7oc4b0lbM4MNX4Z9q4uIfPfamII11cJXggkTcPYfw6DU2B05FELhmmcSD3VaGGvFVskVuegBoz19Wlx3bpwh9YxBJXg/NlthynNJNkgc72bAHNYjk07ts708G7xXo1QWefHyDCXHUcGQ4eBtMpOE//smI= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480021; c=relaxed/simple; bh=9VxGuPGTMaZUYfYV7VR63KRf4/yA5FzLgLo2rpak7Lc=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=K7ifznlUfQ/AN+bLnq3Zy5dy05+NO1nvAHmgMdryiAaGlnzpNyPZMzO60ZHbg6C2Dm0YEIMPHIwxM3jFWn312bdZRuo59oYkk5oUssVckwN1u11f2nAG3BP6tkhJhB1uf350sWHkMT2aeQiLpg5itZzzKmkuYvK7mIU8CgQQ/k0= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4B3B3858C31 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56E5Z3gt006757; Mon, 14 Jul 2025 08:00:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2025-04-25; bh=1RUdJp3I8nHwoXCAYAH6fV5eObtOTY8H/iF/X3S3svU=; b= rj4PUbu5A/HYRpJ/Y41Zu+n7kNI/hMqbzgrE0VBMGrLZy0yCUloCatPVszfYtCeV 4pWuoXIkhQjcLITrNVlqvsO0xhGnAJbSsi2dllWwtV2gRDDaQIvomhiWH15Av588 yzq0HZ0j3nRR+4FCtBwIUcKBWdhdlvP2E66OIvPZQWj/VGZPP8+QC/AUDhH1lbiM LuJjyxCI4B9X/BlzA4VhOhuGtRgbYfgdm437tYU2Vjbla1bNGhW7zAhBleTsy6Wt qlUw4E6DJFkg88qS4/YWr0bDeTT7xr9HWbpDyZ519KtIwlDMZ1sJvnV32fpkuTkZ l3xYlb8E9wuF6cWnrVhgtg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 47ujr0uk6m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:18 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 56E66Q6q040507; Mon, 14 Jul 2025 08:00:17 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12on2040.outbound.protection.outlook.com [40.107.244.40]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 47ue588ucb-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TpiNqi2liyktfx62YDWXIC0cJKNLILCWX6KPk0FE8BN66+112pgvAqjAF02ylDBxN9lu1wbUzhbADOeGtpuCrHFbI6uCf+lJmO4J9IAVWeK9O08PR1Bndanff7vdalyhGbTrauOeUF3MPyjFRnH7HoT8QWV2Rc18LA78KpXQ6qReWW04VCo8xk2MGu0glsq5rkKWjFXva0em+cFsgQyERiINOqR+PavO2an4nXe/93uxQT7/4ItaYs3jSTw9ChMHXi84xgKZZ1LNSDeWvokPk7xITdCUIFuRQwGbOjAFRlAINwaMDT8vXl2iEA7sNL3KojoXm3E6t572fXMPvJE96g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=1RUdJp3I8nHwoXCAYAH6fV5eObtOTY8H/iF/X3S3svU=; b=Jxg8g0lwZcBIEYMVnL4A+Nw/BoX0hSrKLxwGBahLImb+At2eBFc3TMNbIJLCUPCGwA9wOFaqcaK7hMX0XjVcLzbqc6uwqkzOeoi+HwJR6XI3HlhVyGRLf6TO00g98NkiYogvu+svRFp4JevfHNz77vSqQzkObKmcGCYU9E94UDVSUfhH3ot4hp+y/Fnh5jW9Z94ywOzHPO0hu2SeF+tVP2A4vwbUNoSnXR9Y8ZiVhu9dk/Zo+gftz8CB04wlkxY+jM/nLNa6FBMO4einGxqfZWRyBK20qJbsU2iYE3rTuHloEtpHeqT+/QibZVGlw+LAU0kQy7Y8CxfV/cGZGWSjJg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1RUdJp3I8nHwoXCAYAH6fV5eObtOTY8H/iF/X3S3svU=; b=vcpgu/MmiIYRPXef2fRYKeoe9w8ei+y11OUlQ6Eim0ns4pHXYM3dznJwXDy3iFm65ICyXApQL7xBzdKvt/vbYTTcjd/0Dl93LJXMwmbqE/g/I51HKKTbxVQRNbwZKPfmtGun3viQNIiOqp7IG0FfhzI8ZMb6u1VY/i24x35fqEc= Received: from DS7PR10MB5998.namprd10.prod.outlook.com (2603:10b6:8:9e::20) by MN6PR10MB7443.namprd10.prod.outlook.com (2603:10b6:208:46f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.35; Mon, 14 Jul 2025 07:59:54 +0000 Received: from DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed]) by DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed%5]) with mapi id 15.20.8922.028; Mon, 14 Jul 2025 07:59:53 +0000 From: claudiu.zissulescu-ianculescu@oracle.com To: libc-alpha@sourceware.org Cc: jose.marchesi@oracle.com, elena.zannoni@oracle.com, indu.bhagat@oracle.com, jremus@linux.ibm.com, dj@redhat.com, adhemerval.zanella@linaro.org, fweimer@redhat.com Subject: [PATCH v8 1/6] elf: Add SFrame support to _dl_find_object function Date: Mon, 14 Jul 2025 10:59:21 +0300 Message-ID: <20250714075926.34870-2-claudiu.zissulescu-ianculescu@oracle.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250714075926.34870-1-claudiu.zissulescu-ianculescu@oracle.com> References: <20250714075926.34870-1-claudiu.zissulescu-ianculescu@oracle.com> X-ClientProxiedBy: VI1PR06CA0166.eurprd06.prod.outlook.com (2603:10a6:803:c8::23) To CY5PR10MB6011.namprd10.prod.outlook.com (2603:10b6:930:28::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5998:EE_|MN6PR10MB7443:EE_ X-MS-Office365-Filtering-Correlation-Id: cef44c06-60cc-46a9-36d3-08ddc2ac62ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: r4YpAT+yLvK/fRMqHIqVqGefQrp4wZUWKK+OIt/UE1FRuiTJA9LfcKhja1tQkPCiB/1ebgdtCh9V83SMxCcci6grhKOoltHHPNBtoGay2fMMskOXe8EqJfqZPwMQ2WmqMwRxrBV7F6NCAUGtnBeQoB0QoUalVxuQ23II4y4y9OT7opQMs28t4J/7NmD0IFU1fEtbmhRFEeuh6pN8gNna3eWI6KwqDAmmFQcp0Z19rZtRdj3VEI/iVWha2o+Xbu37C6GZxhDmOjkJByCDDTluwcz156SWuZzjNBTvLXAogwiY6Hx+y3V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6fXEpqGF3430qR0rnHhWjL+8AhL8WumZsiukugy5LhmVuDap69s6H6SLTk/l1z6yz8VkRpI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS7PR10MB5998.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cLUGr+9M8BundkPEV/SYrAtDXKQV2vH5ly3imLOV65sQRwG65IbuIYVp1QTLJfYnPKQtO+ut5KZw0r9jg7em3CbvK4IKkaHoQ7kGEqs4GeclhccqijTYxbtoX772qO+TTztS4JWN/1qYP9q5YKtuYUS920ujx0rFy47jcaOjQiNeo/NzkpdAW3l38iVx12Y0NVlKbLSSHF+iKjyfefIM07RxB6D9gPX3u4f4Z/3U19QApatVl80y+lS0JW8p8tiwBXbadOdQDb+gbxvyLrf3TIhPlmmaiRdH8Wb5isG7iRJbIOtsyLJUjuamVLOq1cgKqQ8g2Bc7T4VvorTHpW8TZGqfTQluikbQz0QI3nQF2vVx6/jYMWrinu0YmyaCA+WK2S242xYpBxpTD7JVJHcG2f60qfVWVmNDIdxkKvjyR9h72DRf3LuObuu3EzdweKZFyqqR8U11B4N2vsdbJD2e5QUuLu9YQ4T9w4vv9c0/iJYgWWP7FptSG4W7lJV7zILOMSmtsGpSRwGaJzhzfhfCpwy5GW1kcJlbNE7Hr6zj7dM6i/dw6GAmw7o2y8Rzh8GTCH3+0NTRSS9aKQp8NEl1qfs6ME7Cyd96+HnH4VBr8vY+b1+tPwCvhOTeaFWOzZhsd4OYCKG9mH4pp6+j2mW3AoKLhrvmg2x6cJPeMcGRYg81VM3B86P5t2RafYyji61Lj2xi1Sh4toGnCriJDOfC+mEYRxI5N4OHSDCUAriZtFe8dkt76HxGKHHP/yRJMb42IsyKzsgLQ7FXTDNunALs0JZzETDWnH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TXlIC09pNjaLDs1GWIJ3fukOnXEVekyUNQWVqcEq6R1PhKyCa1NXT9pAh8HBd1vq5/X5ZAYcl2DlvYE8ApWIjeGq3rZNj82L2+zZ7ftdXd3wJg0uUgIMtQFl4EnrT3E3RtXoSRsZEdZ2YoZmo7O8aMFfUhmJdS6faYliQH+IBBb+Np4rbfGw6ggb93FgOrjOgQkCpqHcRRF5iqPBcjlkwiCskDk57yjVNETXmIb7vnmpZmrtIm2rIZ3l2oXaUWr64NgFYRwoVl04ehm4bDlgm4MKv+qvZtT5aEvLuv/AYvBNez1DlKSmZNxCoQQ4t5EnNhgrUgPcEGEWo68ki/cQ4fwLq9ZRZUxiIFqhEN9p7RRmQRwDfRa3VEQRs2CqUlUDDJ2stSpdISVBsbt+pmqk/gxldyMyxx/+Qc98ybRud2Z3462wWza0jq9rvcM3wPsbQev4AW2jlDfP3/AMV2yqRrh6is/5AVoF8Wk27MiTg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: cef44c06-60cc-46a9-36d3-08ddc2ac62ec X-MS-Exchange-CrossTenant-AuthSource: CY5PR10MB6011.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2025 07:59:53.8888 (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: UDJEFNC4OAGmP/vmS7dsAfHeIxMD4wMkfn3c8/mjPRfyewjk8OKvCHN+sz1EW8mLH9X7SQSPMYLKLJbNket87w0nJf/eSyVs8RB8M+V00Pvq3PZ+DoJ7tREnyIdS/sfPpQeniJ3/YxFyS9y0AJabmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR10MB7443 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-09_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2507140046 X-Authority-Analysis: v=2.4 cv=d9T1yQjE c=1 sm=1 tr=0 ts=6874b912 b=1 cx=c_pps a=e1sVV491RgrpLwSTMOnk8w==:117 a=e1sVV491RgrpLwSTMOnk8w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=Wb1JkmetP80A:10 a=GoEa3M9JfhUA:10 a=yPCof4ZbAAAA:8 a=h_Blgzv6WJHfIOoWkc0A:9 cc=ntf awl=host:13600 X-Proofpoint-ORIG-GUID: j4wxg1vKrkKWGw5-529LmXm6vjpikVNn X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA0NiBTYWx0ZWRfXy28KefRqMTEh iPrNDdS7deRN5qVj2zg/jFe82KRufUM38xi/FnPnzb18z1xbEmwqTk79VMxMftY7kRpTFKH79tQ CQafqvYMeHVsM1WBHw8KQYDQPFNF9WEJLKMj+GwlOcWvkrRlbzn3b3thOg4lJK7d9JuBTu2nDU7 cyD4hpgYF61pF0XOY+/3+dlhfZEQ29Q3AL4TPza+JjpO+YqXRSYOiL2Alv3Nb+i6tkBJVhrv9L2 FpDEDvbSfOhbSHkcUZBvvIvBdZrVSuH5Sbbc9rAUiPLD8BExzxbBy9X6hbdxFQs/34AlhhrMD1k B3uoYcE8iYJWZrE8GcJWgZQYzFm5vKHeUCuWaaJvcDHCGbi2MYiQo3wWwmUM/ubs9iWQMwG3NBX o/895WxxIKvnqpQ6AD/PiXK2+02z9skYvjytN0npx1IsWfzmoGf+/hjJCzLYHZgVNxySeGrA X-Proofpoint-GUID: j4wxg1vKrkKWGw5-529LmXm6vjpikVNn X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_NONE, TXREP 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Claudiu Zissulescu The SFrame provides information to be able to do stack trace is now well defined and implemented in Binutils 2.41. The format simply contains enough information to be able to do stack trace given a program counter (PC) value, the stack pointer, and the frame pointer. The SFrame information is stored in a .sframe ELF section, which is loaded into its own PT_GNU_SFRAME segment. We consider for this support SFrame version 2. This patch adds the bits to _dl_find_object to recognize and store in struct dl_find_object the necessary info about SFrame section. Signed-off-by: Claudiu Zissulescu --- dlfcn/dlfcn.h | 10 +++++++-- elf/dl-find_object.h | 52 +++++++++++++++++++++++++++++++++----------- manual/dynlink.texi | 17 ++++++++++++++- 3 files changed, 63 insertions(+), 16 deletions(-) diff --git a/dlfcn/dlfcn.h b/dlfcn/dlfcn.h index 4c2bdf9b64..bc73180a20 100644 --- a/dlfcn/dlfcn.h +++ b/dlfcn/dlfcn.h @@ -217,15 +217,21 @@ struct dl_find_object int dlfo_eh_count; /* Number of exception handling entries. */ unsigned int __dlfo_eh_count_pad; # endif - __extension__ unsigned long long int __dflo_reserved[7]; + void *dlfo_sframe; /* SFrame stack trace data of the object. */ +#if __WORDSIZE == 32 + unsigned int __dlfo_sframe_pad; +#endif + __extension__ unsigned long long int __dlfo_reserved[6]; }; /* If ADDRESS is found in an object, fill in *RESULT and return 0. Otherwise, return -1. */ int _dl_find_object (void *__address, struct dl_find_object *__result) __THROW; -#endif /* __USE_GNU */ +/* SFrame stack trace data is valid. */ +#define DLFO_FLAG_SFRAME (1ULL << 0) +#endif /* __USE_GNU */ __END_DECLS diff --git a/elf/dl-find_object.h b/elf/dl-find_object.h index e433ff8740..9aa2439eaa 100644 --- a/elf/dl-find_object.h +++ b/elf/dl-find_object.h @@ -43,6 +43,7 @@ struct dl_find_object_internal #if DLFO_STRUCT_HAS_EH_COUNT int eh_count; #endif + void *sframe; }; /* Create a copy of *SOURCE in *COPY using relaxed MO loads and @@ -67,13 +68,14 @@ _dl_find_object_internal_copy (const struct dl_find_object_internal *source, atomic_store_relaxed (©->eh_count, atomic_load_relaxed (&source->eh_count)); #endif + atomic_store_relaxed (©->sframe, + atomic_load_relaxed (&source->sframe)); } static inline void _dl_find_object_to_external (struct dl_find_object_internal *internal, struct dl_find_object *external) { - external->dlfo_flags = 0; external->dlfo_map_start = (void *) internal->map_start; external->dlfo_map_end = (void *) internal->map_end; external->dlfo_link_map = internal->map; @@ -84,6 +86,11 @@ _dl_find_object_to_external (struct dl_find_object_internal *internal, # if DLFO_STRUCT_HAS_EH_COUNT external->dlfo_eh_count = internal->eh_count; # endif + external->dlfo_sframe = internal->sframe; + if (internal->sframe != NULL) + external->dlfo_flags = DLFO_FLAG_SFRAME; + else + external->dlfo_flags = 0; } /* Extract the object location data from a link map and writes it to @@ -92,6 +99,9 @@ static void __attribute__ ((unused)) _dl_find_object_from_map (struct link_map *l, struct dl_find_object_internal *result) { + /* A mask to find out which segment has been read out. */ + unsigned int read_seg = 0; + atomic_store_relaxed (&result->map_start, (uintptr_t) l->l_map_start); atomic_store_relaxed (&result->map_end, (uintptr_t) l->l_map_end); atomic_store_relaxed (&result->map, l); @@ -100,23 +110,39 @@ _dl_find_object_from_map (struct link_map *l, atomic_store_relaxed (&result->eh_dbase, (void *) l->l_info[DT_PLTGOT]); #endif - for (const ElfW(Phdr) *ph = l->l_phdr, *ph_end = l->l_phdr + l->l_phnum; - ph < ph_end; ++ph) - if (ph->p_type == DLFO_EH_SEGMENT_TYPE) - { - atomic_store_relaxed (&result->eh_frame, - (void *) (ph->p_vaddr + l->l_addr)); + /* Initialize object's exception handling segment and SFrame segment + data. */ + atomic_store_relaxed (&result->sframe, NULL); + atomic_store_relaxed (&result->eh_frame, NULL); #if DLFO_STRUCT_HAS_EH_COUNT - atomic_store_relaxed (&result->eh_count, ph->p_memsz / 8); + atomic_store_relaxed (&result->eh_count, 0); #endif - return; - } - /* Object has no exception handling segment. */ - atomic_store_relaxed (&result->eh_frame, NULL); + for (const ElfW(Phdr) *ph = l->l_phdr, *ph_end = l->l_phdr + l->l_phnum; + ph < ph_end; ++ph) + { + switch (ph->p_type) + { + case DLFO_EH_SEGMENT_TYPE: + atomic_store_relaxed (&result->eh_frame, + (void *) (ph->p_vaddr + l->l_addr)); #if DLFO_STRUCT_HAS_EH_COUNT - atomic_store_relaxed (&result->eh_count, 0); + atomic_store_relaxed (&result->eh_count, ph->p_memsz / 8); #endif + read_seg |= 1; + break; + + case PT_GNU_SFRAME: + atomic_store_relaxed (&result->sframe, + (void *) (ph->p_vaddr + l->l_addr)); + read_seg |= 2; + /* Fall through. */ + default: + break; + } + if (read_seg == 3) + return; + } } /* Called by the dynamic linker to set up the data structures for the diff --git a/manual/dynlink.texi b/manual/dynlink.texi index 3a4864f146..cd05107e6c 100644 --- a/manual/dynlink.texi +++ b/manual/dynlink.texi @@ -545,7 +545,8 @@ result data to the caller. @table @code @item unsigned long long int dlfo_flags -Currently unused and always 0. +Bit zero signals if SFrame stack data is valid. See +@code{DLFO_FLAG_SFRAME} below. @item void *dlfo_map_start The start address of the inspected mapping. This information comes from @@ -562,6 +563,11 @@ This member contains a pointer to the link map of the object. This member contains a pointer to the exception handling data of the object. See @code{DLFO_EH_SEGMENT_TYPE} below. +@item void *dlfo_sframe +This member points to the SFrame stack trace data associated with the +object. It is valid only when @code{DLFO_FLAG_SFRAME} is set in +@code{dlfo_flags}; otherwise, it may be null or undefined. + @end table This structure is a GNU extension. @@ -639,6 +645,15 @@ information is processed. This function is a GNU extension. @end deftypefun +The following flag masks are defined for use with @code{dlfo_flags}: + +@table @code +@item DLFO_FLAG_SFRAME +A bit mask used to signal that the object contains SFrame data. See +@code{dlfo_sframe} above. + +@end table + @node Dynamic Linker Hardening @section Avoiding Unexpected Issues With Dynamic Linking From patchwork Mon Jul 14 07:59:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu-Ianculescu X-Patchwork-Id: 116219 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 018253858C54 for ; Mon, 14 Jul 2025 08:02:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 018253858C54 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2025-04-25 header.b=YHnzIDYg; dkim=pass (1024-bit key, unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=VseyRZxS X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id 5BCCC3858C48 for ; Mon, 14 Jul 2025 08:00:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5BCCC3858C48 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5BCCC3858C48 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480026; cv=pass; b=syKSsl5iFhG1r3Nw10+GZl+srXEdQZf2ruSCcxgMX2PGSRHPNKJlAdalcNkLOghRkkPgCBmNUzVswhqPQo1c1yEDx4zwg7YxzmDSwJtCvPHNMtnehumL8vcddR2UiZAli00rILkuJDDyq1afl/LAiFapADgnMRa6TSXBJG3Q6cU= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480026; c=relaxed/simple; bh=UG21KRPSep14+36ee2dEXFDdmk+FRNubbOv7hNtk3vk=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=fQbfbA7wiwLXF1MD6E3U7uhV/1cnqsk14JI+FDHhOKp635TehJhMAlp4H4psrWZ0vWyif7eOTlFriqmQ7CJZyL2eUKYPtd1rY9o0O4ub/BvhpUr9akufOYiYlbiD0sGTF77+0BDWRMwnSoVNXwTGgonwZp9k6uHBrn5OHvQZJws= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5BCCC3858C48 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56E5Z4D7005506; Mon, 14 Jul 2025 08:00:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2025-04-25; bh=i0NARFIiZtUe4eX3ccInzXQ909JPmHx1CygRkiI8BoU=; b= YHnzIDYg9JtkGBSBLPChSd870YsiP5grnmSX+nxvHSZoy2x0qZXMkwg01ahux3Ev /Jzc55qyCGLPliex/93EzqmrUH87XO5QdWQ3iDjZYeuSyWdntaBgrZj5hDojpB5b YSDtnqG0x2ECTLWu0b8vkDVTsfgivXw2G2M/BqgeJBVOngnoVDYNXYh3FV1l0ZRG +4ZnfmH9lvil/stUJNtCeDsC4c5iHvuKc8oRnXCm+ZWor7hEcZ/sEV/NUcwGK2GF Q1Vb5IsjPuCts7Midmugpu93lBWHfcgcHge0U2mDOzqFa8idImPLrtlgXTRSENyw 1sC4A0xqu/XFQCTFMtUFlg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 47ujy4kkyq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:21 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 56E7tB5S028990; Mon, 14 Jul 2025 08:00:20 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12on2081.outbound.protection.outlook.com [40.107.237.81]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 47ue580s5f-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Lr2qdHpsr7YLMCDmyJ0ax1DqrARNel45OXicFg95EySSyBlRSExZLQq5VXppeJK/q15DssVm6aaGWqdgGSVQGh9taENcrnjUBi+7O4LD0DinBYGYtXBMe+XUA+xnscpF1xqtp244t0VWAi7HKiOZ1oPnm5RqaQeY2AZP0YjJi1YHl4dVwgsO1lKrkCc1PsIxe6voi8njhnw/e/yvoTD+GMA8LZRwZviv8pFMOM+UC20BsJpxBmMv+0ijZ672svMRO/ylsjo+kuEUiPJ19gydUNnxIRW+lKuVA8yjRVTykQlykkVH7/L4JpRTsWCsC5kHEFVoMCNgNT+AMx5p+pXwfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=i0NARFIiZtUe4eX3ccInzXQ909JPmHx1CygRkiI8BoU=; b=bFuLwlOitlHY9i2Jmna9dgsHIflg3uyOHS8kWnqy4E82HipxlkHC3GVaixawYcsf0KMFrzyxJb30t3dOy1D2MJ6wntbEumSSsyQaMBewJvW3pEkZZfnpTAeaZrwQtQwz4nxWiTPLlY1+HOIz4/ZnVzM60TFGN4N80A3YTr9ausiIoIlUwnGdRYcBVfWLyPGALfAYkLjgHKFDuMKCjNzjCjxD88VNZRfyZiirAVG2gSCciSxnU4nePbBk15nbqqvV/FmzepHjNsemDYjiTaW+MyxlyYqhP4OlkLFyVpmQItP5w5KCuUsxqXQJr21+o56Fa2clAJm7w+sX5HNIy2bRRg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i0NARFIiZtUe4eX3ccInzXQ909JPmHx1CygRkiI8BoU=; b=VseyRZxSPB57PzPJGiS29EBF0zNmRSlGpb4RvQRNesO0pFBnfn20Klfw10FDX9HuREq1BlMdBj7XzILE3uy+rwSoDdzp6ENoORIaKTbH67xnWYrWxtmSnUlh9uXuPq01ULUXojROIyGzm8/dUfkdU0ruxpdYfpW3KEHZ7UoWm2M= Received: from DS7PR10MB5998.namprd10.prod.outlook.com (2603:10b6:8:9e::20) by MN6PR10MB7443.namprd10.prod.outlook.com (2603:10b6:208:46f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.35; Mon, 14 Jul 2025 08:00:00 +0000 Received: from DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed]) by DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed%5]) with mapi id 15.20.8922.028; Mon, 14 Jul 2025 08:00:00 +0000 From: claudiu.zissulescu-ianculescu@oracle.com To: libc-alpha@sourceware.org Cc: jose.marchesi@oracle.com, elena.zannoni@oracle.com, indu.bhagat@oracle.com, jremus@linux.ibm.com, dj@redhat.com, adhemerval.zanella@linaro.org, fweimer@redhat.com Subject: [PATCH v8 2/6] x86: Add SFrame support for x86 architecture Date: Mon, 14 Jul 2025 10:59:22 +0300 Message-ID: <20250714075926.34870-3-claudiu.zissulescu-ianculescu@oracle.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250714075926.34870-2-claudiu.zissulescu-ianculescu@oracle.com> References: <20250714075926.34870-1-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-2-claudiu.zissulescu-ianculescu@oracle.com> X-ClientProxiedBy: BE0P281CA0008.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:a::18) To CY5PR10MB6011.namprd10.prod.outlook.com (2603:10b6:930:28::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5998:EE_|MN6PR10MB7443:EE_ X-MS-Office365-Filtering-Correlation-Id: 359d2999-58e9-4e4a-565d-08ddc2ac6de5 X-MS-Exchange-SenderADCheck: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JwpILxtPAFWTonm1bfZ/+3aRX1SMOBExPrXUuQQRkaCuY/2BZF1elyIC4CJxy1ffFDtYZbhg8dWZ2qkEamMeO2dfbMs/K2Ep7XU0Yp0Hbyx05XfBHRI1jcGQz5d4FWVHrdqNKiiOA7Mvn9fq9YxO1DYO+IcxW0u4+dfUljQfKi9e6mwMUyYmRSYbntkjNge79fkccV/7Uqg1TjjU6D+fHIPB9e0HcGmOkP7aaKQdJYN8mEQVD1LhrDwJDCptyELnaQ4KRVHue+OETxgxSjTVJvorRZGPeX94aWLfVMKoyvx55FayfEa8OY7XKKAUnmztAsVT6ytMg10BoboOhwkEsFY2dCnMetV4OOnXJrIJMJvFtMRsFrhCTQfYZFFcFJikRLPSEnBklTsmRRgew67EZvcyx/7Mu2XRsi7IV5WIHOM8LgMCstI1zsMI/RWMlo8PLuys4Pj3BLON3Vgq+n//yfXc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS7PR10MB5998.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wEEy9zkytBIQy42PcD8bW3lSGthuSWnePA4hXY3sOH2H4+U7QaiY76LGbMQ+mubmChgrrinp30uJArYna5iKT59Xtd2DUqmcApopFpdVib2UFKlR3jaJZktwspPj1+yL1gZ56GoikGg0raprQdY925zZ3oTJfPMiXGhFweNbkBCBpq8YNagyLL+GT42x3aE5Hqzu0yPPgC1LfGdFQ5+a4o6TjuXBLft/3lsoMmPrnp0fE7MPjsi52gLHsxeeqoicfOIsw3C1225+M9GPHxk6kWMeyDWEd2wp+b5nOCawPgUfW3Nl0OwDo4claQcSiUC325uWn4rtIMQvKOGy3EFCso/ht8O2nYzTV6tVWjBps3xijNTyQAMR1xm2Z03L1AjWDhWqPtrX793R6MmkINrwj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iKRMwzygEkvQmjlYs8D4X1vEKCl1Kc+FvLbusYhaX7pHGtp6cd5uqE0CogMTWG5rf+ZMqLtoV7LdtS01yWWYSUmGgG6rvuqe8CMTaYQn0l0OOnrYJtpBzfyWym8SCEkbz9NEgL2vznjJJ5EMdsSqefZhat03+Ho+AAmbokhhjnDbOkgvJRYS9soUGoJSX X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: MMdELi818tTW7Eu87LIMfF9OCG820d2gRm7F5glpvUoFmP6BfrlYaBVX7poWnHfGpPkApQpYITFm+kmiuThsY1hYgjmrXjkoOVjdiFJZBq2hS8FEpIwdebXmuBk2ev0mcxeSfMsrA0vaJ/IPy7n03hQhP7gjjDU2A23J4u6I1Q70gEqm34rggJkPvRFZySea7tYZizDH/GdiA9M6vu/jsT173HxXQLfB/tTN/HzQtPfgdf1xx3IyfsnZ10a5rNCV+zuwA2Ibm3aGOo6gf899StvzuU2FUCjRA7iRqug5QUPLU/tut1CGp57rTbEerjmfEK58R92hIHuyCxyt5jmW3HIOGCqvShxd/ytndbIqncGuyZfs4kjzvrQl1saVlEI1bEyiltb5v7H+m/wG4E0iyf/bVxN5+sLwlZrENmoqBK10I0zhyn/JpF6r2Qknb6endCezt9z4rbq4ePSJ/CgrsFpKvWxGWs+6t/s6E87jcgw5EmcQo53uGsAMwZ1NedWOQtA9nY1T9FWfopCIT+yk7Yi6wK5NAI9mIS1gDpcF7AcJjMjoQ+taki4gNRKlSKdFfBz3+4FNV8i1HfZJf2GdRV5AfbaWthO7iu5heglymps= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 359d2999-58e9-4e4a-565d-08ddc2ac6de5 X-MS-Exchange-CrossTenant-AuthSource: CY5PR10MB6011.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2025 08:00:00.3487 (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: 0r10oEZ5/9lSNrd7YOZmmdSoq//cNK04g765lq0Tcgn0hPHTusurcmrMkZ46ybb124dJtvz6f3+L1kjv9yR8QZ1HoKSSVwQnOnQ2depfwDxWtCp40t/quWDawWsR+GSaIowKEou3s0hktayxl+m+AA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR10MB7443 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-09_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2507140046 X-Proofpoint-ORIG-GUID: N4e52q9PtXIiORSO0w_DKLMl02XSYUxu X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA0NiBTYWx0ZWRfX+X/HRg/IJvua o5526MNPc6iNU5uS3iqWJX8pZpfoT55DBUNZbkmeyIzLzCyeqBFJvjfXSFuf5xD49g9Uex2L2mU 9aRRb3EJtflaK79kahgOqtG0WCCk0Mshc4PaGDzS6pRUMtGamdyJ6AWI5oVxraVxQ+s7KTFNu3i dZm2JS0Dc9YIElNlzg9vZrZySK7sQ+3QaQoTYxiO4yAH27Cry7HEoxZmhQm4tl4VycDElMOcloH lUGL2STpOYLzZ4ZN3aOvvq7dO7OL4WNVfBaPFPmyMTIDY72HekOIZUQyoVujp3wT7ycIgOIN3F/ ftC60OU80fDurAalYCYfNHVmUD9SXhqdFQo2xHZgryw7Z9cFv/XxA+7vakXNxgcrzubOmMxpDGi fHQJeEgscwRG5F6BWDyDv64Edpo66KwRC2z/PzG9GWl2hilzDEK+AsICKxuQ/EC1XimSEhxY X-Authority-Analysis: v=2.4 cv=Xtr6OUF9 c=1 sm=1 tr=0 ts=6874b915 cx=c_pps a=OOZaFjgC48PWsiFpTAqLcw==:117 a=OOZaFjgC48PWsiFpTAqLcw==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=Wb1JkmetP80A:10 a=GoEa3M9JfhUA:10 a=mDV3o1hIAAAA:8 a=yPCof4ZbAAAA:8 a=mJs6o6JHlOreD5OfR1oA:9 X-Proofpoint-GUID: N4e52q9PtXIiORSO0w_DKLMl02XSYUxu X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_NONE, TXREP 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Claudiu Zissulescu The SFrame is well supported by x86 architecture since binutils 2.41. Enable it to be used as default frame tracer. Signed-off-by: Claudiu Zissulescu --- sysdeps/unix/sysv/linux/x86_64/uw-sigframe.h | 76 ++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/x86_64/uw-sigframe.h diff --git a/sysdeps/unix/sysv/linux/x86_64/uw-sigframe.h b/sysdeps/unix/sysv/linux/x86_64/uw-sigframe.h new file mode 100644 index 0000000000..585ca011eb --- /dev/null +++ b/sysdeps/unix/sysv/linux/x86_64/uw-sigframe.h @@ -0,0 +1,76 @@ +/* Signal frame backtracing support for SFrame on AMD, x86-64 and x86. + Copyright (C) 2025 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This code is inspired from libgcc's MD_FALLBACK_FRAME_STATE_FOR + implementation. See libgcc/config/i386/linux-unwind.h */ + +#include +#include + +#ifdef __x86_64__ + +/* SFrame is only supported by x86_64 targets. */ + +#define MD_DECODE_SIGNAL_FRAME x86_64_decode_signal_frame + +#ifdef __LP64__ +#define RT_SIGRETURN_SYSCALL 0x050f0000000fc0c7ULL +#else +#define RT_SIGRETURN_SYSCALL 0x050f40000201c0c7ULL +#endif + +static _Unwind_Reason_Code +x86_64_decode_signal_frame (frame *frame) +{ + unsigned char *pc = (unsigned char *) frame->pc; + mcontext_t *st; + + unsigned char pc0 = *(unsigned char *)(pc + 0); + unsigned long long pc1; + memcpy (&pc1, pc + 1, sizeof (unsigned long long)); + + /* movq $__NR_rt_sigreturn, %rax ; syscall. */ + if ( pc0 == 0x48 + && pc1 == RT_SIGRETURN_SYSCALL) + { + ucontext_t *uc_ = (ucontext_t *)frame->sp; + st = &uc_->uc_mcontext; + } + else + return _URC_END_OF_STACK; + + frame->pc = (_Unwind_Ptr) st->gregs[REG_RIP]; + frame->sp = (_Unwind_Ptr) st->gregs[REG_RSP]; + frame->fp = (_Unwind_Ptr) st->gregs[REG_RBP]; + return _URC_NO_REASON; +} + +#define MD_DETECT_OUTERMOST_FRAME x86_64_detect_outermost_frame + +static _Unwind_Reason_Code +x86_64_detect_outermost_frame (frame *frame) +{ + /* Outermost frame has the frame pointer cleared. */ + if (frame->fp == 0) + return _URC_END_OF_STACK; + + return _URC_NO_REASON; +} + +#endif /* ifdef __x86_64__ */ From patchwork Mon Jul 14 07:59:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu-Ianculescu X-Patchwork-Id: 116222 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CB34E385841D for ; Mon, 14 Jul 2025 08:05:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB34E385841D Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2025-04-25 header.b=eWXke+Ot; dkim=pass (1024-bit key, unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=H6FXCjl7 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id C96843858D37 for ; Mon, 14 Jul 2025 08:00:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C96843858D37 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C96843858D37 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480023; cv=pass; b=osq/Svqw8sPVuKKXSwjZCwcGnShNK5Ml8Cg2bdpnFa1++tfSNoSpvj7V2/ce25PxYkhKCC5R3s/yf1t6QyMbeKOT+H63c89cbWQagTFRHFPrM+lVuWDtMTwJizNRgzL90VCWjfQpEFcbTbdYYB7wEVXKFTnOr7uivE/2/bvsOI0= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480023; c=relaxed/simple; bh=GIgJfHISb/8oQ+mS0FBqOmZ34XafS2NOQaUiZRCcfbg=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=gOhB9/vp0auiFcEFdwz9uwg9xU/BOAYe3641ZfYvBTovi4Tohf2iPRwJ5TOg+5E4hL+E7WHCpLJWPHZZ/5Vd43uwpWVJ2kjJKgug78JTRiL8xM2A0FX4PsEAxBR14F3KgQbC+JDxlnETrxEhLLJZe7HNd3OCnfv8wTwKVoj7puw= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C96843858D37 Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56E5Z1cl032466; Mon, 14 Jul 2025 08:00:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2025-04-25; bh=ZLshylyZZeX2K05Yda2hGmH2jggF1gN88oIgOkjujqc=; b= eWXke+OteZ2nZKFHci/l0h7kwvvwGzNkk9egpXLLfkbfqtPRrhBYH14833ao/dKj thl3IQJbWPSiiWNwaarBZJWidG0HBD+3CA1bOaMMbco09pWMhhZ3vgxrPa23z7B5 ux7mU9Ksqj6rYqIQ9PPvcYCdzBisSfh6x8cSM7H5GJppQEL99lh9P5pGWAr/+aLo YYJujL5LntwxInqaLtayuFrV0sghxpUqafh0zAS94N5Wa4cSEMBzC3nZqrES4iwo fwt+pQ00gsdNYGP8BjFXls4gWteGPF+zCqlD2s2CBEAqwwgSktuBRFAf2kQC6PM6 gVYpa4YHHE80nneNnKrYJw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 47uhjf3yb3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:20 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 56E7tB5P028990; Mon, 14 Jul 2025 08:00:19 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12on2081.outbound.protection.outlook.com [40.107.237.81]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 47ue580s5f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Hziu/obq2GonTSlR3cFlWqc6e2n37d5WjRbYDhP62Wgy56DTT1XKRY24HY5DAAktigi/SJJYDHt2d0LMBFWBenQYiSeSGAlwokHvrNBEw9NT+lwoQ66uMWAa4n4YdF01e154OTpNbU3Kz6i5XApK12pKh+NZGsQuI2IB06M90DxskgfrydW7L22v3E8a4SSZTPjxq6OGLPhLXpG91jSYusrtYu3kbYjqLTdo79DoMzn+w2SOKy7adLZTFXB5i440MGH/i/geySYncKoS3wlD/f7ZJiFIm8m/lho3I3hg6M+MHKHnNUKQcp7yJIYChrTkILcCcMw9NtzK0G9FJNnPdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ZLshylyZZeX2K05Yda2hGmH2jggF1gN88oIgOkjujqc=; b=Y7kekmrxQEk24BN7p2Xv5UJbgCQS1tXF7bt+bLhyQ0HOhIIFzj3OD8r+d1pK/Xemt6ddJGy8SXm6xX57M4toBl+zlwPbCBB7xt7xWYVZ1V4fO00GJL1N+2ImofoLrUKcntb9u86O+Vm3tZX/QBphErOAYs+JhZB/27kx56pUv1pJRrv9E4/GXmRoZ1M/4McGUVHcqajxEfN6hml5aA8kBJU+YZb7TxksRDYQcQXEooIwpp1z8SIbJOqZF6lGG2AzbXkJ77VzqvtlpEtSQ4xAKmdJ8AiDIhqvg2CzK4EUDhQXwJ+9nDjuMJ2n5eAN25nd13LAbGIifAW+CSrRR43aTA== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZLshylyZZeX2K05Yda2hGmH2jggF1gN88oIgOkjujqc=; b=H6FXCjl7ejR0NXok+d4CEzshS+xX98y84Guhei+7qyKmDAr/svdx9frqxz7VPvKPlVG54RXSZwMWvt4O/7ukwGgPyJiT8FPY/YcUuQXWPT5kQtRli+FyE7NTaLv1DblNwrtC2Amu2+6Nhhlk8OtZRLKNupCiY+CQoxBy6veZejc= Received: from DS7PR10MB5998.namprd10.prod.outlook.com (2603:10b6:8:9e::20) by MN6PR10MB7443.namprd10.prod.outlook.com (2603:10b6:208:46f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.35; Mon, 14 Jul 2025 08:00:05 +0000 Received: from DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed]) by DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed%5]) with mapi id 15.20.8922.028; Mon, 14 Jul 2025 08:00:05 +0000 From: claudiu.zissulescu-ianculescu@oracle.com To: libc-alpha@sourceware.org Cc: jose.marchesi@oracle.com, elena.zannoni@oracle.com, indu.bhagat@oracle.com, jremus@linux.ibm.com, dj@redhat.com, adhemerval.zanella@linaro.org, fweimer@redhat.com Subject: [PATCH v8 3/6] aarch64: Add SFrame support for aarch64 architecture Date: Mon, 14 Jul 2025 10:59:23 +0300 Message-ID: <20250714075926.34870-4-claudiu.zissulescu-ianculescu@oracle.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250714075926.34870-3-claudiu.zissulescu-ianculescu@oracle.com> References: <20250714075926.34870-1-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-2-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-3-claudiu.zissulescu-ianculescu@oracle.com> X-ClientProxiedBy: BE1P281CA0140.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7c::20) To CY5PR10MB6011.namprd10.prod.outlook.com (2603:10b6:930:28::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5998:EE_|MN6PR10MB7443:EE_ X-MS-Office365-Filtering-Correlation-Id: 511cdaca-9aad-4d4d-af84-08ddc2ac7129 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-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hxTWumxlzhtG1UmgmoLb5V11C1RsAIFi+B8xFQrtsZYFDKNATfwR347op53HKoZ77YZnGwPVxyhUwIb+qF7c9yTiYP4oFpctfxn/V8hcsiL42np0nTgmXWOBeax1TnroW1/shZUhWKvj67DXmptg+efSNAGH+rw4E+PNjowI1Ua/phejRiZBn0gCjsKjMibbwtD5KeQRlAuCrtQHhz+d8zqzbOYTfhhgQHEOoeBbAPFArMjpZ9FODP6FBgA4/cSQjTxGVXK2B748Zg6CHuoffVj2NfRdxbiE6eYG53uaG4hHkShtz0CjstzWvWxnM2uBwCCggARE1XVjGlyiBJ21DucEelr4xMGuLB9yPaW8b5XS7JF8HJxZkrkDHgXP0DI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS7PR10MB5998.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MFk2d30vHjEx4GhWcyZFpLE5R6/nUoExjF803SqzAi5k5e2JVK6XJIGw9Sdl7BK5ar1FaEDFd05PZBEF4Bp7Xe876oQVrpnJDNM/jS1Bubu5StU3u/HFv09RkBHeHF0Vg2AwJB+ACC/s3Mk9Afg+MhaFqNuzJ61OuCU5YGLQFr/kprEC6pICEUyD7vRwsDPhlKR7A7p2x5Qwr3AhO9bmtn4RhsFF5F2k/L0b2oTepE6NK/zVB9ZDIneNwmr/gawvx+QvhcRrsoDGX+bN+VSRK1YiDNy+eCVQrew39Kcf/j5LlTuU+iP1Tamk++uqIzdZqHxRoX+ZxcyllOKKA+RuFA/41PYI+Su3nWqFxE+pVS+9FhfagIl1oJeCphYJdYZJSiaVO9gAq8VY/XFjFWZDobMVFGyPf54VIT+14azBaQIIKvdMJAzfBi1106NeEBKcdym2LItyamQM72amuQtHQ3q+LgagxUoxAFGSXLxZTFf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CulVZhRgx7WVUMyOBNfh4vfWaQGSmZ5jRbVV4WygmyZmNLhkOvvJLedBlo+cCdpkPvDRqouk2I8U X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: KBXT7UGNvEvrjouBZaCBSFw26YLenAvtTGwEaXaQQPphIZUudWl9o7AMg/O9MQoSu9dJRG1qUdeTPYYyX9aWquY4BFeLwV05r2xEgscsPHDN0ui0kj07qU73NqqoFNHsx9nPW2mqyFf6c2ts2AEV7wYASCwNdwI48UdLc0fUKY1Vj6M7s5aCd/wteG+1OHHGcKe4U3N9gkK4TiAkYBK/9pFJ1Duiu53bt8m00NFMd6LRJDs1KTVzv3pDkN3v9NWDEy36BI1LgkxYNue6bQbjrds0MJZJRHFVwyvqQ9VILY/zszNkBIUOVRhbpGVhMTfmh58cqTnDeYnn+DVNiUEYwfzZSsJ5aJLB7vZmCxfD4dSmM1oSVVDA0OEMjhOBjxkokWO5ERvBZQHKAGoUq13dE4HgPxb1m3755XQir/ee/dnLC0tuVkJbBxRg8Xdy6nJBjzDVEeX2zdBpj1A/KM4+z+Yw+AI5bu1nWEJZgCJTWNm+RyfTjmwGkm6MMUcOYA6Dsl7QNtfX3NRZ7E4EzbKXjzE4uZKRu7Av2txws5O2giJ3ZpQzSy/fxv4kXm0py2sZuenK8/czblQAQEG3GsIhsKAIQFEMyUVmg4cQkYnWKNE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 511cdaca-9aad-4d4d-af84-08ddc2ac7129 X-MS-Exchange-CrossTenant-AuthSource: CY5PR10MB6011.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2025 08:00:05.5196 (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: 5OMHz5ucfB6v9oR8mrQlB8lZwAYYztPcyBp+TjmzQ0MjrAfXLQ4ckqC+kNCHs/K5YiU1EYpR+iLrC9moqtJ+VjAuniAfPcf0ph0tPLR7viNH57WRxSKnHHcjM3JXVJy4geuyz9rI3PLSuuYU/1bhIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR10MB7443 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-09_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2507140046 X-Proofpoint-GUID: bsdB4lcobg2ev0VqOGorH-yMe8UDo9Z- X-Authority-Analysis: v=2.4 cv=O6g5vA9W c=1 sm=1 tr=0 ts=6874b914 cx=c_pps a=OOZaFjgC48PWsiFpTAqLcw==:117 a=OOZaFjgC48PWsiFpTAqLcw==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=Wb1JkmetP80A:10 a=GoEa3M9JfhUA:10 a=mDV3o1hIAAAA:8 a=yPCof4ZbAAAA:8 a=PpPlUPUgLGkrIORSpPwA:9 X-Proofpoint-ORIG-GUID: bsdB4lcobg2ev0VqOGorH-yMe8UDo9Z- X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA0NiBTYWx0ZWRfX8/LcY1fKRFVL uNaXW7Ng0FcyPVl1T9aCtYVU4D1XNtiiA05F3yQzlrsBpd+Hkm54U2DYJS0DFLNsx5+kJQvPilI KMxyEvkEonkRPIH95nw8/leTzAulfbPztsYXLbci1jGC+FRrOLymFeu4nG/4XldEO5zefQxiCL8 bnSevxThZgPoWeTow22yf03Ktvw+VoclixjGBcgTGCAIC/Zr0MqDumv8L+SXeAGif9mSojavJGW 790kG8X8jrbHFnA8tv46kL0HsrkHWa58lQ/7yNnZ78no60tEWC2Wuz77UOn3kGaxCMrK7Eg9XFG rYJk+W9VHwT2VNxmkxZ5PofQkWCKGYD4Au6rOHlmLmc1eUe/5ueEUvTV2gbFyTVzXkPqy9tVkj4 1dTt+0IdCWbcmhMgr7BFUdRyM/zpx7lvxqn+huTB4W40X31K9hFwqLEkVJVOb3qvDm7/7Psx X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_NONE, TXREP 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Claudiu Zissulescu The SFrame is supported for AArch64 architecture. Enable SFrame stack tracer for AArch64 too. Signed-off-by: Claudiu Zissulescu --- sysdeps/unix/sysv/linux/aarch64/uw-sigframe.h | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/aarch64/uw-sigframe.h diff --git a/sysdeps/unix/sysv/linux/aarch64/uw-sigframe.h b/sysdeps/unix/sysv/linux/aarch64/uw-sigframe.h new file mode 100644 index 0000000000..3a77c23369 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/uw-sigframe.h @@ -0,0 +1,78 @@ +/* Signal frame backtracing support for SFrame on AARCH64. + Copyright (C) 2025 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2.1 of + the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This code is inspired from libgcc's MD_FALLBACK_FRAME_STATE_FOR + implementation. See libgcc/config/aarch64/linux-unwind.h */ + +#include +#include +#include + +#if __AARCH64EL__ +#define MOVZ_X8_8B 0xd2801168 +#define SVC_0 0xd4000001 +#else +#define MOVZ_X8_8B 0x681180d2 +#define SVC_0 0x010000d4 +#endif + +#define MD_DECODE_SIGNAL_FRAME aarch64_decode_signal_frame + +static _Unwind_Reason_Code +aarch64_decode_signal_frame (frame *frame) +{ + unsigned int *pc = (unsigned int *) frame->pc; + mcontext_t *mt; + struct kernel_rt_sigframe *rt_; + + if ((frame->pc & 3) != 0) + return _URC_END_OF_STACK; + + /* A signal frame will have a return address pointing to + __kernel_rt_sigreturn. This code is hardwired as: + + 0xd2801168 movz x8, #0x8b + 0xd4000001 svc 0x0 + */ + if (pc[0] != MOVZ_X8_8B || pc[1] != SVC_0) + return _URC_END_OF_STACK; + + rt_ = (struct kernel_rt_sigframe *) frame->sp; + mt = &rt_->uc.uc_mcontext; + + /* Frame pointer register number. */ +#define FP_REGNUM 30 + + frame->pc = (_Unwind_Ptr) mt->pc; + frame->sp = (_Unwind_Ptr) mt->sp; + frame->fp = (_Unwind_Ptr) mt->regs[FP_REGNUM]; + return _URC_NO_REASON; +} + +#define MD_DETECT_OUTERMOST_FRAME aarch64_detect_outermost_frame + +static _Unwind_Reason_Code +aarch64_detect_outermost_frame (frame *frame) +{ + /* Initial frame has LR and FP set to zero. We track only FP. */ + if (frame->fp == 0) + return _URC_END_OF_STACK; + + return _URC_NO_REASON; +} From patchwork Mon Jul 14 07:59:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu-Ianculescu X-Patchwork-Id: 116221 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 652AB3858405 for ; Mon, 14 Jul 2025 08:05:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 652AB3858405 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2025-04-25 header.b=kaWgnj3K; dkim=pass (1024-bit key, unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=TlPuzb5f X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 40C0E3858289 for ; Mon, 14 Jul 2025 08:00:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 40C0E3858289 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 40C0E3858289 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480026; cv=pass; b=Xp28whFPeA47/mBEo+yr+YecMjLjfQ7Gzj9UEfI76CwEXiBSm9FkWFY/rE53hxhV9j7Qws9Vpt5BY3jtbHZunG7OA3QqyD160jH1GY2ufPJFeXabkrW7BkLvjq2f0K4k1xV57tfox5aaWb2IIdkocM/2788yZPe23Bw6ri6Zyyo= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480026; c=relaxed/simple; bh=BqY5TdTNmvNhkqMHRHcOY8cSWsrSGlLOgjRjrOo7/cs=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=hc261vprabUcd7VPx23rp4M9TFJDASC8wzQdOASh4q34iEKzRhm3MiKMvHvPAllVclIbi/cU48Vi+DCDY/vXMOgZIzuelqp4lNlFB1yh+Oa+E5FS/apn3nXP8jPry2QRI4gnL5erg9YBk7gYBOi65TMHoQJ+2prjC99GqISeGSM= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40C0E3858289 Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56E5Z1cm032466; Mon, 14 Jul 2025 08:00:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2025-04-25; bh=FEfgK+w8j4Mx9Md60rP62ZfIMVMJnNs1t21YOQnTnSQ=; b= kaWgnj3KaNNmNVkbHzbWF3aZv62cAEsG2ENmpdpv/lmDs/LgxRE5fz4H70HXqN30 nbEv0VNROmbxfAra+F390Uv/fgAdKybeJ2/ErhTCnUFKjgj1o6MkrUpLDnZKnNVT unOSlbkMZLMQPlAm6sNYQIPU7TfSe6thwFwaMj6W/sBoF6Wb7YRtO5loWURmRWPY d42oY02fTBW6I8ZKU/0yYMG85IhFjCRrwWxb28+QrtSBeh9SByRMlyOuCwEQJ7/x gUEOcYG1xvqAZDLcsvSqNQLEJW5IFbrPaLd7zqIHJ4Ev3wppN3onss/0vtCu8msa yovPOAzfBEz4afj3kIeZ2Q== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 47uhjf3yb4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:21 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 56E7tB5R028990; Mon, 14 Jul 2025 08:00:20 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12on2081.outbound.protection.outlook.com [40.107.237.81]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 47ue580s5f-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Fv8JsN3sVq4hZjSVwXUOfbfkPXpM7F3FHYwjVN2gEIlxcBX1cewKFLvR3wdYURyOHZpUn85ZdKVbFZ1W5j19Cg+N48MMgB+kGLeObYHqi3Ih6kCb+NHS3GolEEBzPPPpOUB8viN8pcex+65lxNQoGnHqTz/LzQjC0bIcDoACYfUNBhcVJDi8GMCRx1jvk9BeS5ZZrNVaRrVBuiEJoc96q/yrB68nKePyFneKS/9M5IJ3JoFUAPcrGwGmaozg12+3vUj1W6D3ip0DkHJqochnlwuSDWlcsEhs29zAuAfzSfi8qPCW4no5Zaq+HKJp1II1K4K845xkLeag2xL2i+4fEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=FEfgK+w8j4Mx9Md60rP62ZfIMVMJnNs1t21YOQnTnSQ=; b=M0YI1JbE1EXgM7nI9nelHbyOdqCV9iGF9UPlWFsQ9UBcKr81aKDBZ5yk5k4UOq2JcAHg1046MyPMf3mqD9A9C9pgjgM+Wz6DMnuVkBuVGVK+PFqnxlI37cmO44U8Hzus4c2vhIy5FjiH9fZkm18I8EzdMDCIbwlmaKKDCt5rdcFV7CC8dhI6h/07tzmEpcEROceIwRXcBWpNF6cICpqx3O2L/RkuF1iYQqKj/EYJQS5rU4vOLzkG9iJ44IwjFFSyMKdm6nvGqJ3FrBKmJJu+ng3CUIav1dBlVg9NMkJ/yOKkCfQjTostM03gAJDFw2dANeebsuVrWI/XQCU7Tf6Pwg== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FEfgK+w8j4Mx9Md60rP62ZfIMVMJnNs1t21YOQnTnSQ=; b=TlPuzb5fvp0spU8W0MaSkqSAXo7bMLapbWp3urv5rIEPcGbZP5E/95KhjORx/RkASGDWeM/PL2Y6fwxGrd59GQr81JerOuVds8EmP6MQqeO6syo/9pv14W2/nqHhBnRWi6UPJvzei0tr4P+9/taQOz34NAKtPW7Lf+uN2lxBl50= Received: from DS7PR10MB5998.namprd10.prod.outlook.com (2603:10b6:8:9e::20) by MN6PR10MB7443.namprd10.prod.outlook.com (2603:10b6:208:46f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.35; Mon, 14 Jul 2025 08:00:15 +0000 Received: from DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed]) by DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed%5]) with mapi id 15.20.8922.028; Mon, 14 Jul 2025 08:00:15 +0000 From: claudiu.zissulescu-ianculescu@oracle.com To: libc-alpha@sourceware.org Cc: jose.marchesi@oracle.com, elena.zannoni@oracle.com, indu.bhagat@oracle.com, jremus@linux.ibm.com, dj@redhat.com, adhemerval.zanella@linaro.org, fweimer@redhat.com Subject: [PATCH v8 4/6] elf: Add SFrame stack tracing Date: Mon, 14 Jul 2025 10:59:24 +0300 Message-ID: <20250714075926.34870-5-claudiu.zissulescu-ianculescu@oracle.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250714075926.34870-4-claudiu.zissulescu-ianculescu@oracle.com> References: <20250714075926.34870-1-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-2-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-3-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-4-claudiu.zissulescu-ianculescu@oracle.com> X-ClientProxiedBy: BE1P281CA0491.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7e::24) To DS7PR10MB5998.namprd10.prod.outlook.com (2603:10b6:8:9e::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5998:EE_|MN6PR10MB7443:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f5eb4b0-f5a1-43b8-5e69-08ddc2ac7411 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|13003099007; X-Microsoft-Antispam-Message-Info: l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QjG9Hs4Gop7w+EsATAV7H1iB6rNJytIxG2fsjC+sRgn+VsMGzz6S/HvGk/DM9UTLK3xqgKmstL/zivzbCU+mPiwzDTEW10zRcQJEsQ9NSK4Wnmz10LZqzy8ITyRWProzDCKikkIS5bSIsKDVcOzF5jVVrIoUoXK1dS2uoqt+ToMNc2JPGT2/vNd8w8XKxyQGu8WX60PT8hrh2mRp0RNIQLYpuW5BIWla/D5qeEtlB6aHSyE1ksnyi3DFPMkTSKP+weyDJ+psFnoWcIxH7kvOYd6+2P3JxuIvm3sM06b8NjzaUyJV8icCx3tkDlphFStMoxnd0iXbIX17ijRdHYlMjsQh8404z+aC7+U0SfIy3wNhTBUQDGAqK0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS7PR10MB5998.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014)(13003099007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CZa6qp8/LcuYUQ+Qmvd05sJQ9sidi75kopY6wN7g79YXsgyPN08GdGEhWk8h4yS68XR8uhwidw3SjFvL6HEuStptSff5vLB1GBdqRkelu6G9qZLf8O2riAU/1pEba/ok5E4v2QwE3d9nSDIRxyVUzjFRPusD8C9nlB8kNyvsb8L1gF7uA2K0OcOH56RPqGnLMzBI0382Mj29GsQubAIZ3MkJGMCP6EgadveNGhkaL6L7x4ClDQMR+jJ9Mc4IWTTQRkbupCBZRFD8IuDuuSb+8Dy08w8K083KEbt7GXkZD+zuBctmcC36lAk2Y6pR7AH1nZdUwzQ9eFPJQGWiE8bS3Ll1PjRavdMkYRybVVWkkw7s17LmRb3aPxFen0J3Ibs67d6iFkEfvtUfaVfE7RuaJddPv9LxdU7zlmEkJJyo1K9Eymnmf+FnnFXlj0Ywnikn2oCV1X5qg7Q/H3hIcQLMNvYl6BeUfWD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oVKtnfb/e/K2KsYypRT6W//tagrdbLE/gO8W88G72iLwpujkZiz61DehF+1CavUR6Ndk3r7sgD2/hZci8lA8lwjScVAWgnGDTw6pQOX2egZR X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: IFgiGUC8DjyaSAz6An/D0jdbTN6miDG0T1Ei5mOYv0yIUq8TOpuPk4SrxJo4BvihiupGjOsWZwoNdeRb4x+Gi4A/Kv5r8Wak8iGKYRk4MRK1MU3jzi0MN93NsUIAJKLvp96SkHcBi6ItVHeXFYmaGg+3GKuTscA3wGVuN7ICckZRcdnxthZQIjRLoto+Ax9S6spX/8WTyHAb6cbG5xBIb98iFjtEox+TKjE4y6JyUU4nbso/oIZ8QRS/Py5d7svz5vJfkNcmJksIRvb1+bsEthCRE+4ZL1T5WYMXiupnof0h6jX4hGe9DUpYt/hASl+dkaMeSVPcJMdnN9AqXpiqADLRtTkPX5N991+uoZDeKGytcBdg7WXAiR5sT1V0tKY0bFLZONupgMaGkYgsXJO5tkqIo1XW9U8pq+LaMPLzDIrPL/PQJMXOdX1qy0/4lles/2Qwj+7dZhyWpBBnNjTjtYajgvAHtipjLJiDLIxChAE4a3l2LEU+Xv26ONj1wqWku36eHuwBOM89zAqrPRVqeZNmqgHnlaTjXU2Kjrd5p/zdSOrgSKpQ8XXdYyOhybJfGlEUZ0QcBR8n3xOAWNzN8OH232a0C19c5lpzIcii5yQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f5eb4b0-f5a1-43b8-5e69-08ddc2ac7411 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5998.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2025 08:00:09.8265 (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: G3RURDxCl6QSF96IQ5sFsMGJTDaqFtGqk7T637oWS+wHcDfRyNkObnhciJOmAno+JfGC4FLZ/iYcsmRTTue8ody8EVU/fqaCdej0YlbCHjrZT61LPu8V7v3P4Fhod4AAo5YZx5EDqLtD1gEEDJfNwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR10MB7443 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-09_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2507140046 X-Proofpoint-GUID: 1vgrOioEMWosoP60dzU7yS6hPu0ei66G X-Authority-Analysis: v=2.4 cv=O6g5vA9W c=1 sm=1 tr=0 ts=6874b915 cx=c_pps a=OOZaFjgC48PWsiFpTAqLcw==:117 a=OOZaFjgC48PWsiFpTAqLcw==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=Wb1JkmetP80A:10 a=GoEa3M9JfhUA:10 a=mDV3o1hIAAAA:8 a=yPCof4ZbAAAA:8 a=1osuH6F0xPT_nVzQhZEA:9 a=t1Oh1QyjOnTWmKC4:21 X-Proofpoint-ORIG-GUID: 1vgrOioEMWosoP60dzU7yS6hPu0ei66G X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA0NiBTYWx0ZWRfX1A2Bw3o6KL8q oBsClxsVKbWzPMZXJLYZMRDdMV30MYz6uyBOSWYKVjHqxtws0bALhdiTryxeClH9z7VLIfTHyiN dzenLt/u58SRGjsZNaXRE7Fq+7WjDFl5w9xX9D9NaaoPNmsJw0Cbfs9WfvOGMaHcnc6B2MqvP9p 1bfZTVoHIekT4bnFBlsgM5pAgO7FhibtDTqWjNPD4yRgTpSVtuF86AGI1P5y6v/tb8zxa5eOiWs qIY4sTTcwdixByBobRCgS0+Av+e1A4CqDu1ELJFZqPxDKPuq/R/8Sk9vhLQpiPY7YSilGJwhWCc PatbHN8B91DB1Cf5Px7zExNeLTVQ7Hc/Y57mIQzl71/2DmqPHzZh1mgxwNcH60fNYAsFv/Oae+v c/9tXdvgqBbe7ZPbR7jFw/AI88erW6wZRxYzhhyymeTG+8iFM2KFbVZp+DGn79S1rYcWyh9Q X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_NONE, TXREP 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Claudiu Zissulescu This patch adds the necessary bits to enable stack tracing using SFrame. In the case the new SFrame stack tracing procedure doesn't find SFrame related info, the stack tracing falls back on default Dwarf implementation. The new SFrame stack tracing procedure is added to debug/backtrace.c file, the support functions are added in sysdeps folder, namely sframe.h, read-sframe.c and read-sfame.h. Signed-off-by: Claudiu Zissulescu --- debug/backtrace.c | 46 ++- sysdeps/generic/Makefile | 1 + sysdeps/generic/sframe-read.c | 566 ++++++++++++++++++++++++++++++++++ sysdeps/generic/sframe-read.h | 106 +++++++ sysdeps/generic/sframe.c | 187 +++++++++++ sysdeps/generic/sframe.h | 367 ++++++++++++++++++++++ sysdeps/generic/uw-sigframe.h | 31 ++ 7 files changed, 1303 insertions(+), 1 deletion(-) create mode 100644 sysdeps/generic/sframe-read.c create mode 100644 sysdeps/generic/sframe-read.h create mode 100644 sysdeps/generic/sframe.c create mode 100644 sysdeps/generic/sframe.h create mode 100644 sysdeps/generic/uw-sigframe.h diff --git a/debug/backtrace.c b/debug/backtrace.c index 05cdc84e8d..161999c17e 100644 --- a/debug/backtrace.c +++ b/debug/backtrace.c @@ -20,6 +20,7 @@ #include #include #include +#include struct trace_arg { @@ -30,6 +31,40 @@ struct trace_arg int size; }; +/* Initialize the SFrame backtrace routine and attempt to backtrace + the current stack using SFrame information. For the SFrame + backtrace to be considered valid, the tracer must return more than + one frame. If it doesn't, this could indicate a mixed + environment for example, glibc may have been compiled with SFrame + support, while the application was not. An even more complex + scenario arises when the application uses shared objects compiled + with differing configurations. + + Additionally, glibc includes certain callback paths that must be + considered. For example: an application calls shared object A, + which calls shared object B, which in turn calls qsort() in + glibc. qsort() then invokes a helper in shared object C, which + raises a SIGFPE signal, handled by object D, which requests a + backtrace. Any of these components may or may not include SFrame + encoding. + + In cases where a stack frame lacks SFrame information, the SFrame + backtracer can fall back to using the DWARF unwinder. + + This function must be always inline. Otherwise the + __builtin_frame_address and the __getXX helper functions will not + return the right addresses. */ + +static inline int __attribute__ ((always_inline)) +do_sframe_backtrace (void **array, int size) +{ + frame frame; + frame.pc = __getPC (); + frame.sp = __getSP (); + frame.fp = (_Unwind_Ptr) __builtin_frame_address (0); + return __stacktrace_sframe (array, size, &frame); +} + static _Unwind_Reason_Code backtrace_helper (struct _Unwind_Context *ctx, void *a) { @@ -72,7 +107,16 @@ __backtrace (void **array, int size) .cnt = -1 }; - if (size <= 0 || arg.unwind_link == NULL) + if (size <= 0) + return 0; + + /* Try first the SFrame backtracer. */ + int cnt = do_sframe_backtrace (array, size); + if (cnt > 1) + return cnt; + + /* Try the dwarf unwinder. */ + if (arg.unwind_link == NULL) return 0; UNWIND_LINK_PTR (arg.unwind_link, _Unwind_Backtrace) diff --git a/sysdeps/generic/Makefile b/sysdeps/generic/Makefile index 3ed75ddf89..c48e713eb3 100644 --- a/sysdeps/generic/Makefile +++ b/sysdeps/generic/Makefile @@ -21,6 +21,7 @@ CFLAGS-wordcopy.c += -Wno-uninitialized endif ifeq ($(subdir),elf) +sysdep_routines += sframe-read sframe ifeq (yes:yes,$(build-shared):$(unwind-find-fde)) # This is needed to support g++ v2 and v3. sysdep_routines += framestate unwind-pe diff --git a/sysdeps/generic/sframe-read.c b/sysdeps/generic/sframe-read.c new file mode 100644 index 0000000000..d536575b2d --- /dev/null +++ b/sysdeps/generic/sframe-read.c @@ -0,0 +1,566 @@ +/* Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include +#include +#include +#include +#include +#include + +/* Get the SFrame header size. */ + +static inline uint32_t +sframe_get_hdr_size (sframe_header *sfh) +{ + return SFRAME_V1_HDR_SIZE (*sfh); +} + +/* Access functions for frame row entry data. */ + +static inline uint8_t +sframe_fre_get_offset_count (uint8_t fre_info) +{ + return SFRAME_V1_FRE_OFFSET_COUNT (fre_info); +} + +static inline uint8_t +sframe_fre_get_offset_size (uint8_t fre_info) +{ + return SFRAME_V1_FRE_OFFSET_SIZE (fre_info); +} + +static inline bool +sframe_get_fre_ra_mangled_p (uint8_t fre_info) +{ + return SFRAME_V1_FRE_MANGLED_RA_P (fre_info); +} + +/* Access functions for info from function descriptor entry. */ + +static uint32_t +sframe_get_fre_type (sframe_func_desc_entry *fdep) +{ + uint32_t fre_type = 0; + if (fdep != NULL) + fre_type = SFRAME_V1_FUNC_FRE_TYPE (fdep->sfde_func_info); + return fre_type; +} + +static uint32_t +sframe_get_fde_type (sframe_func_desc_entry *fdep) +{ + uint32_t fde_type = 0; + if (fdep != NULL) + fde_type = SFRAME_V1_FUNC_FDE_TYPE (fdep->sfde_func_info); + return fde_type; +} + +/* Check if SFrame header has valid data. Only consider SFrame type + 2. */ + +static bool +sframe_header_sanity_check_p (sframe_header *hp) +{ + uint8_t all_flags = SFRAME_F_FDE_SORTED | SFRAME_F_FRAME_POINTER; + /* Check preamble is valid. */ + if ((hp->sfh_preamble.sfp_magic != SFRAME_MAGIC) + || (hp->sfh_preamble.sfp_version != SFRAME_VERSION_2) + || ((hp->sfh_preamble.sfp_flags | all_flags) != all_flags)) + return false; + + /* Check offsets are valid. */ + if (hp->sfh_fdeoff > hp->sfh_freoff) + return false; + + return true; +} + +/* Get the FRE start address size. */ + +static size_t +sframe_fre_start_addr_size (uint32_t fre_type) +{ + size_t addr_size = 0; + switch (fre_type) + { + case SFRAME_FRE_TYPE_ADDR1: + addr_size = 1; + break; + case SFRAME_FRE_TYPE_ADDR2: + addr_size = 2; + break; + case SFRAME_FRE_TYPE_ADDR4: + addr_size = 4; + break; + default: + break; + } + return addr_size; +} + +/* Check if the FREP has valid data. */ + +static bool +sframe_fre_sanity_check_p (sframe_frame_row_entry *frep) +{ + uint8_t offset_size, offset_cnt; + uint8_t fre_info; + + if (frep == NULL) + return false; + + fre_info = frep->fre_info; + offset_size = sframe_fre_get_offset_size (fre_info); + + if (offset_size != SFRAME_FRE_OFFSET_1B + && offset_size != SFRAME_FRE_OFFSET_2B + && offset_size != SFRAME_FRE_OFFSET_4B) + return false; + + offset_cnt = sframe_fre_get_offset_count (fre_info); + if (offset_cnt > MAX_NUM_STACK_OFFSETS) + return false; + + return true; +} + +/* Get FRE_INFO's offset size in bytes. */ + +static size_t +sframe_fre_offset_bytes_size (uint8_t fre_info) +{ + uint8_t offset_size, offset_cnt; + + offset_size = sframe_fre_get_offset_size (fre_info); + + offset_cnt = sframe_fre_get_offset_count (fre_info); + + if (offset_size == SFRAME_FRE_OFFSET_2B + || offset_size == SFRAME_FRE_OFFSET_4B) /* 2 or 4 bytes. */ + return (offset_cnt * (offset_size * 2)); + + return (offset_cnt); +} + +/* Get total size in bytes to represent FREP in the binary format. This + includes the starting address, FRE info, and all the offsets. */ + +static size_t +sframe_fre_entry_size (sframe_frame_row_entry *frep, size_t addr_size) +{ + if (frep == NULL) + return 0; + + uint8_t fre_info = frep->fre_info; + + return (addr_size + sizeof (frep->fre_info) + + sframe_fre_offset_bytes_size (fre_info)); +} + +/* Check whether for the given FDEP, the SFrame Frame Row Entry identified via + the START_IP_OFFSET and the END_IP_OFFSET, provides the stack trace + information for the PC. */ + +static bool +sframe_fre_check_range_p (sframe_func_desc_entry *fdep, + uint32_t start_ip_offset, uint32_t end_ip_offset, + int32_t pc) +{ + int32_t func_start_addr; + uint8_t rep_block_size; + uint32_t fde_type; + uint32_t pc_offset; + bool mask_p; + + if (fdep == NULL) + return false; + + func_start_addr = fdep->sfde_func_start_address; + fde_type = sframe_get_fde_type (fdep); + mask_p = (fde_type == SFRAME_FDE_TYPE_PCMASK); + rep_block_size = fdep->sfde_func_rep_size; + + if (func_start_addr > pc) + return false; + + /* Given func_start_addr <= pc, pc - func_start_addr must be positive. */ + pc_offset = pc - func_start_addr; + /* For SFrame FDEs encoding information for repetitive pattern of insns, + masking with the rep_block_size is necessary to find the matching FRE. */ + if (mask_p) + pc_offset = pc_offset % rep_block_size; + + return (start_ip_offset <= pc_offset) && (end_ip_offset >= pc_offset); +} + +/* The SFrame Decoder. */ + +/* Get SFrame header from the given decoder context DCTX. */ + +static inline sframe_header * +sframe_decoder_get_header (sframe_decoder_ctx *dctx) +{ + sframe_header *hp = NULL; + if (dctx != NULL) + hp = &dctx->sfd_header; + return hp; +} + +/* Get IDX'th offset from FRE. Set ERRP as applicable. */ + +static int32_t +sframe_get_fre_offset (sframe_frame_row_entry *fre, + int idx, + _Unwind_Reason_Code *errp) +{ + uint8_t offset_cnt, offset_size; + + if (!sframe_fre_sanity_check_p (fre)) + { + *errp = _URC_END_OF_STACK; + return 0; + } + + offset_cnt = sframe_fre_get_offset_count (fre->fre_info); + offset_size = sframe_fre_get_offset_size (fre->fre_info); + + if (offset_cnt < (idx + 1)) + { + *errp = _URC_END_OF_STACK; + return 0; + } + *errp = _URC_NO_REASON; + + if (offset_size == SFRAME_FRE_OFFSET_1B) + { + int8_t *sp = (int8_t *)fre->fre_offsets; + return sp[idx]; + } + else if (offset_size == SFRAME_FRE_OFFSET_2B) + { + int16_t *sp = (int16_t *)fre->fre_offsets; + return sp[idx]; + } + else + { + int32_t *ip = (int32_t *)fre->fre_offsets; + return ip[idx]; + } +} + +/* Decode the SFrame FRE start address offset value from FRE_BUF in on-disk + binary format, given the FRE_TYPE. Updates the FRE_START_ADDR. */ + +static void +sframe_decode_fre_start_address (const char *fre_buf, + uint32_t *fre_start_addr, + uint32_t fre_type) +{ + uint32_t saddr = 0; + + if (fre_type == SFRAME_FRE_TYPE_ADDR1) + { + uint8_t *uc = (uint8_t *)fre_buf; + saddr = (uint32_t)*uc; + } + else if (fre_type == SFRAME_FRE_TYPE_ADDR2) + { + uint16_t *ust = (uint16_t *)fre_buf; + saddr = (uint32_t)*ust; + } + else if (fre_type == SFRAME_FRE_TYPE_ADDR4) + { + uint32_t *uit = (uint32_t *)fre_buf; + saddr = (uint32_t)*uit; + } + else + return; + + *fre_start_addr = saddr; +} + +/* Find the function descriptor entry starting which contains the specified + address ADDR. */ + +static sframe_func_desc_entry * +sframe_get_funcdesc_with_addr_internal (sframe_decoder_ctx *ctx, int32_t addr, + int *errp) +{ + sframe_header *dhp; + sframe_func_desc_entry *fdp; + int low, high; + + if (ctx == NULL) + return NULL; + + dhp = sframe_decoder_get_header (ctx); + + if (dhp == NULL || dhp->sfh_num_fdes == 0 || ctx->sfd_funcdesc == NULL) + return NULL; + /* If the FDE sub-section is not sorted on PCs, skip the lookup because + binary search cannot be used. */ + if ((dhp->sfh_preamble.sfp_flags & SFRAME_F_FDE_SORTED) == 0) + return NULL; + + /* Do the binary search. */ + fdp = (sframe_func_desc_entry *) ctx->sfd_funcdesc; + low = 0; + high = dhp->sfh_num_fdes; + while (low <= high) + { + int mid = low + (high - low) / 2; + + /* Given sfde_func_start_address <= addr, + addr - sfde_func_start_address must be positive. */ + if (fdp[mid].sfde_func_start_address <= addr + && ((uint32_t)(addr - fdp[mid].sfde_func_start_address) + < fdp[mid].sfde_func_size)) + return fdp + mid; + + if (fdp[mid].sfde_func_start_address < addr) + low = mid + 1; + else + high = mid - 1; + } + + return NULL; +} + +/* Get the end IP offset for the FRE at index i in the FDEP. The buffer FRES + is the starting location for the FRE. */ + +static uint32_t +sframe_fre_get_end_ip_offset (sframe_func_desc_entry *fdep, unsigned int i, + const char *fres) +{ + uint32_t end_ip_offset = 0; + uint32_t fre_type; + + fre_type = sframe_get_fre_type (fdep); + + /* Get the start address of the next FRE in sequence. */ + if (i < fdep->sfde_func_num_fres - 1) + { + sframe_decode_fre_start_address (fres, &end_ip_offset, fre_type); + end_ip_offset -= 1; + } + else + /* The end IP offset for the FRE needs to be deduced from the function + size. */ + end_ip_offset = fdep->sfde_func_size - 1; + + return end_ip_offset; +} + +/* Get the SFrame's fixed FP offset given the decoder context CTX. */ + +static int8_t +sframe_decoder_get_fixed_fp_offset (sframe_decoder_ctx *ctx) +{ + sframe_header *dhp; + dhp = sframe_decoder_get_header (ctx); + return dhp->sfh_cfa_fixed_fp_offset; +} + +/* Get the SFrame's fixed RA offset given the decoder context CTX. */ + +static int8_t +sframe_decoder_get_fixed_ra_offset (sframe_decoder_ctx *ctx) +{ + sframe_header *dhp; + dhp = sframe_decoder_get_header (ctx); + return dhp->sfh_cfa_fixed_ra_offset; +} + +/* Get the base reg id from the FRE info. Set errp if failure. */ + +uint8_t +__sframe_fre_get_base_reg_id (sframe_frame_row_entry *fre) +{ + uint8_t fre_info = fre->fre_info; + return SFRAME_V1_FRE_CFA_BASE_REG_ID (fre_info); +} + +/* Get the CFA offset from the FRE. If the offset is unavailable, + sets errp. */ + +int32_t +__sframe_fre_get_cfa_offset (sframe_decoder_ctx *dctx __attribute__ ((__unused__)), + sframe_frame_row_entry *fre, + _Unwind_Reason_Code *errp) +{ + return sframe_get_fre_offset (fre, SFRAME_FRE_CFA_OFFSET_IDX, errp); +} + +/* Get the FP offset from the FRE. If the offset is unavailable, sets + errp. */ + +int32_t +__sframe_fre_get_fp_offset (sframe_decoder_ctx *dctx, + sframe_frame_row_entry *fre, + _Unwind_Reason_Code *errp) +{ + uint32_t fp_offset_idx = 0; + int8_t fp_offset = sframe_decoder_get_fixed_fp_offset (dctx); + + *errp = _URC_NO_REASON; + /* If the FP offset is not being tracked, return the fixed FP offset + from the SFrame header. */ + if (fp_offset != SFRAME_CFA_FIXED_FP_INVALID) + return fp_offset; + + /* In some ABIs, the stack offset to recover RA (using the CFA) from is + fixed (like AMD64). In such cases, the stack offset to recover FP will + appear at the second index. */ + fp_offset_idx = ((sframe_decoder_get_fixed_ra_offset (dctx) + != SFRAME_CFA_FIXED_RA_INVALID) + ? SFRAME_FRE_RA_OFFSET_IDX + : SFRAME_FRE_FP_OFFSET_IDX); + return sframe_get_fre_offset (fre, fp_offset_idx, errp); +} + +/* Get the RA offset from the FRE. If the offset is unavailable, sets + errp. */ + +int32_t +__sframe_fre_get_ra_offset (sframe_decoder_ctx *dctx, + sframe_frame_row_entry *fre, + _Unwind_Reason_Code *errp) +{ + int8_t ra_offset = sframe_decoder_get_fixed_ra_offset (dctx); + *errp = _URC_NO_REASON; + + /* If the RA offset was not being tracked, return the fixed RA offset + from the SFrame header. */ + if (ra_offset != SFRAME_CFA_FIXED_RA_INVALID) + return ra_offset; + + /* Otherwise, get the RA offset from the FRE. */ + return sframe_get_fre_offset (fre, SFRAME_FRE_RA_OFFSET_IDX, errp); +} + +/* Decode the specified SFrame buffer SF_BUF and return the new SFrame + decoder context. */ + +_Unwind_Reason_Code +__sframe_decode (sframe_decoder_ctx *dctx, const char *sf_buf) +{ + const sframe_preamble *sfp; + size_t hdrsz; + sframe_header *sfheaderp; + char *frame_buf; + + int fidx_size; + uint32_t fre_bytes; + + if (sf_buf == NULL) + return _URC_END_OF_STACK; + + sfp = (const sframe_preamble *) sf_buf; + + /* Check for foreign endianness. */ + if (sfp->sfp_magic != SFRAME_MAGIC) + return _URC_END_OF_STACK; + + frame_buf = (char *)sf_buf; + + /* Handle the SFrame header. */ + dctx->sfd_header = *(sframe_header *) frame_buf; + + /* Validate the contents of SFrame header. */ + sfheaderp = &dctx->sfd_header; + if (!sframe_header_sanity_check_p (sfheaderp)) + return _URC_END_OF_STACK; + + hdrsz = sframe_get_hdr_size (sfheaderp); + frame_buf += hdrsz; + + /* Handle the SFrame Function Descriptor Entry section. */ + fidx_size + = sfheaderp->sfh_num_fdes * sizeof (sframe_func_desc_entry); + dctx->sfd_funcdesc = (sframe_func_desc_entry *)frame_buf; + frame_buf += (fidx_size); + + dctx->sfd_fres = frame_buf; + fre_bytes = sfheaderp->sfh_fre_len; + dctx->sfd_fre_nbytes = fre_bytes; + + return _URC_NO_REASON; +} + +/* Find the SFrame Row Entry which contains the PC. Returns + _URC_END_OF_STACK if failure. */ + +_Unwind_Reason_Code +__sframe_find_fre (sframe_decoder_ctx *ctx, int32_t pc, + sframe_frame_row_entry *frep) +{ + sframe_func_desc_entry *fdep; + uint32_t fre_type, i; + uint32_t start_ip_offset; + int32_t func_start_addr; + uint32_t end_ip_offset; + const char *fres; + size_t size = 0; + int err = 0; + + if ((ctx == NULL) || (frep == NULL)) + return _URC_END_OF_STACK; + + /* Find the FDE which contains the PC, then scan its fre entries. */ + fdep = sframe_get_funcdesc_with_addr_internal (ctx, pc, &err); + if (fdep == NULL || ctx->sfd_fres == NULL) + return _URC_END_OF_STACK; + + fre_type = sframe_get_fre_type (fdep); + + fres = ctx->sfd_fres + fdep->sfde_func_start_fre_off; + func_start_addr = fdep->sfde_func_start_address; + + for (i = 0; i < fdep->sfde_func_num_fres; i++) + { + size_t addr_size; + + /* Partially decode the FRE. */ + sframe_decode_fre_start_address (fres, &frep->fre_start_addr, fre_type); + + addr_size = sframe_fre_start_addr_size (fre_type); + if (addr_size == 0) + return _URC_END_OF_STACK; + + frep->fre_info = *(uint8_t *)(fres + addr_size); + size = sframe_fre_entry_size (frep, addr_size); + + start_ip_offset = frep->fre_start_addr; + end_ip_offset = sframe_fre_get_end_ip_offset (fdep, i, fres + size); + + /* Stop search if FRE's start_ip is greater than pc. Given + func_start_addr <= pc, pc - func_start_addr must be positive. */ + if (start_ip_offset > (uint32_t) (pc - func_start_addr)) + return _URC_END_OF_STACK; + + if (sframe_fre_check_range_p (fdep, start_ip_offset, end_ip_offset, pc)) + { + /* Decode last FRE bits: offsets size. */ + frep->fre_offsets = fres + addr_size + sizeof (frep->fre_info); + return _URC_NO_REASON; + } + + fres += size; + } + return _URC_END_OF_STACK; +} diff --git a/sysdeps/generic/sframe-read.h b/sysdeps/generic/sframe-read.h new file mode 100644 index 0000000000..1db1886bce --- /dev/null +++ b/sysdeps/generic/sframe-read.h @@ -0,0 +1,106 @@ +/* Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef _SFRAME_API_H +#define _SFRAME_API_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +typedef struct sframe_decoder_ctx +{ + + sframe_header sfd_header; + + sframe_func_desc_entry *sfd_funcdesc; + /* SFrame FRE table. */ + char *sfd_fres; + /* Number of bytes needed for SFrame FREs. */ + int sfd_fre_nbytes; +} sframe_decoder_ctx; + +#define MAX_NUM_STACK_OFFSETS 3 + +/* User interfacing SFrame Row Entry. + An abstraction provided by libsframe so the consumer is decoupled from + the binary format representation of the same. + + The members are best ordered such that they are aligned at their natural + boundaries. This helps avoid usage of undesirable misaligned memory + accesses. See PR libsframe/29856. */ + +typedef struct sframe_frame_row_entry +{ + uint32_t fre_start_addr; + const char *fre_offsets; + unsigned char fre_info; +} sframe_frame_row_entry; + +/* The SFrame Decoder. */ + +/* Decode the specified SFrame buffer CF_BUF and return the new SFrame + decoder context. */ + +extern _Unwind_Reason_Code +__sframe_decode (sframe_decoder_ctx *dctx, const char *cf_buf); + +/* Find the SFrame Frame Row Entry which contains the PC. Returns + _URC_END_OF_STACK if failure. */ + +extern _Unwind_Reason_Code +__sframe_find_fre (sframe_decoder_ctx *ctx, int32_t pc, + sframe_frame_row_entry *frep); + +/* Get the base reg id from the FRE info. */ + +extern uint8_t +__sframe_fre_get_base_reg_id (sframe_frame_row_entry *fre); + +/* Get the CFA offset from the FRE. Sets ERRP if an error is + detected. */ + +extern int32_t +__sframe_fre_get_cfa_offset (sframe_decoder_ctx *dtcx, + sframe_frame_row_entry *fre, + _Unwind_Reason_Code *errp); + +/* Get the FP offset from the FRE. If the offset is unavailable, sets + ERRP. */ + +extern int32_t +__sframe_fre_get_fp_offset (sframe_decoder_ctx *dctx, + sframe_frame_row_entry *fre, + _Unwind_Reason_Code *errp); + +/* Get the RA offset from the FRE. Sets ERRP if ra offset is + unavailable. */ + +extern int32_t +__sframe_fre_get_ra_offset (sframe_decoder_ctx *dctx, + sframe_frame_row_entry *fre, + _Unwind_Reason_Code *errp); + +#ifdef __cplusplus +} +#endif + +#endif /* _SFRAME_API_H */ diff --git a/sysdeps/generic/sframe.c b/sysdeps/generic/sframe.c new file mode 100644 index 0000000000..ba0830da3d --- /dev/null +++ b/sysdeps/generic/sframe.c @@ -0,0 +1,187 @@ +/* Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include +#include +#include +#include +#include +#include + +/* Some arches like s390x needs an offset to correct the value where + SP is located in relation to CFA. */ +#ifndef SFRAME_SP_VAL_OFFSET +#define SFRAME_SP_VAL_OFFSET 0 +#endif + +static inline _Unwind_Ptr +read_stack_value (_Unwind_Ptr loc) +{ + _Unwind_Ptr value = *((_Unwind_Ptr *) loc); + return value; +} + +/* Helper to avoid PLT call in libc. Fixes elf/check-localplt + errors. */ + +static int +_dl_find_object_helper (void *address, struct dl_find_object *result) +{ + return GLRO (dl_find_object) (address, result); +} + +/* Backtrace the stack and collect the stacktrace given SFrame info. + If successful, store the return addresses in RA_LST. The SIZE + argument specifies the maximum number of return addresses that can + be stored in RA_LST and contains the number of the addresses + collected. */ + +int +__stacktrace_sframe (void **ra_lst, int count, frame *frame) +{ + _Unwind_Ptr sframe_vma, cfa, return_addr, ra_stack_loc, fp_stack_loc, pc, + frame_ptr; + int cfa_offset, fp_offset, ra_offset, i; + sframe_frame_row_entry fred, *frep = &fred; + + if (!ra_lst || !count) + return 0; + + for (i = 0; i < count; i++) + { + _Unwind_Reason_Code err; + struct dl_find_object data; + sframe_decoder_ctx decoder_context, *dctx = &decoder_context; + + /* Clean decoder context. */ + memset (dctx, 0, sizeof (sframe_decoder_ctx)); + + /* Load and set up the SFrame stack trace info for pc. */ + if (_dl_find_object_helper ((void *) frame->pc, &data) < 0) + /* Force fallback to DWARF stacktracer. */ + return 0; + + sframe_vma = (_Unwind_Ptr) data.dlfo_sframe; + if (!sframe_vma || !(data.dlfo_flags & DLFO_FLAG_SFRAME)) + { +#ifdef MD_DECODE_SIGNAL_FRAME + /* If there is no valid SFrame section or SFrame section is + corrupted then check if it is a signal frame. */ + if (MD_DECODE_SIGNAL_FRAME (frame) == _URC_NO_REASON) + { + ra_lst[i] = (void *) frame->pc; + continue; + } +#endif + /* Force fallback to DWARF stacktracer. */ + return 0; + } + + /* Decode the specified SFrame buffer populate sframe's decoder + context. */ + if (__sframe_decode (dctx, (char *) data.dlfo_sframe) != _URC_NO_REASON) + /* Force fallback to DWARF stacktracer. */ + return 0; + + pc = frame->pc - sframe_vma; + /* Find the SFrame Row Entry which contains the PC. */ + if (__sframe_find_fre (dctx, pc, frep) == _URC_END_OF_STACK) + { +#ifdef MD_DECODE_SIGNAL_FRAME + /* If there are no valid FREs, check if it is a signal + frame, and if so decode it. */ + if (MD_DECODE_SIGNAL_FRAME (frame) == _URC_NO_REASON) + { + ra_lst[i] = (void *) frame->pc; + continue; + } +#endif +#ifdef MD_DETECT_OUTERMOST_FRAME + if (MD_DETECT_OUTERMOST_FRAME (frame) == _URC_END_OF_STACK) + return i; +#endif + /* Force fallback to DWARF stacktracer. */ + return 0; + } + + /* Get the CFA offset from the FRE. If offset is unavailable, + sets err. */ + cfa_offset = __sframe_fre_get_cfa_offset (dctx, frep, &err); + if (err != _URC_NO_REASON) + /* Force fallback to DWARF stacktracer. */ + return 0; + + /* Get CFA using base reg id from the FRE info. */ + cfa = ((__sframe_fre_get_base_reg_id (frep) + == SFRAME_BASE_REG_SP) ? frame->sp : frame->fp) + cfa_offset; + + /* Get the RA offset from the FRE. If the offset is + unavailable, sets err. */ + ra_offset = __sframe_fre_get_ra_offset (dctx, frep, &err); + if (err != _URC_NO_REASON) + /* Force fallback to DWARF stacktracer. */ + return 0; + + /* RA offset is available, get the value stored in the stack + location. */ + ra_stack_loc = cfa + ra_offset; + return_addr = read_stack_value (ra_stack_loc); + + ra_lst[i] = (void *) return_addr; + + /* Get the FP offset from the FRE. If the offset is + unavailable, sets err. */ + fp_offset = __sframe_fre_get_fp_offset (dctx, frep, &err); + frame_ptr = frame->fp; + if (err == _URC_NO_REASON) + { + /* FP offset is available, get the value stored in the stack + location. */ + fp_stack_loc = cfa + fp_offset; + frame_ptr = read_stack_value (fp_stack_loc); + } + + /* Set up for the next frame. */ + frame->fp = frame_ptr; + frame->sp = cfa + SFRAME_SP_VAL_OFFSET; + frame->pc = return_addr; + } + return i; +} + +libc_hidden_def (__stacktrace_sframe); + +/* A noinline helper used to obtain the caller's current PC. */ + +_Unwind_Ptr __attribute__ ((noinline)) +__getPC (void) +{ + return (_Unwind_Ptr) + __builtin_extract_return_addr (__builtin_return_address (0)); +} + +libc_hidden_def (__getPC); + +/* A noinline helper used to obtain the caller's current SP. It + mimics gcc14's __builtin_stack_address() functionality. */ + +_Unwind_Ptr __attribute__ ((noinline)) +__getSP (void) +{ + return (_Unwind_Ptr) __builtin_dwarf_cfa() + SFRAME_SP_VAL_OFFSET; +} + +libc_hidden_def (__getSP); diff --git a/sysdeps/generic/sframe.h b/sysdeps/generic/sframe.h new file mode 100644 index 0000000000..3f8ff1c80e --- /dev/null +++ b/sysdeps/generic/sframe.h @@ -0,0 +1,367 @@ +/* SFrame format description. + Copyright (C) 2022-2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not see + . */ + +#ifndef _SFRAME_H +#define _SFRAME_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* SFrame format. + + SFrame format is a simple format to represent the information needed + for generating vanilla backtraces. SFrame format keeps track of the + minimal necessary information needed for stack tracing: + - Canonical Frame Address (CFA) + - Frame Pointer (FP) + - Return Address (RA) + + The SFrame section itself has the following structure: + + +--------+------------+---------+ + | file | function | frame | + | header | descriptor | row | + | | entries | entries | + +--------+------------+---------+ + + The file header stores a magic number and version information, flags, and + the byte offset of each of the sections relative to the end of the header + itself. The file header also specifies the total number of Function + Descriptor Entries, Frame Row Entries and length of the FRE sub-section. + + Following the header is a list of Function Descriptor Entries (FDEs). + This list may be sorted if the flags in the file header indicate it to be + so. The sort order, if applicable, is the order of functions in the + .text.* sections in the resulting binary artifact. Each Function + Descriptor Entry specifies the start PC of a function, the size in bytes + of the function and an offset to its first Frame Row Entry (FRE). Each FDE + additionally also specifies the type of FRE it uses to encode the stack + trace information. + + Next, the SFrame Frame Row Entry sub-section is a list of variable size + records. Each entry represents stack trace information for a set of PCs + of the function. A singular Frame Row Entry is a self-sufficient record + which contains information on how to generate stack trace from the + applicable set of PCs. + + */ + + +/* SFrame format versions. */ +#define SFRAME_VERSION_1 1 +#define SFRAME_VERSION_2 2 +/* SFrame magic number. */ +#define SFRAME_MAGIC 0xdee2 +/* Current version of SFrame format. */ +#define SFRAME_VERSION SFRAME_VERSION_2 + +/* Various flags for SFrame. */ + +/* Function Descriptor Entries are sorted on PC. */ +#define SFRAME_F_FDE_SORTED 0x1 +/* Functions preserve frame pointer. */ +#define SFRAME_F_FRAME_POINTER 0x2 + +#define SFRAME_CFA_FIXED_FP_INVALID 0 +#define SFRAME_CFA_FIXED_RA_INVALID 0 + +/* Supported ABIs/Arch. */ +#define SFRAME_ABI_AARCH64_ENDIAN_BIG 1 /* AARCH64 big endian. */ +#define SFRAME_ABI_AARCH64_ENDIAN_LITTLE 2 /* AARCH64 little endian. */ +#define SFRAME_ABI_AMD64_ENDIAN_LITTLE 3 /* AMD64 little endian. */ + +/* SFrame FRE types. */ +#define SFRAME_FRE_TYPE_ADDR1 0 +#define SFRAME_FRE_TYPE_ADDR2 1 +#define SFRAME_FRE_TYPE_ADDR4 2 + +/* SFrame Function Descriptor Entry types. + + The SFrame format has two possible representations for functions. The + choice of which type to use is made according to the instruction patterns + in the relevant program stub. + + An SFrame FDE of type SFRAME_FDE_TYPE_PCINC is an indication + that the PCs in the FREs should be treated as increments in bytes. This is + used for a bulk of the executable code of a program, which contains + instructions with no specific pattern. + + An SFrame FDE of type SFRAME_FDE_TYPE_PCMASK is an indication + that the PCs in the FREs should be treated as masks. This type is useful + for the cases when a small pattern of instructions in a program stub is + repeatedly to cover a specific functionality. Typical usescases are pltN + entries, trampolines etc. */ + +/* Unwinders perform a (PC >= FRE_START_ADDR) to look up a matching FRE. */ +#define SFRAME_FDE_TYPE_PCINC 0 +/* Unwinders perform a (PC % REP_BLOCK_SIZE >= FRE_START_ADDR) to look up a + matching FRE. */ +#define SFRAME_FDE_TYPE_PCMASK 1 + +typedef struct sframe_preamble +{ + uint16_t sfp_magic; /* Magic number (SFRAME_MAGIC). */ + uint8_t sfp_version; /* Data format version number (SFRAME_VERSION). */ + uint8_t sfp_flags; /* Flags. */ +} __attribute__ ((packed)) sframe_preamble; + +typedef struct sframe_header +{ + sframe_preamble sfh_preamble; + /* Information about the arch (endianness) and ABI. */ + uint8_t sfh_abi_arch; + /* Offset for the Frame Pointer (FP) from CFA may be fixed for some + ABIs (e.g, in AMD64 when -fno-omit-frame-pointer is used). When fixed, + this field specifies the fixed stack frame offset and the individual + FREs do not need to track it. When not fixed, it is set to + SFRAME_CFA_FIXED_FP_INVALID, and the individual FREs may provide + the applicable stack frame offset, if any. */ + int8_t sfh_cfa_fixed_fp_offset; + /* Offset for the Return Address from CFA is fixed for some ABIs + (e.g., AMD64 has it as CFA-8). When fixed, the header specifies the + fixed stack frame offset and the individual FREs do not track it. When + not fixed, it is set to SFRAME_CFA_FIXED_RA_INVALID, and individual + FREs provide the applicable stack frame offset, if any. */ + int8_t sfh_cfa_fixed_ra_offset; + /* Number of bytes making up the auxiliary header, if any. + Some ABI/arch, in the future, may use this space for extending the + information in SFrame header. Auxiliary header is contained in + bytes sequentially following the sframe_header. */ + uint8_t sfh_auxhdr_len; + /* Number of SFrame FDEs in this SFrame section. */ + uint32_t sfh_num_fdes; + /* Number of SFrame Frame Row Entries. */ + uint32_t sfh_num_fres; + /* Number of bytes in the SFrame Frame Row Entry section. */ + uint32_t sfh_fre_len; + /* Offset of SFrame Function Descriptor Entry section. */ + uint32_t sfh_fdeoff; + /* Offset of SFrame Frame Row Entry section. */ + uint32_t sfh_freoff; +} __attribute__ ((packed)) sframe_header; + +#define SFRAME_V1_HDR_SIZE(sframe_hdr) \ + ((sizeof (sframe_header) + (sframe_hdr).sfh_auxhdr_len)) + +/* Two possible keys for executable (instruction) pointers signing. */ +#define SFRAME_AARCH64_PAUTH_KEY_A 0 /* Key A. */ +#define SFRAME_AARCH64_PAUTH_KEY_B 1 /* Key B. */ + +typedef struct sframe_func_desc_entry +{ + /* Function start address. Encoded as a signed offset, relative to the + beginning of the current FDE. */ + int32_t sfde_func_start_address; + /* Size of the function in bytes. */ + uint32_t sfde_func_size; + /* Offset of the first SFrame Frame Row Entry of the function, relative to the + beginning of the SFrame Frame Row Entry sub-section. */ + uint32_t sfde_func_start_fre_off; + /* Number of frame row entries for the function. */ + uint32_t sfde_func_num_fres; + /* Additional information for stack tracing from the function: + - 4-bits: Identify the FRE type used for the function. + - 1-bit: Identify the FDE type of the function - mask or inc. + - 1-bit: PAC authorization A/B key (aarch64). + - 2-bits: Unused. + ------------------------------------------------------------------------ + | Unused | PAC auth A/B key (aarch64) | FDE type | FRE type | + | | Unused (amd64) | | | + ------------------------------------------------------------------------ + 8 6 5 4 0 */ + uint8_t sfde_func_info; + /* Size of the block of repeating insns. Used for SFrame FDEs of type + SFRAME_FDE_TYPE_PCMASK. */ + uint8_t sfde_func_rep_size; + uint16_t sfde_func_padding2; +} __attribute__ ((packed)) sframe_func_desc_entry; + +/* Macros to compose and decompose function info in FDE. */ + +/* Note: Set PAC auth key to SFRAME_AARCH64_PAUTH_KEY_A by default. */ +#define SFRAME_V1_FUNC_INFO(fde_type, fre_enc_type) \ + (((SFRAME_AARCH64_PAUTH_KEY_A & 0x1) << 5) | \ + (((fde_type) & 0x1) << 4) | ((fre_enc_type) & 0xf)) + +#define SFRAME_V1_FUNC_FRE_TYPE(data) ((data) & 0xf) +#define SFRAME_V1_FUNC_FDE_TYPE(data) (((data) >> 4) & 0x1) +#define SFRAME_V1_FUNC_PAUTH_KEY(data) (((data) >> 5) & 0x1) + +/* Set the pauth key as indicated. */ +#define SFRAME_V1_FUNC_INFO_UPDATE_PAUTH_KEY(pauth_key, fde_info) \ + ((((pauth_key) & 0x1) << 5) | ((fde_info) & 0xdf)) + +/* Size of stack frame offsets in an SFrame Frame Row Entry. A single + SFrame FRE has all offsets of the same size. Offset size may vary + across frame row entries. */ +#define SFRAME_FRE_OFFSET_1B 0 +#define SFRAME_FRE_OFFSET_2B 1 +#define SFRAME_FRE_OFFSET_4B 2 + +/* An SFrame Frame Row Entry can be SP or FP based. */ +#define SFRAME_BASE_REG_FP 0 +#define SFRAME_BASE_REG_SP 1 + +/* The index at which a specific offset is presented in the variable length + bytes of an FRE. */ +#define SFRAME_FRE_CFA_OFFSET_IDX 0 +/* The RA stack offset, if present, will always be at index 1 in the variable + length bytes of the FRE. */ +#define SFRAME_FRE_RA_OFFSET_IDX 1 +/* The FP stack offset may appear at offset 1 or 2, depending on the ABI as RA + may or may not be tracked. */ +#define SFRAME_FRE_FP_OFFSET_IDX 2 + +typedef struct sframe_fre_info +{ + /* Information about + - 1 bit: base reg for CFA + - 4 bits: Number of offsets (N). A value of upto 3 is allowed to track + all three of CFA, FP and RA (fixed implicit order). + - 2 bits: information about size of the offsets (S) in bytes. + Valid values are SFRAME_FRE_OFFSET_1B, SFRAME_FRE_OFFSET_2B, + SFRAME_FRE_OFFSET_4B + - 1 bit: Mangled RA state bit (aarch64 only). + ---------------------------------------------------------------------------------- + | Mangled-RA (aarch64) | Size of offsets | Number of offsets | base_reg | + | Unused (amd64) | | | | + ---------------------------------------------------------------------------------- + 8 7 5 1 0 + + */ + uint8_t fre_info; +} sframe_fre_info; + +/* Macros to compose and decompose FRE info. */ + +/* Note: Set mangled_ra_p to zero by default. */ +#define SFRAME_V1_FRE_INFO(base_reg_id, offset_num, offset_size) \ + (((0 & 0x1) << 7) | (((offset_size) & 0x3) << 5) | \ + (((offset_num) & 0xf) << 1) | ((base_reg_id) & 0x1)) + +/* Set the mangled_ra_p bit as indicated. */ +#define SFRAME_V1_FRE_INFO_UPDATE_MANGLED_RA_P(mangled_ra_p, fre_info) \ + ((((mangled_ra_p) & 0x1) << 7) | ((fre_info) & 0x7f)) + +#define SFRAME_V1_FRE_CFA_BASE_REG_ID(data) ((data) & 0x1) +#define SFRAME_V1_FRE_OFFSET_COUNT(data) (((data) >> 1) & 0xf) +#define SFRAME_V1_FRE_OFFSET_SIZE(data) (((data) >> 5) & 0x3) +#define SFRAME_V1_FRE_MANGLED_RA_P(data) (((data) >> 7) & 0x1) + +/* SFrame Frame Row Entry definitions. + + Used for both AMD64 and AARCH64. + + An SFrame Frame Row Entry is a self-sufficient record which contains + information on how to generate the stack trace for the specified range of + PCs. Each SFrame Frame Row Entry is followed by S*N bytes, where: + S is the size of the stack frame offset for the FRE, and + N is the number of stack frame offsets in the FRE + + The interpretation of FRE stack offsets is ABI-specific: + + AMD64: + offset1 (interpreted as CFA = BASE_REG + offset1) + if FP is being tracked + offset2 (intrepreted as FP = CFA + offset2) + fi + + AARCH64: + offset1 (interpreted as CFA = BASE_REG + offset1) + if FP is being tracked (in other words, if frame record created) + offset2 (interpreted as RA = CFA + offset2) + offset3 (intrepreted as FP = CFA + offset3) + fi + Note that in AAPCS64, a frame record, if created, will save both FP and + LR on stack. +*/ + +/* Used when SFRAME_FRE_TYPE_ADDR1 is specified as FRE type. */ +typedef struct sframe_frame_row_entry_addr1 +{ + /* Start address of the frame row entry. Encoded as an 1-byte unsigned + offset, relative to the start address of the function. */ + uint8_t sfre_start_address; + sframe_fre_info sfre_info; +} __attribute__ ((packed)) sframe_frame_row_entry_addr1; + +/* Upper limit of start address in sframe_frame_row_entry_addr1 + is 0x100 (not inclusive). */ +#define SFRAME_FRE_TYPE_ADDR1_LIMIT \ + (1ULL << ((SFRAME_FRE_TYPE_ADDR1 + 1) * 8)) + +/* Used when SFRAME_FRE_TYPE_ADDR2 is specified as FRE type. */ +typedef struct sframe_frame_row_entry_addr2 +{ + /* Start address of the frame row entry. Encoded as an 2-byte unsigned + offset, relative to the start address of the function. */ + uint16_t sfre_start_address; + sframe_fre_info sfre_info; +} __attribute__ ((packed)) sframe_frame_row_entry_addr2; + +/* Upper limit of start address in sframe_frame_row_entry_addr2 + is 0x10000 (not inclusive). */ +#define SFRAME_FRE_TYPE_ADDR2_LIMIT \ + (1ULL << ((SFRAME_FRE_TYPE_ADDR2 * 2) * 8)) + +/* Used when SFRAME_FRE_TYPE_ADDR4 is specified as FRE type. */ +typedef struct sframe_frame_row_entry_addr4 +{ + /* Start address of the frame row entry. Encoded as a 4-byte unsigned + offset, relative to the start address of the function. */ + uint32_t sfre_start_address; + sframe_fre_info sfre_info; +} __attribute__ ((packed)) sframe_frame_row_entry_addr4; + +/* Upper limit of start address in sframe_frame_row_entry_addr2 + is 0x100000000 (not inclusive). */ +#define SFRAME_FRE_TYPE_ADDR4_LIMIT \ + (1ULL << ((SFRAME_FRE_TYPE_ADDR4 * 2) * 8)) + +/* Used to pass frame information to stack trace routine. */ +typedef struct cframe +{ + _Unwind_Ptr pc; + _Unwind_Ptr sp; + _Unwind_Ptr fp; +} frame; + +/* SFrame stack tracing support. */ +int __stacktrace_sframe (void **, int, frame *); +libc_hidden_proto (__stacktrace_sframe); + +/* Helper used by SFrame tracing algorithm. */ +_Unwind_Ptr __getPC (void); +libc_hidden_proto (__getPC); + +/* Helper used by SFrame tracing algorithm. */ +_Unwind_Ptr __getSP (void); +libc_hidden_proto (__getSP); + +#ifdef __cplusplus +} +#endif + +#endif /* _SFRAME_H */ diff --git a/sysdeps/generic/uw-sigframe.h b/sysdeps/generic/uw-sigframe.h new file mode 100644 index 0000000000..b357f8aa76 --- /dev/null +++ b/sysdeps/generic/uw-sigframe.h @@ -0,0 +1,31 @@ +/* Internal header file for handling signal frames. Generic version. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Each architecture that supports SFrame may need to define several + macros to handle exceptional cases during stack backtracing. + + MD_DECODE_SIGNAL_FRAME(frame) should recover frame information when + a signal-related exception occurs. The input frame must contain a + valid program counter (PC) field. On success, the macro should + return _URC_NO_REASON. + + MD_DETECT_OUTERMOST_FRAME(frame) is used to detect the outermost + stack frame. It returns _URC_NO_REASON upon successful + detection. + + The FRAME structure is defined in sysdeps/generic/sframe.h */ From patchwork Mon Jul 14 07:59:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu-Ianculescu X-Patchwork-Id: 116220 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2CFC33858410 for ; Mon, 14 Jul 2025 08:03:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2CFC33858410 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2025-04-25 header.b=QMTg8SMU; dkim=pass (1024-bit key, unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=xaJs6fqV X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 320FA3858C62 for ; Mon, 14 Jul 2025 08:00:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 320FA3858C62 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 320FA3858C62 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.177.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480024; cv=pass; b=TYS0L5xGpQnDlyYxxTywKeckAlYOpJ8Qi+17WoMXTZ6IkZs75H/EAf3D7th/B6mmi7b1oKwSSvY8BaQuvTZeczRyNC0ZL3KnYjU1WGk0qn8AN5DNx29Nyjj5t5wZT9z68XEcx8ghScdhaUYyW+Xd/xZuMcweCeopodKd8AsEFSw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480024; c=relaxed/simple; bh=TbcfHziYAfhOo8WEuoxnh9KUCHU4lgeH7LflUyqfXD8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=frDSkub0LNQYqoSZR4k81UzZ/jQj5OdMVCP1YFb7Entr632wKrBkSKPA560a9OHfsmdugWl4I8hFEYCpSFYsdzUZkOgLQnrLawIHJ/hs66UxJqtvkiQl+x6SDEseQbeBWs+6ImgQ4Vym8iP0RK3Woq/x+9nlsJrFEQK8EzsJg1M= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 320FA3858C62 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56E5ZPWi006876; Mon, 14 Jul 2025 08:00:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2025-04-25; bh=/9EEUzpBx5FmmwJnCWdAUF4DzrIu4n1YFOzKoJqrXkw=; b= QMTg8SMUfqtTjF4n1u+SbxdEXa8P7O5Q1bFgbZSuPMHpR2XT68i0SnL/2Za2pe9J KukF03l0IhuTfnVPUHHmw320nlG0qSPZ1KVmpA+idWw0BZZJK/45gIYeCXd4V03y NrOyM8x04oms+gaR2UJ8qhKHmgo5GVU8bTUTtXkcNA2f7xdAJQug8rmuDV6/5c0G lMrQ6Lie9q5qeGg59dcFhG3bAAHZ7M4A8ObUiZZwxAZ2RIgKPcelU0Mlj44g2lEj HzRaSWo468HmUBgLZegsZMTsXU/8PpWbs6KqgE9iZcDZrcse3R77rZXYt0dJkT/e 0mUrnF7/eajJYy3P8ysWSg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 47ujr0uk6s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:19 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 56E68AEM014046; Mon, 14 Jul 2025 08:00:19 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04on2060.outbound.protection.outlook.com [40.107.100.60]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 47ue57rnc3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=klJ7Mht2RCOf5EAg/yyRh81hKZ8Phw+WrKHl0tUpNgkb4STqAC3TZ5sfQNqlxaWNWUWeueLV1iDEEsrbuRkhd8/VX/XeRhX5sdo0arVNXfRUUlawWs3Mvu0jUdTYVAslmfW6rnThtQfg85JMTfFdg1yy0B/ljVEi5+K64sxVBUXuO68uq9aWCUsM/K7e/5BpxAlDD7CLw5WKQ97+uH4sktR7Py1WLnkfg4st3HQ77a7haY+Qd3J4h9fN7xj6nefNtz5tsyr2eRfpGPIhJjk6mDR0i4X4vwFTwDMWdUIhqhZYK8CDEr9bKZiaaVQdzr0i9P1gsClh+uTRTlr/VKnt8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/9EEUzpBx5FmmwJnCWdAUF4DzrIu4n1YFOzKoJqrXkw=; b=BWkdzo5pCGwX01Fjh9MmhEFC4+LnvaSDpvvfMznmeD5uA2EG9887Uv4tHgoRpLjEPcvW2jLxYnryMCqCTSSy4ep6CiMM7EVT9BFbUxPPo05tknyrU0BRaZ5CkGbk4PkkqH3eFxpi0v1Ca7VicCXV/WllORNU2OOyPXJF5yWF621m1xVtnhg/2HtgtRTt1Si5Ovx4XUaj00xoGI3o5IjdXBElgagApucafsIdfE3ZKosA+DMQNjhcZVWdcYCpz39OnYhbtc8MlZTvFNQfC4mxQkNj/974GsfEVCqH9rE7ZvGBucmCrIDUQl5AZ65+1rN+FR7WMy+8IWED0Y7bH//1Bw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/9EEUzpBx5FmmwJnCWdAUF4DzrIu4n1YFOzKoJqrXkw=; b=xaJs6fqVjjtMHdzLgiOA0RrjrL1pZ1aX+QC8RqQC/HEWpZT1e/PrYcTp7Uok6rAxTdXuAqAI0tKtyY1LRcTgH6h2VY6LGsFWdsj6k2FPoWMi/qpOwKi4HUT2phRqjtrX6dJP9ZTz5T8k6KSyQ13+soerkJpHJFxezOkyKO/OgLI= Received: from DS7PR10MB5998.namprd10.prod.outlook.com (2603:10b6:8:9e::20) by SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8880.34; Mon, 14 Jul 2025 08:00:16 +0000 Received: from DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed]) by DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed%5]) with mapi id 15.20.8922.028; Mon, 14 Jul 2025 08:00:15 +0000 From: claudiu.zissulescu-ianculescu@oracle.com To: libc-alpha@sourceware.org Cc: jose.marchesi@oracle.com, elena.zannoni@oracle.com, indu.bhagat@oracle.com, jremus@linux.ibm.com, dj@redhat.com, adhemerval.zanella@linaro.org, fweimer@redhat.com Subject: [PATCH v8 5/6] configure: Add --enable-sframe option Date: Mon, 14 Jul 2025 10:59:25 +0300 Message-ID: <20250714075926.34870-6-claudiu.zissulescu-ianculescu@oracle.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250714075926.34870-5-claudiu.zissulescu-ianculescu@oracle.com> References: <20250714075926.34870-1-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-2-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-3-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-4-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-5-claudiu.zissulescu-ianculescu@oracle.com> X-ClientProxiedBy: BE1P281CA0107.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7b::15) To CY5PR10MB6011.namprd10.prod.outlook.com (2603:10b6:930:28::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5998:EE_|SJ0PR10MB5768:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b406a27-cd8c-41e2-90cc-08ddc2ac7686 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: MzGkInj+JdHLf7kRdFHCKn4sRc+CIPgDyrY/YTKemaeBYfGjcPPxIGICcjCyZKg0kfzbp5U7THzZszja+NGR6vCqbUHxxnfG1LeQ2Oa6huXwAQ50b2qdFAlXkFW3bjVZczEx8/cqtoxSQN4erxEDci/2V3kxdh93b2XHyJe9Nd3BLTY7ZtY0sosmurFHeYt1uTHPKydFle7NFhvl7AJ91iwDgu+FC8ORtkdXM+fm7N5R8pqA+V4iaLmwTJJONuediQbH0bmd4v9617F1frwMe5ThrBKeSxBSvwTY1sKh5ZBMPUaR7qkX1U3n9x6Aucc8A8mzoNgL0ZAc4T5uWqTeJUDmCINz3DK4s2wFln4yLNEdJRJVe+3HN6cCJJ4E+qURLNRl4ZRrJP5xVr8hErbzX95WhXJO0guDmOJpi4ASAceivgLGcc1y1FELddTrs55r1Od1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998.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L46tblAp3v0/YP+ZMDIpUYg+Z3oQPra7DVmFU9psaCwPvg7aWFRbswAMquA9TTjEPkU0RCqGQnhn+Bp3nxzh3Vjv+4Coe+yCDHGqOK9vNurPkHTXwZuK3wN0tfXtpjcHCrwHn2//8FYxO3TDgfPTqUv+vMtLS8lBVRGPY3lvSVXAF08y8pkH6+IJjvk1QU64Nu6G7eR2fjWYvnovzJxh0F7vK5RhyAe2ANNg7WjPjbrixh9s9XLaOMFQwtX16FUcosSKgE5UyBXvLxn+wnQFCN5SO1PQFMRX/htE/98xaco7DmCH086hVn7NViYlfVbaxwUTD/TZi+O6lrtM906Ovl5Hw/61yzNP4Xt0lpM8nlI7V/Vv24JcuKRbB9ce3z1Vfe9Z2H4p2UjQivOpZd1waZAsuJNGMaNrL4Fm0H9fsgrcWU62RekSScpuBVYcY8tDRPQtQO5S4eaNZR5ITo0wvfRW7t4dGCyZhAIUFiBtWCLZAI+xNueceY681G4NzW5+6Jk2cvOy/q4Dk9U4x6s16hZVxq7HgYpbd3Twpuny4nqa49DLov8+8X/VqeYNNAMxO5VeGZBnV274fE9ZAWdA4jcVQo/wxcPkZkYmDwRqGXNS2HtLyXryyuZq0Sf7H9MTuu+L0zI6HZPBKlptGOe6itfc6czexp4OSkwjLpdu7UilyrLTC9e86LDV4fPa+1qPfSW4BFx/GPXnxx02qJdlPNcdLcHVM1X1myi1hG4HC59wwYk48W3vr+Sq7e9uA41LG17HX/n3GL4CpAZvW2wwmLK57lXLVXruTbaXXxrZYUpJ19+MTA4/RC9Wkyc4wB9qnCHWvdaXh+hGd5s3LL/GlHxXS6rya5yt61NnZOBN2ZzKjH9+53EZJiqohYe5563+TQJYFRUob7ln3A9XdX9g/tB5mRif/lbGMGfW1vp8bnVOMFzC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N97wRN+uYEsNP1ZJV56IPGm/K5kMZEp/olk+b5t15IwZekTJs3rwBbz9/iLfANH54AHUIOoHnxme6ZKWXP+L8XfDuB4vUaUU8rPH2mIhbOHijCQras0CNK2GjjWDhNOdgQXc3P7abhjPvdSPH6sIzi82ImqzB+lUVx+AWxQjJZrMyQurLmDYGfNan0Z88nNjzyydCPlcQv7dCsT1Sj0RZCS4eTuFbtJJoMKrvaBR6/7l1auXEM+AZNEptxB5cZS7LidMKm8VDdJ/GLroBBWFD4xQAkSi11r7hIm4OCUzl6bDxUGJVKrvA3idkYT+QJ7Li8WtHwUeNhCadbIJZP51hgY2o= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b406a27-cd8c-41e2-90cc-08ddc2ac7686 X-MS-Exchange-CrossTenant-AuthSource: CY5PR10MB6011.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2025 08:00:14.1433 (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: UPRVsETHjUgHDva9vHaLlTAHjbqOBYZS0RHIGrO6Sp+YLbWVv7BSu/eMb/jrtobMyhrV0UVkoOFl4zxxV2QxySLY3uRi+ZgX+bfEW5Fyrxf4uOKnr/N/t99KJGC9gRCO0e5zg5s6rki7RdSy/RCUSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5768 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-09_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 malwarescore=0 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2507140046 X-Authority-Analysis: v=2.4 cv=d9T1yQjE c=1 sm=1 tr=0 ts=6874b913 b=1 cx=c_pps a=zPCbziy225d3KhSqZt3L1A==:117 a=zPCbziy225d3KhSqZt3L1A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=Wb1JkmetP80A:10 a=GoEa3M9JfhUA:10 a=yPCof4ZbAAAA:8 a=ymm9HXo0v2evHImVjXAA:9 a=3ZKOabzyN94A:10 cc=ntf awl=host:12061 X-Proofpoint-ORIG-GUID: RQUbdhs7HiJIGUAu_ByVYKzsMaKPuvP6 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA0NiBTYWx0ZWRfXx/rSvDp0SVme bZKObFDklZanQ+CqI3eaYpMUFI/ZLcrKzn6et2CU5lv8TE8qDpytf7xoZMga0SEgY6SsVJ6RgV1 xaWRzQ0zSyaphbmbR78Vuk4uIdMivImVmydIGbMis7Kf5Qe8r3Ay1YgI6AtCpuzBLJ0zDQpoJZy rAGVU17uoANxnGrEcHjTmpakJizVrH0picFJgnc1HindROEljV5d9fe0Fp1Qmoen7Cean8aSofu v+6Fw8WYt9gQBUArrgt3LYG767iJb+TEVvN+McV56j77PqNeM/tGSltco5nmR/vedXWRt1j+eKp 0r8lGFZyZRJj1splRIEV1w/8EJKAN8pMRzL7d5zb0LjIC0vB/6eX2llR32L290/XoeVOwd98QKD /A6zfxpzXUhwfJ2R+Akedt8fQcJ9EajvutUbqPp/ix2AO4c2tvVNPFefiwoWHDYssHqupGjl X-Proofpoint-GUID: RQUbdhs7HiJIGUAu_ByVYKzsMaKPuvP6 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_NONE, TXREP 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Claudiu Zissulescu Enable SFrame stack track information. The --enable-sframe option allows the glibc build to compile with SFrame stack track information. Thus, enabling glibc's backtrace to work within glibc. Signed-off-by: Claudiu Zissulescu --- INSTALL | 5 ++ Makeconfig | 8 ++- NEWS | 4 ++ config.make.in | 1 + configure | 129 ++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 44 +++++++++++++++ manual/install.texi | 5 ++ 7 files changed, 195 insertions(+), 1 deletion(-) diff --git a/INSTALL b/INSTALL index 1c4d4b990f..cf60e1a380 100644 --- a/INSTALL +++ b/INSTALL @@ -291,6 +291,11 @@ passed to 'configure'. For example: Default is to disable fortification. +'--disable-sframe' + By default, the GNU C Library is built with '-Wa,--gsframe' if the + current GNU 'binutils' supports it. You may want to use this + option if you don't plan to use SFrame stack tracer. + To build the library and related programs, type 'make'. This will produce a lot of output, some of which may look like errors from 'make' but aren't. Look for error messages from 'make' containing '***'. diff --git a/Makeconfig b/Makeconfig index 1bb143e950..8ca41049af 100644 --- a/Makeconfig +++ b/Makeconfig @@ -1022,6 +1022,12 @@ endif # Filter out 64 bit time_t flags if compiler defines it by default. +cflags += $(no-time-bits-source) +# Enable SFrame while compiling for stack backtracing. +ifeq ($(enable-gsframe),yes) +as-sframe = -Wa,--gsframe +endif ++cflags += $(as-sframe) + # Each sysdeps directory can contain header files that both will be # used to compile and will be installed. Each can also contain an # include/ subdirectory, whose header files will be used to compile @@ -1170,7 +1176,7 @@ endif ifndef ASFLAGS ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS)) endif -override ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu) +override ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu) $(as-sframe) move-if-change = $(SHELL) $(..)scripts/move-if-change diff --git a/NEWS b/NEWS index cc668344c1..59b0b18f0d 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,10 @@ Major new features: speed_t is redefined to simply be the baud rate specified as an unsigned int, which matches the kernel interface. +* New stack tracer using SFrame. Introducing --disable-sframe a new + configuration flag. Building glibc using sframe is automatically + enabled when the build system supports it. + Deprecated and removed features, and other changes affecting compatibility: * The glibc.rtld.execstack now supports a compatibility mode to allow diff --git a/config.make.in b/config.make.in index 59897eaec2..382e003d87 100644 --- a/config.make.in +++ b/config.make.in @@ -51,6 +51,7 @@ c++-cstdlib-header = @CXX_CSTDLIB_HEADER@ c++-cmath-header = @CXX_CMATH_HEADER@ c++-bits-std_abs-h = @CXX_BITS_STD_ABS_H@ enable-werror = @enable_werror@ +enable-gsframe = @enable_gsframe@ have-z-execstack = @libc_cv_z_execstack@ have-no-error-execstack = @libc_cv_no_error_execstack@ diff --git a/configure b/configure index 53f7d1fce8..6595d6be54 100755 --- a/configure +++ b/configure @@ -620,6 +620,8 @@ DEFINES static_nss profile libc_cv_multidir +enable_gsframe +READELF_SFRAME libc_cv_test_x86_have_amx_tile test_enable_cet libc_cv_test_cc_mprefer_vector_width @@ -822,6 +824,7 @@ enable_mathvec enable_cet enable_scv enable_fortify_source +enable_sframe with_cpu ' ac_precious_vars='build_alias @@ -1507,6 +1510,8 @@ Optional Features: Use -D_FORTIFY_SOURCE=[1|2|3] to control code hardening, defaults to highest possible value supported by the build compiler. + --disable-sframe Disable building with SFrame stack trace information + [default=yes if GNU as is 2.41 or older] Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -4885,6 +4890,16 @@ case "$enable_fortify_source" in *) as_fn_error $? "Not a valid argument for --enable-fortify-source: \"$enable_fortify_source\"" "$LINENO" 5;; esac +# Check whether --enable-sframe was given. +if test ${enable_sframe+y} +then : + enableval=$enable_sframe; use_sframe=$enableval +else case e in #( + e) use_sframe=notset ;; +esac +fi + + # We keep the original values in `$config_*' and never modify them, so we # can write them unchanged into config.make. Everything else uses # $machine, $vendor, and $os, and changes them whenever convenient. @@ -9341,6 +9356,120 @@ have-libgcc_s = $libc_cv_have_libgcc_s" +# Glibc stacktracer supports SFrame v2 or newer +libc_cv_readelf_version_ok=yes +# SFrame is supported from 2.41 or higher +for ac_prog in $READELF +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_READELF_SFRAME+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$READELF_SFRAME"; then + ac_cv_prog_READELF_SFRAME="$READELF_SFRAME" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_READELF_SFRAME="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +READELF_SFRAME=$ac_cv_prog_READELF_SFRAME +if test -n "$READELF_SFRAME"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $READELF_SFRAME" >&5 +printf "%s\n" "$READELF_SFRAME" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$READELF_SFRAME" && break +done + +if test -z "$READELF_SFRAME"; then + ac_verc_fail=yes +else + # Found it, now check the version. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking version of $READELF_SFRAME" >&5 +printf %s "checking version of $READELF_SFRAME... " >&6; } + ac_prog_version=`$READELF_SFRAME --version 2>&1 | sed -n 's/^.*GNU readelf.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 2.4[1-9]*|2.[5-9][0-9]*|[3-9].*|[1-9][0-9][0-9]*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + + esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_prog_version" >&5 +printf "%s\n" "$ac_prog_version" >&6; } +fi +if test $ac_verc_fail = yes; then + libc_cv_readelf_version_ok=no +fi + + +# Check the current toolchain for SFrame support +if test $libc_cv_readelf_version_ok = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SFrame support" >&5 +printf %s "checking for SFrame support... " >&6; } +if test ${libc_cv_default_sframe+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat > conftest.c </dev/null 2>&1 && \ + # Check if .sframe section is present and if version > 1 + $READELF --sframe conftest.o | grep "SFRAME_VER" | grep -qv "VERSION_1"; then + libc_cv_default_sframe=yes + fi + rm -f conftest.c conftest.o + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_default_sframe" >&5 +printf "%s\n" "$libc_cv_default_sframe" >&6; } +fi + +# Prevent enabling sframe on non-supporting toolchains +enable_gsframe=no +if test $use_sframe$libc_cv_default_sframe = yesyes || \ + test $use_sframe$libc_cv_default_sframe = notsetyes; then + enable_gsframe=yes +elif test $use_sframe = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "toolchain doesn't support SFrame v2 or higher +See 'config.log' for more details" "$LINENO" 5; } +fi + + # Set the `multidir' variable by grabbing the variable from the compiler. # We do it once and save the result in a generated makefile. libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory` diff --git a/configure.ac b/configure.ac index 09d2ab721c..25b80e34e4 100644 --- a/configure.ac +++ b/configure.ac @@ -440,6 +440,12 @@ case "$enable_fortify_source" in *) AC_MSG_ERROR([Not a valid argument for --enable-fortify-source: "$enable_fortify_source"]);; esac +AC_ARG_ENABLE([sframe], + [AS_HELP_STRING([--disable-sframe], + [Disable building with SFrame stack trace information @<:@default=yes if GNU as is 2.41 or older@:>@])], + [use_sframe=$enableval], + [use_sframe=notset]) + # We keep the original values in `$config_*' and never modify them, so we # can write them unchanged into config.make. Everything else uses # $machine, $vendor, and $os, and changes them whenever convenient. @@ -2115,6 +2121,44 @@ AC_SUBST(libc_cv_test_cc_mprefer_vector_width) AC_SUBST(test_enable_cet) AC_SUBST(libc_cv_test_x86_have_amx_tile) +# Glibc stacktracer supports SFrame v2 or newer +libc_cv_readelf_version_ok=yes +# SFrame is supported from 2.41 or higher +AC_CHECK_PROG_VER(READELF_SFRAME, $READELF, --version, + [GNU readelf.* \([0-9][0-9]*\.[0-9.]*\)], + [2.4[1-9]*|2.[5-9][0-9]*|[3-9].*|[1-9][0-9][0-9]*], + libc_cv_readelf_version_ok=no) + +# Check the current toolchain for SFrame support +if test $libc_cv_readelf_version_ok = yes; then + AC_CACHE_CHECK([for SFrame support], libc_cv_default_sframe, + [dnl +cat > conftest.c </dev/null 2>&1 && \ + # Check if .sframe section is present and if version > 1 + $READELF --sframe conftest.o | grep "SFRAME_VER" | grep -qv "VERSION_1"; then + libc_cv_default_sframe=yes + fi + rm -f conftest.c conftest.o + ]) +fi + +# Prevent enabling sframe on non-supporting toolchains +enable_gsframe=no +if test $use_sframe$libc_cv_default_sframe = yesyes || \ + test $use_sframe$libc_cv_default_sframe = notsetyes; then + enable_gsframe=yes +elif test $use_sframe = yes; then + AC_MSG_FAILURE([toolchain doesn't support SFrame v2 or higher]) +fi +AC_SUBST(enable_gsframe) + # Set the `multidir' variable by grabbing the variable from the compiler. # We do it once and save the result in a generated makefile. libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory` diff --git a/manual/install.texi b/manual/install.texi index 006f93bb71..0c8d448362 100644 --- a/manual/install.texi +++ b/manual/install.texi @@ -320,6 +320,11 @@ If not provided, @option{LEVEL} defaults to highest possible value supported by the build compiler. Default is to disable fortification. + +@item --disable-sframe +By default, the GNU C Library is built with @option{-Wa,--gsframe} if +the current GNU @code{binutils} supports it. You may want to use this +option if you don't plan to use SFrame stack tracer. @end table To build the library and related programs, type @code{make}. This will From patchwork Mon Jul 14 07:59:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu-Ianculescu X-Patchwork-Id: 116223 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 407D33858C31 for ; Mon, 14 Jul 2025 08:07:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 407D33858C31 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=oracle.com header.i=@oracle.com header.a=rsa-sha256 header.s=corp-2025-04-25 header.b=WWm0adwF; dkim=pass (1024-bit key, unprotected) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-oracle-onmicrosoft-com header.b=cK/piuLF X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id D1E613858405 for ; Mon, 14 Jul 2025 08:00:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D1E613858405 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D1E613858405 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=205.220.165.32 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480031; cv=pass; b=rq9JsaqdcPRYUwLQ8FxK77PEOMds177cj5I9Vyz4+bwl82GSkmPZiQlA8dLGD8+O/K2xZo6Wq9+fMxQfW4CkP8ZQf5fN1gLzQoKmUajayYbYLyOKj6Yv5/D+nGvN/98RRM85SDlj01FZjIT36L5A+QaENNK32I22UnJuEFzWHE4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1752480031; c=relaxed/simple; bh=wrHxOIqy1L8Cuyq98sbSpxColAXSRj8ILOBXqfqcyt8=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=iZchZ3fiHl1kbymSc5UdjuhkRmihutTMhbWCr4XmeEFuk9S41E8yL1v4XChE2obNu5p9X49onf21bK/f7SRFkOB1RkutGIadmh9zcCk2g+bNtqmtwCw2Xs7DYa8Fr99QZrML1VKu9bXU+aVdRb8ZP3++4qIb9aDHa9iFgI785to= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D1E613858405 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 56E5Z4D8005506; Mon, 14 Jul 2025 08:00:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2025-04-25; bh=ik6+MEIx/wkEg8NQaPLwkr8jYg+JqQ6xwjfH/BMOUy0=; b= WWm0adwFl+Of5BMMXS/jfF4uFcnZgKjxnB9+L++NvBN4Jq2huttOJqejhZ/fipC2 75+K8mnVjDxn0V0ZQrwDTV2Lu4E+PlDMUbZc3Y9cEguaFVAGtLCXxY3TGc9u8IYG wEclIRFfBE671kkmfpNhQaZzhoUeOSCmIUIXvdzmXl1AP2jvxFhE/uPErlJyKmi3 wd73LSqrxaXn3PXKv48TlKla/UUmOr9ncEtK4W32LehX7JDO89V6CHW4VONHhdf9 UL+rH1Qfl2a15aVW51zgd8r80KKSxEBfsXREdf3VPuBqtwG4YN33x0L/ehnjgPga NFK1plXbPojBUsWyV68xGg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 47ujy4kkyt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:25 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 56E5b4QX024152; Mon, 14 Jul 2025 08:00:24 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12on2053.outbound.protection.outlook.com [40.107.237.53]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 47ue588n4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Jul 2025 08:00:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HxaGHNY4FHfTZVS3L5T7repVYaYSYSXAh4oh6IJdOF0udv3fe+uXCcgdvr1/vPrZiF1lRFsvnR3p6rOSfdEqFKAhJiGfeQnqlP6lhs0cZtZeH3xj1HTkrPTYULWdmTJwMlASIz7EeYgDEF2KeQMSWVt1ErIcxXMI2GRt8Z3NbYk8fACeuyWTdZMF/SU5h+0zKLle6+BOuIwnTfNEizIpRk8oj5BH3knx6WQQ4kwZWSRwuM2l8b7tUBYOq6n+Gh4aB6Hzm5rEdwpVhzAU13n51L01reQicS3UZI7Tx28T4v2mWStF6tuhtZWjfmdoz0Gs0sweHqKTEBgrfKRMde0FJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ik6+MEIx/wkEg8NQaPLwkr8jYg+JqQ6xwjfH/BMOUy0=; b=FB2AR+Oz6nEaXTXvZ8plsv601emNanwGXXNnrRtzqGXTwNENsUZt5nkUQmpupDPrLAmyaTmh9MZIByr1ddneqYFZ/rKqcO9gdk7BBVWbMKaq5mk0NE1rhvb2TeXdqDkjjQN9UJKIg5HxINTW+sk2Yw0M5CkZkNBkvZWwZI4AyeoATR0cppPFrMt8QYsEp2GxKrSn04PSsGlP4uTHHc6oLP91smc7Lnp/UUUdhbFiU5jLxw9NsLqkEuo0c/1JvPI6xgoscQMJukCHh05CpVde2VYwXALyydovaUhE9xj2dgKxTnX198t+7h/97PUCS1ahy+7SRmHU0NzSlB6+s8kN5w== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ik6+MEIx/wkEg8NQaPLwkr8jYg+JqQ6xwjfH/BMOUy0=; b=cK/piuLF8QjgVq/vZW0a91apRwGspAaLkf2cnDkiQPiqbWwWx56m/9y4V4u64QJ7yxg01Wfz5haMoO8Jp7VnAhGauB4HAWNURB2yDqFzsomExzsDDVUkoNTK95Qhf5/BnXPQVVUnsheC07/HlH710tI2fQ1/78CZ70l4oN6gRns= Received: from DS7PR10MB5998.namprd10.prod.outlook.com (2603:10b6:8:9e::20) by SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8880.34; Mon, 14 Jul 2025 08:00:21 +0000 Received: from DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed]) by DS7PR10MB5998.namprd10.prod.outlook.com ([fe80::af84:77bf:20c6:ebed%5]) with mapi id 15.20.8922.028; Mon, 14 Jul 2025 08:00:20 +0000 From: claudiu.zissulescu-ianculescu@oracle.com To: libc-alpha@sourceware.org Cc: jose.marchesi@oracle.com, elena.zannoni@oracle.com, indu.bhagat@oracle.com, jremus@linux.ibm.com, dj@redhat.com, adhemerval.zanella@linaro.org, fweimer@redhat.com Subject: [PATCH v8 6/6] SFrame: Add tests that uses DWARF backtracer Date: Mon, 14 Jul 2025 10:59:26 +0300 Message-ID: <20250714075926.34870-7-claudiu.zissulescu-ianculescu@oracle.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250714075926.34870-6-claudiu.zissulescu-ianculescu@oracle.com> References: <20250714075926.34870-1-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-2-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-3-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-4-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-5-claudiu.zissulescu-ianculescu@oracle.com> <20250714075926.34870-6-claudiu.zissulescu-ianculescu@oracle.com> X-ClientProxiedBy: BE1P281CA0258.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:86::10) To CY5PR10MB6011.namprd10.prod.outlook.com (2603:10b6:930:28::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5998:EE_|SJ0PR10MB5768:EE_ X-MS-Office365-Filtering-Correlation-Id: 16725575-f306-4409-4300-08ddc2ac7a63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: CptPJWxreJ16hYFSOxMmNsxZqDLXUli1Y5hiStoc734apBmiH66aU6L7IOoQsSZEhIBRioCTEegNc3MPRqL611vPDagwTri00qjvakaueB7tWo8dxnVV9RxB/0KXjvp8CLZYOmOHZn48gzXYcu6cX45HWwZ0YVo+yQSVCE7zfxN0CkHm9rH/p2PAH9pyeJu5DqRan9v22S2l8Mb0wgjQCWSfH7kFmUid+PmVF0UVaefOsSdKYndTIYZtB0Rkr/MKRSlVSME1JDF4jhLuPg4b96yIwDfehR2F8X8qE2Qi+fu+rjxQpeuj/KHJLcSdtWebKtYd3RCbrIbiI9Om+NgqyVBZih46Q7wsA63bt7N+ku74QFSuDZVJ6bhj+rK2DXjQiuyq1ieybYMwtb9fOd5B7KlD4RNwD3Tj08+7JjWI/Td1Uacs8uFJhUfhw96TYbAGrBLGNVUiGmlXOCXQ3LsbtmsuHAwz/VcQCjmtyWhXdsQWGrJ/YGttQQl87cNEX4xuJh3pXsYWuYjhMUWkA9WhaoZe5DJ780xM/AQj8ot5zXfC4GkvUAeFRTLVsyv0jMLFz62fMw4IJaTpIGfbdaaomS/5vGsBYPi4lL7XIarN0jztT7A2lb2yM9stUSNKzFcB1+LZe4rCyv9eWhb8No50BMc0ZMDnGpsS+b+nX01MvyUgIpqzfDfIlycZh8WqLbkRopF+m8H2dIRZSsngj8OuwgJyRT3vaivpXCTthNfRK6Xt1D29xwtotY/gnl+QZEhQBYKIqmNyTDI4bd5i1CZkGf/sd9WSelRfkP/T9pSsTjwjE4S9k1I+ljnreNEkJyD57zotU7DQm5ZkKKwwJTvpDAPDi7R5GKCjutYbZRSw8uVvJ0uXNcFcPC1r2rXdQb6yJEi4ipeGEwUfUuAVMfhtxH9b7ujv95hbSgMj0hjle+gPIWZFX/SVC/MAY6noUXU9dyjMQXkodi4/B6pLaTfBwk7xjYmCRh9gK2gaYzXAh/0V9mxhhw5bNCCFLJ4SzZ665QS8bGeD8g9U4FByY1ZxRfOaObTeSSEzWzgQ2cOWtR/GHRSqhwzRpcROOwlftEwFlSO1gpsvTaZ1EWoEk/dV2iM5vr7n3VZgoefE1hA9Rjw9yom12+lOQ+Bj9GAszJEpdQOd5h7Ll00JM0i31ProFVbmrXnkLmvMPoG3CryDBCre28yBhdq0Jm3b92QOcpnYLnaGPOKFTaxIgNPeygRaKT30EKFaj4VvRJ4ODXbAcUjoJC2G6dObStJLYHos5MBydEps5kpuP/LUkJfHUHNpvS0eKG/Smq/YRFuzYkL2f5Rbh0MX0Vyp2nZS9Gx0y591L1Vep1uEMUoVShQDQHOWDA58dyIjqsIoDnOguidizvHK6vFnTycDhxCEYNZNCXumuZgfYQujdPy48QhyFP7wPA0gAAdURHczMAU9srkvXgQ= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS7PR10MB5998.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Xwox+D57iyfZAohbqHLpQp4NiixlF01PFM+80IEQjvLREuCqVNCboPWRI3+svvpfmm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ZW8KckQ5sImP7GLkBpZ5HEDjWJythXt8l51WVztrwwZ2QF/SkwcarzJpa1ZdWr+fyN93UOk6gneS7RNimOtzldpRB9OdzOiwe1fr/CwtDz3PJnt2f29q6JdSrhf0wlg5k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16725575-f306-4409-4300-08ddc2ac7a63 X-MS-Exchange-CrossTenant-AuthSource: CY5PR10MB6011.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2025 08:00:20.8182 (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: +P9+sJq5SYrOvoNUaNH77fcdNO5go+qnHGBM93VmvvRLnR3n0UitKatR2Zu3ETSpzsG435sNT3KNeZebWSZyAms/9d3BX55yEDUDQpDtss+3Q+obNWJofgcpcP//00JSb41Q9IkeKcRFtFvL57tDiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5768 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.7,FMLib:17.12.80.40 definitions=2025-07-14_01,2025-07-09_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2505160000 definitions=main-2507140046 X-Proofpoint-ORIG-GUID: -xBtGP0mwkciUpqY_Ou644deI_uOBpjq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE0MDA0NiBTYWx0ZWRfXwa4RuYUEgiAH mSiXA0P17yAXImNfT8O+FXA5D1O401HnH7flRo7bLOdjVBzgVp9zq8mh9s6Ipx4Z42ghI1y87J7 MZiltHzvFYJNEu7rjSi58+jWBKzcP+8Uro+qD5LHbFp+hgu9xJPsNvRxGgdlfFeBz6BF/DEedX7 +BLDv2SRBV52XgRr2F4/HcvlWc4dyW9bcQ59k3jlTCovzXxO1R1mzExVNDIQOLYQKzi4bKpHrYO 9TPq1lazlCcd/1+U7rS4xtJXWpFw+jbrXRyuM+yTaas2lHLvfYsqT4bPhamXpNyetB1n5tKF+ss L45WVZmsjzvasUbClRHVl1o3KCHSaOb+USa3qUBRHtcqiKoILj6bf8wWSB44untOIx95WHfpViP uSAoov7qGrpJ9++rpaogsGSwL3U2H4MCjtWzX/REwqCabCMTNLrvQbynNa2HpYtIR9JkvyNK X-Authority-Analysis: v=2.4 cv=Xtr6OUF9 c=1 sm=1 tr=0 ts=6874b919 b=1 cx=c_pps a=WeWmnZmh0fydH62SvGsd2A==:117 a=WeWmnZmh0fydH62SvGsd2A==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=Wb1JkmetP80A:10 a=GoEa3M9JfhUA:10 a=yPCof4ZbAAAA:8 a=M2ts8GXhwZBc0F5j21IA:9 X-Proofpoint-GUID: -xBtGP0mwkciUpqY_Ou644deI_uOBpjq X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE, SPF_NONE, TXREP 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org From: Claudiu Zissulescu When SFrame is enabled, we need to tests DW backtracer as well. Do this by executing the same backtrace tests with .sframe section stripped. Signed-off-by: Claudiu Zissulescu --- debug/Makefile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/debug/Makefile b/debug/Makefile index 40201844b3..f29bd20b97 100644 --- a/debug/Makefile +++ b/debug/Makefile @@ -278,6 +278,34 @@ LDFLAGS-tst-backtrace4 = -rdynamic LDFLAGS-tst-backtrace5 = -rdynamic LDFLAGS-tst-backtrace6 = -rdynamic +# When SFrame is enabled, make sure the dwarf unwinder is also exercised. +ifeq ($(enable-gsframe),yes) +dw_unwind_pair := \ + tst-backtrace7:tst-backtrace2 \ + tst-backtrace8:tst-backtrace3 \ + tst-backtrace9:tst-backtrace4 \ + tst-backtrace10:tst-backtrace5 \ + tst-backtrace11:tst-backtrace6 + +first_column = $(foreach pair,$(dw_unwind_pair),$(word 1,$(subst :, ,$(pair)))) +tests-dw-unwind = $(patsubst %,$(objpfx)%.out,$(first_column)) +tests-special += $(tests-dw-unwind) +endif + +define make-strip-rule +$(objpfx)$(word 1,$(subst :, ,$(1))): $(objpfx)$(word 2,$(subst :, ,$(1))) + strip --remove-section=.sframe $$< -o $$@ +endef + +$(foreach pair,$(dw_unwind_pair),$(eval $(call make-strip-rule,$(pair)))) + +define make-run-rule +$(objpfx)$(word 1,$(subst :, ,$(1))).out: /dev/null $(objpfx)$(word 1,$(subst :, ,$(1))) + $$(make-test-out) > $$@; $$(evaluate-test) +endef + +$(foreach pair,$(dw_unwind_pair),$(eval $(call make-run-rule,$(pair)))) + CFLAGS-tst-ssp-1.c += -fstack-protector-all # Disable compiler optimizations around vsprintf (the function under test).