From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by sourceware.org (Postfix) with ESMTPS id B6930385801A for ; Tue, 9 Jan 2024 10:21:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B6930385801A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B6930385801A Authentication-Results: server2.sourceware.org; arc=fail smtp.remote-ip=192.55.52.93 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704795673; cv=fail; b=uez+IntQd9MUqH8kTk4oixlm0BIK0/Zp3A+C7UpvdP9pkZ9brGKamYhHwocnB7X1Jb1xHAcHb6+XT+wtklGsRFR2lL7lK4LyMQqDNosgpzLYCTFni/t6yKam30yskRqJajeR5grw91Qzn+b/pjt2OXUyXZEVeOkChwPO+Tjm4Y4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704795673; c=relaxed/simple; bh=+bXDJjcDlKwOp0bPaGss8jg4FXzO8r2sw6vezbY/73c=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=l6OuehIM3C276wVQAhXc0XA9J3Rvt7vznSVbWpww6/8F6PmyyISB2ZJNPQpbqQGWzTdPfCijY1Wj44eCdwteds6B4QIAmjMtUcrbycx2pO6EiaFvaRUJpJ3kvQ2rZG6Z7kP6gTUwxtQv5Q/sqJcbGvrCkSA0s3LS2w4c0f+zoho= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704795670; x=1736331670; h=from:to:cc:subject:date:message-id:references: in-reply-to:mime-version:content-transfer-encoding; bh=+bXDJjcDlKwOp0bPaGss8jg4FXzO8r2sw6vezbY/73c=; b=nlIbuftx115aMxyiTZ0GrtBrLX+WXWllIF6cg8E7Nz9Tg69ENoIpYRht Fya19UgfsfmqbIsyVyfQRBEz2VnXWWKBHV4gBX9b7F3ONq6GYyeXDMeUi yJ7F/G4ZPMA2M50gCRkZhmOW5rgtjcEfhy2/p6hbu6w2UHXJ8AgBaQ6+J PPAiwspYRVCAu0Hx0DFLEjtbzisZEjeeRcz38i2ceiibr+RxAXZEkN25a FPwU5JXCSAFiRm7cy/KpMkHbsVPlwiYKcohcxwFMw9BPA0ZEhLD7Z+ETe 6hAuXsgpMv7gkdrn5msY2uhy/8u+lasAe3lcvZ1omcBzEQHd8kvPnRweH Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="395315351" X-IronPort-AV: E=Sophos;i="6.04,182,1695711600"; d="scan'208";a="395315351" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2024 02:21:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10947"; a="785185458" X-IronPort-AV: E=Sophos;i="6.04,182,1695711600"; d="scan'208";a="785185458" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga007.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 09 Jan 2024 02:21:05 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 9 Jan 2024 02:21:05 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Tue, 9 Jan 2024 02:21:05 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.168) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 9 Jan 2024 02:21:05 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VVypAj2bpwsUjRJ/PUjQTJ5ZrQ02hb8yS/EZ6EwyO1Ua0hWGPJg6sJWwanofOigfzDsME7yIjKZ6RKMLKsgQLyXHHosBpblf7pufSfe3TfKGCAvNFZdiUeuRtJgmtR3SVnYGYk6Ghg2Z6lUc3k77f5HxdK2SiK4Vpdn6B1MZ0fvi9IBnVvMGnIM53sEl0hNDosVIFwREtQSMRGwa6rZW65IIphxHWG7ebiKomr4oFpF5XqO0DLS2/QCgFtCQqgkFTiERIoraHbmYS6F7/j1wjvA+6p/MDAvEKrX8T+vXm5NKdDoCwNnf6T3+tooWRPEVmMKC7zdSJTigsPWXAshcjA== 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=xpQXeElzxphUDHqhOzEweWNBwFDlYhMzEJZV3XosBas=; b=hWgl7wZGZOGbyt+g5s1q2P6ufs0h6BfsVJcNo1qTpxZVJ0Wg0vPutTa+R8JX53ICsY4EzwYIsC94Z1cpC0faCZwhqNlMw52ng/ulRBopLpoTXxRcR++RzmDEc9WA9FrqKThBTqry82vzYKueiW8KFSQ30z4/BFqdSdP0IGMwf+3a4TRIvyosaQ5Xy+BH+bH/QMc5qhqxY1RchtmXtr0jsVRSqTfTRp0Z9sxMwVCehWmp6dNN+8AXWazWcxBhV0NNDGzuDDSRG2rqTK1f+mp1Rkki1zaPLjFAH4M8QzrAmc68Oz0JsT1FpMd313+83/LX9pfpdr0hJaFwhKG+oiJdHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SN7PR11MB7638.namprd11.prod.outlook.com (2603:10b6:806:34b::22) by SJ0PR11MB5149.namprd11.prod.outlook.com (2603:10b6:a03:2d1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Tue, 9 Jan 2024 10:21:03 +0000 Received: from SN7PR11MB7638.namprd11.prod.outlook.com ([fe80::885b:923:2a03:5a6a]) by SN7PR11MB7638.namprd11.prod.outlook.com ([fe80::885b:923:2a03:5a6a%5]) with mapi id 15.20.7159.020; Tue, 9 Jan 2024 10:21:02 +0000 From: "Schimpe, Christina" To: Thiago Jung Bauermann , Tom Tromey CC: "gdb@sourceware.org" Subject: RE: Shadow stack backtrace command name Thread-Topic: Shadow stack backtrace command name Thread-Index: AdozJwW2cA0IuLedSP6o6CeJM6XuywCpgST1AQQ7ZoACPm5c4A== Date: Tue, 9 Jan 2024 10:21:02 +0000 Message-ID: References: <87a5q0eq34.fsf@tromey.com> <871qb6c5y8.fsf@linaro.org> In-Reply-To: <871qb6c5y8.fsf@linaro.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN7PR11MB7638:EE_|SJ0PR11MB5149:EE_ x-ms-office365-filtering-correlation-id: 67c17238-d23d-4989-51ee-08dc10fcae97 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: F6kpyzIAdQSuokIpyOFGCPtFkkDaGbP5lTnWIv5ZjtO6rUOzLk4VWhlXBTq5C9rJcdHpKKQ2oN8YtZWC0vZwK0ZJvKCiTy6DqtcznUuXVIK8VWXsAXQ8ONC7aQWm8PLbuh/0aNU3sHIZUnQKEkbTZi398Cqa8FLR9ofVePtEoljFQZqTQYZ4tLs6k1rxQxdLD0RIxWEwXTiCarAB3qWpRlxWptKDvlaVXGyGxIahIR87zV2IvqbJ6Arh00UEzYG7IXPgJ0LHC1Okvk7LePcynXfjqi+q09pyRLwHapGOrkpdPVBXMcNBP4EWxHLIxsCTpNw/o4aDm2slhndbkADitBnxrvJjTt1Fkjc2IO2B5VQEwT9HQ8yTFhKkfT2onRaG/Dbzsgcx4xjoNOCf8yNXr1qNX+3fBozxl7GFPS/QJZg9L49u5hSQzVRPFJZwFn116uKtpAukuv3Gey9IzcSryUc0sdjF3X1asaMyNdtRQvKl4yzLFRz0hdGpQuOYLFOIOYoMYtRoemrPrBXgAE3x+SCWAgX3aCtYfbp3aycN95qcSJE9mSZ8uEcPGW3ZtS9HKjzWlutlls6BN9YHInJbpjF0lzuZHkFHnIYRff9lLbVXSgT5xrU3q+XlwZgOLxJ0 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN7PR11MB7638.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(39860400002)(396003)(136003)(346002)(366004)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(9686003)(6506007)(26005)(122000001)(38100700002)(4326008)(8676002)(8936002)(5660300002)(52536014)(2906002)(7696005)(478600001)(71200400001)(64756008)(66446008)(66476007)(66556008)(316002)(110136005)(66946007)(76116006)(41300700001)(38070700009)(82960400001)(33656002)(86362001)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?2rN2Ui4neDGVxDUZtrGNI+jo2sg1Z6Kw2WR4wHA5ch0Frjq45DKQl3nnIgHZ?= =?us-ascii?Q?ac5gbE2iDu0TYKwY9JKgm1OB+UwqQ8FhFCV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EmHFoYDrGAlVhSHrwDy91al7csHgPVZUvQke0DKEu0O4x6//MJ82e?= =?us-ascii?Q?lzMElOkEYRPwJZZrse3yV7BuXr5mIl9aHJ/L2igWqQTB8SQHXYO6kd/Q9pTi?= =?us-ascii?Q?1GD/9+x/cUzFb4ysWA0voqevWf1abfegIzt7HeV6wn/gzuGtcKg+dOcj1tEM?= =?us-ascii?Q?qdS31eL1Mbu63SnYQHdt7tQORdiRQutmLdLWdUW273Mm+eGLgU1pliXWotFW?= =?us-ascii?Q?oNHcuEK32E+7cAyO4ac41RdCFh4EzmfxPqsq5V3/vQINB4Od/oN2AEYsEhIq?= =?us-ascii?Q?sTm+Msjlyi8m/OUn7nv807Qx0EsI8bzwKDdKqGQfF5KJItqH47h11TB49kWh?= =?us-ascii?Q?hLVC8cF35YmK2RqpXUq5tb/CvN/vxP0ntp+f/dxyD7HTRKa1XuLiQCyzg4dl?= =?us-ascii?Q?64bDvfS0/voKfRnzTD9vKPzHeqzt5JbfpsbCPanV5oYHPBboF8X+kWegxov5?= =?us-ascii?Q?rZP/urTkRnRklur0qi/helwf3nGmBUytz2atvdy+bKt+2jDTdkbw2/RcJ9Ug?= =?us-ascii?Q?H9KclCJ1DgXe6MGpqLH8Sz8n/gWbgxoxsYPpkJjldRvjWH3H+RFy6RPADZmc?= =?us-ascii?Q?uOLg1UCka7MwekMQZPTsZvLiHlLwIa3w+A/AcZALyOSI6Gnc+ET4RHlFnfEZ?= =?us-ascii?Q?rQ=3D=3D?= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN7PR11MB7638.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67c17238-d23d-4989-51ee-08dc10fcae97 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jan 2024 10:21:02.6657 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: RiuYufoqdXorq7cNpxrlsSh1u1UkTkOssstbu8yIC3OV3W7sTR2uHyv162yaaj+AyQpHHX/iMuzdAeJfMY/fZLa8uLg9qVCkkkE8/oXzHro= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5149 X-OriginatorOrg: intel.com Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi all, = Thanks a lot for your feedback and ideas. Please see my comments below. > >> A shadow stack is a second stack for a program introduced in the > >> Intel (R) Control-Flow Enforcement Technology (CET). The shadow > >> stack is used for control transfer operations to store the return addr= esses. > > > > One question I had is when, as a gdb user, would I want to see this > > information? > I think the most common shadow stack error a GDB user would encounter > would be when the inferior is returning from a function and gets a SIGSEGV > because the return address is wrong (e.g., because a buffer overflow wrot= e over > it). > = > There are other possibilities, for example a program can create different= shadow > stacks and switch between them (e.g., when it implements userspace-level > threading) so some error could happen during that process. E.g., in AArch= 64's > Guarded Control Stacks, there needs to be a special "cap" value at the en= d of the > incoming stack and a SIGSEGV is generated if that's not the case. In this= case I > think the user would want to be able to direct the shadow stack backtrace > command to print the backtrace of that other stack, instead of the curren= tly > active one. Yes, I agree here. Common use cases would be debugging of stack corruption or more complex scenarios that cause a control protection exception, as Thi= ago points out. > Another example would be trying to write to a mapped shadow stack that is > read-only. That also causes a SIGSEGV. Though not sure if the shadow stack > backtrace is relevant in this scenario. > = > >> It is configurable using "print symbol-filename" and COUNT. > >> The command can be called by the following names: > >> - "info shadow-stack bt", "info shadow-stack backtrace" > > > > Like others in the thread, I'm -1 on "info" as a prefix. > > I liked "bt -shadow", but I was also wondering if the information > > should just be integrated into the ordinary backtrace when > > available... that's why I'm wondering when I'd want to see this. > = > In my first example, it would be useful if the regular backtrace output n= oted > where it differs from the shadow stack. Though I think a way to see the s= hadow > stack backtrace by itself would still be useful. I like the idea to combine the outputs as the traces can be easily compared= by the user in this way. = However, based on the use cases that I am aware of, I am not sure if the us= er wants to always see the shadow stack bt in the ordinary bt output (if shadow stack is enabled). In addition, I wonder how the output would look like. Dependent on the sour= ce code of the debugged program, the frames of the ordinary bt command can be very long already. = Christina Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva = Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928