From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9CE7C43441 for ; Sun, 11 Nov 2018 11:31:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BD42921479 for ; Sun, 11 Nov 2018 11:31:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD42921479 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728110AbeKKVTr (ORCPT ); Sun, 11 Nov 2018 16:19:47 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:44281 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727556AbeKKVTr (ORCPT ); Sun, 11 Nov 2018 16:19:47 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 45C34806D3; Sun, 11 Nov 2018 12:31:24 +0100 (CET) Date: Sun, 11 Nov 2018 12:31:25 +0100 From: Pavel Machek To: Andy Lutomirski Cc: Yu-cheng Yu , X86 ML , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , LKML , "open list:DOCUMENTATION" , Linux-MM , linux-arch , Linux API , Arnd Bergmann , Balbir Singh , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H. J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , "Shanbhogue, Vedvyas" Subject: Re: [PATCH v5 04/27] x86/fpu/xstate: Add XSAVES system states for shadow stack Message-ID: <20181111113125.GI27666@amd> References: <20181011151523.27101-1-yu-cheng.yu@intel.com> <20181011151523.27101-5-yu-cheng.yu@intel.com> <4295b8f786c10c469870a6d9725749ce75dcdaa2.camel@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TA4f0niHM6tHt3xR" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --TA4f0niHM6tHt3xR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > > > +/* > > > > + * State component 12 is Control flow Enforcement kernel states > > > > + */ > > > > +struct cet_kernel_state { > > > > + u64 kernel_ssp; /* kernel shadow stack */ > > > > + u64 pl1_ssp; /* ring-1 shadow stack */ > > > > + u64 pl2_ssp; /* ring-2 shadow stack */ > > > > +} __packed; > > > > + > > > > > > Why are these __packed? It seems like it'll generate bad code for no > > > obvious purpose. > > > > That prevents any possibility that the compiler will insert padding, al= though in > > 64-bit kernel this should not happen to either struct. Also all xstate > > components here are packed. > > >=20 > They both seem like bugs, perhaps. As I understand it, __packed > removes padding, but it also forces the compiler to expect the fields > to be unaligned even if they are actually aligned. This structure is shared with hardware, right? __packed seems like right thing to do semantically. As x86 handles unaligned accesses automatically, there should not be much difference either way. Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --TA4f0niHM6tHt3xR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlvoEw0ACgkQMOfwapXb+vLY1gCglZ9VACt9vxNg/QC9O9on/sJW mGoAnA825hlJ7l0ichrQ9oFwIh31PPDp =dUic -----END PGP SIGNATURE----- --TA4f0niHM6tHt3xR--