From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id atluE5urm2cshB8AWB0awg (envelope-from ) for ; Thu, 30 Jan 2025 11:40:59 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Fop282dL; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 42DA21E105; Thu, 30 Jan 2025 11:40:59 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 245831E08E for ; Thu, 30 Jan 2025 11:40:58 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D41743858C66 for ; Thu, 30 Jan 2025 16:40:57 +0000 (GMT) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by sourceware.org (Postfix) with ESMTPS id BDC263858C78 for ; Thu, 30 Jan 2025 16:40:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BDC263858C78 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 BDC263858C78 Authentication-Results: server2.sourceware.org; arc=fail smtp.remote-ip=192.198.163.17 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1738255234; cv=fail; b=kRApkkgm7E2j/ktTJFTsD9GiJuVHQ7v94qVhgy+a+qmx8/7TO1eqYvonG9hukIdAmmjOSAa7NCfNvvJqLm7jPSE0IKFBPq8c7dJU/tBvg0ypTbwLmoU+UwyN+SouaLltOI52wqK2fyNUvqFeg0tsaMJc5zDt3YGWrcce9jqQj/Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1738255234; c=relaxed/simple; bh=FQdGmMQw9DmgcOPYASqYnbEu/k7jrNrrrZAZmUKGcDQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ewLkrGmXcYVZwd5Rh+v624HqDeMrgWqFbdJkxCtBc7EVEEnCDbZogn7cAf9zLMpl/v1yUmpTMAgKXV38VR3t63DnnI3GxbflwxmvdFtKwvNUqouuRZQcGyL7dw6Fy3tWpUe00sReuF8g+pafOWJZZhp05dlBhCBg/qgVxdk17H0= 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=1738255234; x=1769791234; h=from:to:subject:date:message-id:references:in-reply-to: mime-version:content-transfer-encoding; bh=FQdGmMQw9DmgcOPYASqYnbEu/k7jrNrrrZAZmUKGcDQ=; b=Fop282dLbHctlIv8UP4uUXeN6s7ysR/3V0CMSyk+e8Fd0+Tf6K72Y0OP XLvBRNdDPFp2+TmLaKiQw8MzR/TPeNVoQoBGhQpyvSkkdyj5G+n8y0Ubj DYIh8nOUNCWaq+FbnCGY6EktTr47ImYUj6orH8kqH/pnYhmao8s8LBpkx 7uoqRWyyOK43MG6fVHZywNo3LwAtAFW3zL6DP2j8kERWoXTi4y3R9TU3o FltEpU3ePtBnL944RBZNX+HG+o/rG8S3C1VZYPrh9zxXjNoPGHG/kHIzO YbfNj/RUAjtqpCudvOx7U3LnFcMXxw2DWucamr53WPNygGht/KPGR9smW g==; X-CSE-ConnectionGUID: HafBUFk0QR+GvDQiLBGfxw== X-CSE-MsgGUID: f69452q5RdiCoAsC+qNd4A== X-IronPort-AV: E=McAfee;i="6700,10204,11331"; a="38713732" X-IronPort-AV: E=Sophos;i="6.13,245,1732608000"; d="scan'208";a="38713732" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2025 08:40:32 -0800 X-CSE-ConnectionGUID: 7yjIRp4zRpqUAP1C16SyDQ== X-CSE-MsgGUID: A17xrR9vTZ6O4g33nW3LVA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,245,1732608000"; d="scan'208";a="109979728" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmviesa009.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 30 Jan 2025 08:40:33 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44; Thu, 30 Jan 2025 08:40:32 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44 via Frontend Transport; Thu, 30 Jan 2025 08:40:32 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.44; Thu, 30 Jan 2025 08:40:32 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=u+ZTrrHPP4wZ1+Hg7Duit2P1Taql1u6F4n+SA8b4RHLnwlc6paFmQlhVA+ggMUB3owp4PkRMwE8u2Q/6sj0Xq1aOpkSdpP4uNTqY82jdDMuJKYhsJ6/OH6QekBdBBnx8FOpK+4A9MLy2qKrHdxJowv4YQ/PKuz9Uxn8w2lHeGgs0j7WOpvSHctDbzC3SMEEB8KW8kUnRnJKBeIARcxsa5HxcvBmxX79WImMEJPFLZzO7tGV/nmfG7f+3k2EkXZHfyqSMVyxeSSkDaHsyNBC3Bvso50gRg3dXIlSuEYU1pT/yWFB8toRLtcTaoPmEu9KeLhxttXsZhGIGXU84ujrEbQ== 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=xi6ZvmWhe68gN8X3wPvEHU1hm2BoDl/AEy+f77FjUZY=; b=w3f4+zfOlwJGOCDJmXk+E2BxC/+VoyoQdXCZ0RJr2q2rzVKac/lo23YvtlyL42UyBfevsNyPaAQy9jUZ+BOuqvY+hF2NfZtqfkHGnsJZPSWYtJ4SGki1OdN3I0ytI1nwsXECEbVBtEITSiQQwB+QP1iK+GGqRoOqxOObCf90NkA4HmY0CIKsAJq1FzQwszytQBFbf+BEMaCX0ZSHEoBOjnE+kE9q2gpetD6inYJDLv3Ik7rJeZjkX6plUI0N5APWhROUNy6XKBOAFC4zKGTVfB5wklCws23PWYC38zUqwNxEX37JXhKbQnRghdo2r8o0EyaTGsSNqawDaK6KMtjEVA== 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 DS0PR11MB7311.namprd11.prod.outlook.com (2603:10b6:8:11e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.17; Thu, 30 Jan 2025 16:40:02 +0000 Received: from SN7PR11MB7638.namprd11.prod.outlook.com ([fe80::25b8:16dc:755e:34d1]) by SN7PR11MB7638.namprd11.prod.outlook.com ([fe80::25b8:16dc:755e:34d1%3]) with mapi id 15.20.8398.014; Thu, 30 Jan 2025 16:40:02 +0000 From: "Schimpe, Christina" To: Guinevere Larsen , "gdb-patches@sourceware.org" Subject: RE: [PATCH 08/12] gdb: Handle shadow stack pointer register unwinding for amd64 linux. Thread-Topic: [PATCH 08/12] gdb: Handle shadow stack pointer register unwinding for amd64 linux. Thread-Index: AQHbUxvpr8WLluLt1UOT9Fg1yzr8nbMvoHeAgAAZ6LCAAANUgIAAALrA Date: Thu, 30 Jan 2025 16:40:02 +0000 Message-ID: References: <20241220200501.324191-1-christina.schimpe@intel.com> <20241220200501.324191-9-christina.schimpe@intel.com> <4f873c4a-a4ba-451f-8908-bc40ab93c43a@redhat.com> <6051664d-7fbf-4d0b-9ac6-d194a34b292c@redhat.com> In-Reply-To: <6051664d-7fbf-4d0b-9ac6-d194a34b292c@redhat.com> 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_|DS0PR11MB7311:EE_ x-ms-office365-filtering-correlation-id: 086184fb-3590-4be4-1a17-08dd414cbe6e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?hL7vYbqhyydf9Rj940JTfw91lY5/41Xp6G1Fl++wzWJGWK7vllEZOvbBTaWD?= =?us-ascii?Q?sxW0dl5814HI3iicNiZ45HM/w2Y1PXz82BkL5XGu+/73YalWiXFrUAy0WCG+?= =?us-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n8QGvIzwPg0P4qIGr+SNxQvvqHMDtdupsX?= =?us-ascii?Q?bx5FbK3tIwCtbCt8xMtE3SLY2oK+nbYTcfn94b1zVTlaWJ7LVBZS5qC+ZM2S?= =?us-ascii?Q?8R2gQnm0d2xkzbSImk/6QOQZ0v4aN9chMKNBKSXRwTGXi1D/b0qwEhQ6ECJB?= =?us-ascii?Q?0M8QqNzHGCxmLUexQxQ9Kk9p09udb8lguYGX4icfpwwF84EIX9qF9ebha+BA?= =?us-ascii?Q?bK5eHffbNYk78SlIqlI2JwIg+vBUziP0oMxz8kk0NHy0E73VPdR68iWM1T9R?= =?us-ascii?Q?4RxdgBfgIDXDuVJvDjqbSIkYBtZX/X9EbeNvoQVR/PSjFaYm0Fe6XrriLvtq?= =?us-ascii?Q?8Nsiw9STfVI4bIWz/Qm7tOZ2uBuJnYnObpdhbip43AIXHKZaO6qtCjKI96JQ?= =?us-ascii?Q?er7nM5r/O4i8FgQ0k45bzpsXsXn/VN0LT0PQIitcZqQ0Lm+p6x6uVWhdKN6W?= =?us-ascii?Q?GQuxKzhPx0Yy/iqkwWw4ef2KyJRWN9I+?= 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:(13230040)(366016)(1800799024)(376014)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?A3uS3yT+nz+6yXexfGHdGzngQDYHCHQtzxpO2YzvGBOSl6G+1rGt3M8Fr8ac?= =?us-ascii?Q?HtkUmM2Q2pV2jQNd2ofYe1YPQ64rqDd+0blv7G+N4pwcYXMe5qGJFV7urXcf?= =?us-ascii?Q?67EnAucQ5f4qjAhWSh1hiyZCSVGjr/ZHDmtVYFLS5iQiDo7CRS68k/lHeCbq?= =?us-ascii?Q?Oss1a0teeUtt8uIzG714SLV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/aueH?= =?us-ascii?Q?HWp1Gbn2i4Lqd6EuYVmsuGcFW0kZPRwWlAJoBQr83qIuMu5z2uc/vuQatPAE?= =?us-ascii?Q?W0tLe6BgYizUj0ThKgPieutI3tuTtLVD0/vTKlIaXWcXehRhoXMOXoZ/loXN?= =?us-ascii?Q?bjtTI9LNVEO1FpDHCGShdeL90jbEAYWjVbjea1jk+x1O0R1sLNEk9F0rZ+Wu?= =?us-ascii?Q?bIZXUHaFf9IUvrbpnw3PZLgUzN0fQgMHZ4q8+4yCn3DA5KJufZriMMZYyur1?= =?us-ascii?Q?n8Mj5/TslyFYHhvX2f9DtdvkSNpOQnDqU07syO9aEx3r88pCQiSLAWFZYTGE?= =?us-ascii?Q?Rzgr0Xo3yKbipCy7eFG1i0G95wVnN2xp/RVidb7pI99QpwoWfxRTz4vrQWCs?= =?us-ascii?Q?F37Cf1lyc1Nit9lyMfn2llZjA2hOO8uK9Tr1k+Ssyqqnl8n1Mv6ODwpS23lX?= =?us-ascii?Q?YIi1vcNAPXPxJwwZ/iuxZ0fuPOr3EfBaaKZwKVtM+tUs7naUX0HoGhVcFLTy?= =?us-ascii?Q?FTXNTf14uZ5glSPQC1gGGPAgyqdc/4daPnXeO06Fj4hpZcCK+pv9I4VuNX23?= =?us-ascii?Q?9g=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: 086184fb-3590-4be4-1a17-08dd414cbe6e X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2025 16:40:02.4047 (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: h/GNEaTK3zFQW9VFLIO/hne9wAP2uvQrf/h4d2wmEeJvTy8T65abrEW+bCiL1o1zUAIag4AQE4gtNAEOXIW0fCg9uzUr6rX8RKQbRJdW6qE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB7311 X-OriginatorOrg: intel.com Content-Transfer-Encoding: quoted-printable X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org > -----Original Message----- > From: Guinevere Larsen > Sent: Thursday, January 30, 2025 5:14 PM > To: Schimpe, Christina ; gdb- > patches@sourceware.org > Subject: Re: [PATCH 08/12] gdb: Handle shadow stack pointer register unwi= nding > for amd64 linux. > = > On 1/30/25 1:11 PM, Schimpe, Christina wrote: > >> -----Original Message----- > >> From: Guinevere Larsen > >> Sent: Thursday, January 30, 2025 3:29 PM > >> To: Schimpe, Christina ; gdb- > >> patches@sourceware.org > >> Subject: Re: [PATCH 08/12] gdb: Handle shadow stack pointer register > >> unwinding for amd64 linux. > >> > >> On 12/20/24 5:04 PM, Schimpe, Christina wrote: > >>> Unwind the $pl3_ssp register. > >>> We now have an updated value for the shadow stack pointer when > >>> moving up or down the frame level. Note that $pl3_ssp can become > >>> unavailable when moving to a frame before the shadow stack > >>> enablement. In the example below, shadow stack is enabled in the > >>> function 'call1'. Thus, when moving to a frame level above the > >>> function, $pl3_ssp will become unavaiable. > >>> Following the restriction of the linux kernel, implement the > >>> unwinding for amd64 linux only. > >>> > >>> Before this patch: > >>> ~~~ > >>> Breakpoint 1, call2 (j=3D3) at sample.c:44 > >>> 44 return 42; > >>> (gdb) p $pl3_ssp > >>> $1 =3D (void *) 0x7ffff79ffff8 > >>> (gdb) up > >>> 55 call2 (3); > >>> (gdb) p $pl3_ssp > >>> $2 =3D (void *) 0x7ffff79ffff8 > >>> (gdb) up > >>> 68 call1 (43); > >>> (gdb) p $pl3_ssp > >>> $3 =3D (void *) 0x7ffff79ffff8 > >>> ~~~ > >>> > >>> After this patch: > >>> ~~~ > >>> Breakpoint 1, call2 (j=3D3) at sample.c:44 > >>> 44 return 42; > >>> (gdb) p $pl3_ssp > >>> $1 =3D (void *) 0x7ffff79ffff8 > >>> (gdb) up > >>> 55 call2 (3); > >>> (gdb) p $pl3_ssp > >>> $2 =3D (void *) 0x7ffff7a00000 > >>> (gdb) up > >>> 68 call1 (43i); > >>> (gdb) p $pl3_ssp > >>> $3 =3D > >>> ~~~ > >>> > >>> As we now have an updated value for each selected frame, the return > >>> command is now enabled for shadow stack enabled programs, too. > >>> > >>> We therefore add a test for the return command and shadow stack > >>> support, and for an updated shadow stack pointer after a frame level = change. > >>> --- > >>> gdb/amd64-linux-tdep.c | 69 +++++++++++++++ > >>> gdb/linux-tdep.c | 47 ++++++++++ > >>> gdb/linux-tdep.h | 7 ++ > >>> .../gdb.arch/amd64-shadow-stack-cmds.exp | 88 > +++++++++++++++++++ > >>> gdb/testsuite/gdb.arch/amd64-shadow-stack.c | 13 +++ > >>> 5 files changed, 224 insertions(+) > >>> create mode 100644 > >>> gdb/testsuite/gdb.arch/amd64-shadow-stack-cmds.exp > >>> > >>> diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c index > >>> 95f643b1217..895feac85e8 100644 > >>> --- a/gdb/amd64-linux-tdep.c > >>> +++ b/gdb/amd64-linux-tdep.c > >>> @@ -45,6 +45,8 @@ > >>> #include "arch/amd64-linux-tdesc.h" > >>> #include "inferior.h" > >>> #include "x86-tdep.h" > >>> +#include "dwarf2/frame.h" > >>> +#include "frame-unwind.h" > >>> > >>> /* The syscall's XML filename for i386. */ > >>> #define XML_SYSCALL_FILENAME_AMD64 "syscalls/amd64-linux.xml" > >>> @@ -1873,6 +1875,72 @@ > >> amd64_linux_remove_non_address_bits_watchpoint (gdbarch *gdbarch, > >>> return (addr & amd64_linux_lam_untag_mask ()); > >>> } > >>> > >>> +static value * > >>> +amd64_linux_dwarf2_prev_ssp (const frame_info_ptr &this_frame, > >>> + void **this_cache, int regnum) { > >>> + value *v =3D frame_unwind_got_register (this_frame, regnum, > >>> +regnum); > >>> + gdb_assert (v !=3D nullptr); > >>> + > >>> + gdbarch *gdbarch =3D get_frame_arch (this_frame); > >>> + > >>> + if (v->entirely_available () && !v->optimized_out ()) > >>> + { > >>> + int size =3D register_size (gdbarch, regnum); > >>> + bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); > >>> + CORE_ADDR ssp =3D extract_unsigned_integer (v->contents_all ()= .data (), > >>> + size, byte_order); > >>> + > >>> + /* Starting with v6.6., the Linux kernel supports CET shadow s= tack. > >>> + Using /proc/PID/smaps we can only check if the current shadow > >>> + stack pointer SSP points to shadow stack memory. Only if this is > >>> + the case a valid previous shadow stack pointer can be > >>> + calculated. */ > >>> + std::pair range; > >>> + if (linux_address_in_shadow_stack_mem_range (ssp, &range)) > >>> + { > >>> + /* The shadow stack grows downwards. To compute the previous > >>> + shadow stack pointer, we need to increment SSP. > >>> + For x32 the shadow stack elements are still 64-bit aligned. > >>> + Thus, we cannot use gdbarch_addr_bit to compute the new stack > >>> + pointer. */ > >>> + const bfd_arch_info *binfo =3D gdbarch_bfd_arch_info (gdbarch); > >>> + const int bytes_per_word > >>> + =3D (binfo->bits_per_word / binfo->bits_per_byte); > >> In patch 10 of this series, you introduce > >> amd64_linux_shadow_stack_element_size_aligned to simplify this > >> calculation. is there any reason you didn't introduce it here? > > Thanks a lot for looking at this. > > > > The reason is that at this state of the series I only had one > > occurrence of this particular code line and its comment. To avoid > > duplication I decided to make a small function for it in patch 10, but > > before it seemed to introduce more overhead. Would that make sense to y= ou? > > > This makes sense, but in that case I think it's better to just create thi= s function at > this point, so that code doesn't get created and deleted unnecessarily. Mh right, that's also true. I will apply your feedback in the next version = of this series. Christina Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928