From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2052.outbound.protection.outlook.com [40.107.14.52]) by sourceware.org (Postfix) with ESMTPS id 385933839D1A for ; Tue, 6 Dec 2022 21:34:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 385933839D1A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iP+R1vQg7WXevdL2GNc4pV0KpRDx4D+35hJLMuLAQMk=; b=zxfCsH0yL5pzvykrM4W+gfaUuVJc4EpDbyIb+4KRQ17j8WtzEeka12GToYDP7j3w3xwO1hA57KsNBicGfW28h+2Jwx1QM0QdJnNfMCu/TvCr83XTqa3ac0dR5gUWXXisYsOVlGq6ALIeNUVwjY8dc6PerRFDJgFX3xRQGZuFy0Y= Received: from FR3P281CA0154.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a2::7) by AS4PR08MB7579.eurprd08.prod.outlook.com (2603:10a6:20b:4fe::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.11; Tue, 6 Dec 2022 21:34:05 +0000 Received: from VI1EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:a2:cafe::fe) by FR3P281CA0154.outlook.office365.com (2603:10a6:d10:a2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5901.8 via Frontend Transport; Tue, 6 Dec 2022 21:34:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VI1EUR03FT059.mail.protection.outlook.com (100.127.144.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5901.14 via Frontend Transport; Tue, 6 Dec 2022 21:34:04 +0000 Received: ("Tessian outbound 2ff13c8f2c05:v130"); Tue, 06 Dec 2022 21:34:04 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ab933d19032dd1d5 X-CR-MTA-TID: 64aa7808 Received: from d811ee433153.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9408BB91-E646-4F2F-B034-BDF07FDB4FEE.1; Tue, 06 Dec 2022 21:33:57 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d811ee433153.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 06 Dec 2022 21:33:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ck7HhOuv1U5vkH34vbDibk+3q3aKA3/z8lTtlWTziqb6OUh9aRpxcdpjEFN2AlnwUa+Jd/6ZxXYSTfD08n16d/37jp4RSuFttnh0VkSb/KPV1cWl2j7nAyVoabLYX9l3cXIzlhhqX8jixyASo3C5BUeIfb1yOWqMq224Rsuf29E1+F114wt9axkA7f4vn4MVbpMAQkNdxi+q4jlyFU4ZmR7QxM54+z9YMucALQznopAbkfbWlt0RAB3PTNx2Jmj2awfvC9WV2rxHn2V/ThrZTqwkoFC3msr9RgEf4RThkh9N5IeYP/Lx1YzkgeAlxR1obAqELTpiaJCbl1zrV5QsuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iP+R1vQg7WXevdL2GNc4pV0KpRDx4D+35hJLMuLAQMk=; b=VMTOQT8oB/s0TJ2aJdn19ocIgmDc0ZXvA5ytZn+OdMqmCj7PlWU4LZxgxE+d3xP24m+DopejNH5NdpiTWJHXx3zvxOqwbd9+BAnzymhvxgqwL3ZfmPtslx8TUItehq/hZj264c1EEHkXdEUZV5h7Sa3hLi2YptDS9OV00NGEH9gKmoI674hwjlKJEav1lYyZaLF+8akYWa5uf6X+aiLg6cIezamyqLjgxSlKKoGSmgCC2GIBQlaipkPC/9FSrr+ooApolCgRx0IG9/Wt3U7ovWS9V7orA9ad0svExifQw/FBr4uaWJ6WzMGJEGuq/b6Bp2PQDV9HyXMg99VopI0cgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iP+R1vQg7WXevdL2GNc4pV0KpRDx4D+35hJLMuLAQMk=; b=zxfCsH0yL5pzvykrM4W+gfaUuVJc4EpDbyIb+4KRQ17j8WtzEeka12GToYDP7j3w3xwO1hA57KsNBicGfW28h+2Jwx1QM0QdJnNfMCu/TvCr83XTqa3ac0dR5gUWXXisYsOVlGq6ALIeNUVwjY8dc6PerRFDJgFX3xRQGZuFy0Y= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) by DB4PR08MB7936.eurprd08.prod.outlook.com (2603:10a6:10:378::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.11; Tue, 6 Dec 2022 21:33:53 +0000 Received: from DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::81ce:94a0:632d:7016]) by DB9PR08MB7179.eurprd08.prod.outlook.com ([fe80::81ce:94a0:632d:7016%3]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 21:33:53 +0000 Date: Tue, 6 Dec 2022 21:33:34 +0000 From: Szabolcs Nagy To: Wilco Dijkstra Cc: GCC Patches , Richard Sandiford Subject: Re: [PATCH] libgcc: Fix uninitialized RA signing on AArch64 [PR107678] Message-ID: References: Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: SA1P222CA0010.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::12) To DB9PR08MB7179.eurprd08.prod.outlook.com (2603:10a6:10:2cc::19) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR08MB7179:EE_|DB4PR08MB7936:EE_|VI1EUR03FT059:EE_|AS4PR08MB7579:EE_ X-MS-Office365-Filtering-Correlation-Id: 23e4d834-6ad7-43f4-81bf-08dad7d1998d x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: h/eBG2vokrzz+dvQIlqxPPBfhq2MMMTy/YcvL7V25PzC+ar+EBccetsTkVwHFiLB7ZTEkX0GFXkmg85c+gsr4x7cR/oSQxok9UKvYhwk8dfmz7rp1EH2eF+swfkzU2uxStcrzQwOaF+Y1f+8VFOi4VL4sTN+29TNkydy0i2p0uU/YjmE+nZPFJL1enR6rMqQt0bgOBCgaig8BkksMYXB6/2oYKvyjBhALJvdhkM3sClrM3U3WvpRu+V0SJo25smG2BWCKYRMcNzXdKY6kqf3AaaEwqaCpukkK9Dog95t7WUJuMuPe770KXS/8BbaetvWSvMzQyyjJSeyobtc5zxjSNjM9I3MO9YG1vYAfKx94dqLyTggAts/bAvsJ+UJZJawLTtCJok6YZ0ZfrbZvisYj48U7VHFpJutwXJlndT7G0MN8iHvpdvp1AG5kcFfveqlEW/RqjJxot2r5r/rUh63fEcneftOBYp6dCLXNLiZkqfprqvoXi11L839esLRrVSd9AiWUZv2svrWWhLtL3SsMDart2lMkxsV4qoyfjwDLjpJdXI92bxJOqFQyhYTxSxEiTp8w+Ra3U9GwSkhK1rHNdMuPeS4LTkp0GJEh9Ea+epT3DZppa9DnXpyo51aPtf45grENG1iZdQtHT4WpwAB5lzbQ1GZYDYiW1hB6kE1t90ucoEmezNYZ43u+fND+JvM X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR08MB7179.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(366004)(136003)(376002)(346002)(451199015)(2616005)(186003)(2906002)(86362001)(6506007)(54906003)(5660300002)(6486002)(6666004)(36756003)(38100700002)(316002)(8936002)(26005)(478600001)(6512007)(6862004)(37006003)(6636002)(41300700001)(83380400001)(4326008)(8676002)(66556008)(66476007)(66946007)(67856001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB7936 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d2af93be-4a3e-4643-f960-08dad7d19293 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: II14H94AmEFHnOYzalLOXgbPfp50RYo7apBU8FRGfXs3D1fr31BRflFwvIHmTPPPinmFXcoqylEj3OySihSFZffDjJNA5hPaD6EjpmQMaWhnsTpjxSzVbBaBSxWf7F/Bix9H2BNM0nfxYrvagtI7Ra2ogf0QkvEIqO2bSuwpI7y8uT+9CxRbu9NYHCmWTB2k65NrV+cSECm85ZntlsS23mkmnefiF6WQJ3uTyWfGPbVvILlFbRZuYkykJMmhV/GO4I957KO5vqqTfAbhUYd9EpEuXxCGk58Kh3PNuor57YUDXY9Fp1D105QOnbxYMQ2T3omEAfkvIPNuzTRzeUVuEjBl4uFnzz1bJG+/+nHdsv61sV9A+QwmxWuGlwy0QuiqyYO5LRBe3LGTD36uo5dym2pK2icnG3D6VGnIQBFEs/M6KdLgKaZVhym9Wk7QsLe9hWqcR5xLh7UP3KHJM5jYeFXssE+iL02GUUg2jI767tzz5ACskY67XYG0KqjQPI+ZWKyajlmaJu1NDB4g7+3E7estAaoQRsy5kWKZTmV+uvvDxJynFMCOdMQHpzElYeerLYTrGa80LHft3QTLeRnf5ZU8n5rxfOdiN/4upJuLipH1e8UOAvvq62GzawkF/pB+wO3c+lQQe8HieGlUJTuVS0JULeCCEuFfcNZIeUeIeAl6q51gfQBUq3jhVP5FOqbQHaQFZxM7k/U73ukipXpst1KkIUmpjWK3wBNCDnAE8oQ= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(136003)(376002)(346002)(451199015)(36840700001)(40470700004)(46966006)(81166007)(40460700003)(83380400001)(36756003)(40480700001)(86362001)(6486002)(478600001)(356005)(6506007)(6666004)(4326008)(6862004)(26005)(6512007)(5660300002)(316002)(2906002)(6636002)(70206006)(2616005)(54906003)(8936002)(8676002)(37006003)(70586007)(41300700001)(82310400005)(36860700001)(82740400003)(186003)(336012)(47076005)(67856001);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 21:34:04.9577 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23e4d834-6ad7-43f4-81bf-08dad7d1998d X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB7579 X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The 12/06/2022 11:58, Wilco Dijkstra wrote: > > i don't think how[*RA_STATE] can ever be set to REG_SAVED_OFFSET, > > this pseudo reg is not spilled to the stack, it is reset to 0 in > > each frame and then toggled within a frame. > > It's is just a state, we can use any state we want since it is a pseudo reg. > These registers are global and shared across all functions in an unwind, > so their state or value isn't reset for each frame. So if we want to reset > it in each frame then using a virtual register to hold per-function data > seems like a bad design. I'm surprised nobody has ever tested it... it was tested (and worked when the frame state was initialized). in principle the CIE can contain instructions to initialize the register state for a frame. the RA_STATE pseudo reg behaves as if the CIE always set its value to 0 at the start of the frame. the design has issues, but this is what we have now. the toggle instruction for RA_STATE does not really fit the dwarf model: the CFI instruction sequence is evaluated with a context that is valid at the end of the sequence so an unwinder only wants to evaluate a register's state at the end, not intermediate values (where the context might not even be valid). so we limited the instructions allowed for RA_STATE: only remember_/restore_state, toggle and val_expression are supported and the latter two cannot be mixed. we still have to use the existing struct for keeping track of this hence reg[RA_STATE].loc.offset. and of course the RA_STATE pseudo reg is only used for computing the return address not propagated to the previous frame so it is special in many ways. so we will need target hooks to fix this and i think the cleanest is to initialize RA_STATE per frame and leave the rest as is.