From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com ([134.134.136.24]:62967 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbeKIH0W (ORCPT ); Fri, 9 Nov 2018 02:26:22 -0500 Subject: Re: [PATCH v5 04/27] x86/fpu/xstate: Add XSAVES system states for shadow stack References: <20181011151523.27101-1-yu-cheng.yu@intel.com> <20181011151523.27101-5-yu-cheng.yu@intel.com> <4295b8f786c10c469870a6d9725749ce75dcdaa2.camel@intel.com> From: Dave Hansen Message-ID: <043a17ef-dc9f-56d2-5fba-1a58b7b0fd4d@intel.com> Date: Thu, 8 Nov 2018 13:48:54 -0800 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Andy Lutomirski , Yu-cheng Yu Cc: 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 , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , "Shanbhogue, Vedvyas" Message-ID: <20181108214854.T_XeLGVd8sGyl6Fv4uZTjVUwu0jSf4WdorV2W3S4oPc@z> On 11/8/18 1:22 PM, Andy Lutomirski wrote: >> +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. It's a hardware-defined in-memory structure. Granted, we'd need a really wonky compiler to make that anything *other* than a nicely-packed 24-byte structure, but the __packed makes it explicit. It is probably a really useful long-term thing to stop using __packed and start using "__hw_defined" or something that #defines down to __packed.