Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934042AbdC3O0N (ORCPT ); Thu, 30 Mar 2017 10:26:13 -0400 Received: from mga03.intel.com ([134.134.136.65]:54698 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933638AbdC3O0M (ORCPT ); Thu, 30 Mar 2017 10:26:12 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,246,1486454400"; d="scan'208";a="840058026" From: "Moore, Robert" To: "Zheng, Lv" , Kees Cook CC: "linux-kernel@vger.kernel.org" , "Wysocki, Rafael J" , Len Brown , "linux-acpi@vger.kernel.org" , "devel@acpica.org" Subject: RE: [PATCH] ACPICA: use designated initializers Thread-Topic: [PATCH] ACPICA: use designated initializers Thread-Index: AQHSqNHSokmnxoNrH0Wl57VbWN+YUKGtGd+AgABXWcA= Date: Thu, 30 Mar 2017 14:26:08 +0000 Message-ID: <94F2FBAB4432B54E8AACC7DFDE6C92E37E58E285@ORSMSX110.amr.corp.intel.com> References: <20161217010425.GA140581@beast> <1AE640813FDE7649BE1B193DEA596E886CDFF348@SHSMSX101.ccr.corp.intel.com> <1AE640813FDE7649BE1B193DEA596E886CE6BD95@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <1AE640813FDE7649BE1B193DEA596E886CE6BD95@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.22.254.140] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v2UERaM8009588 Content-Length: 4143 Lines: 129 Yes, ACPICA must support many compilers, so we keep the code as simple as possible. Many of the corporate OS vendors use their own compilers. > -----Original Message----- > From: Zheng, Lv > Sent: Wednesday, March 29, 2017 7:12 PM > To: Kees Cook > Cc: linux-kernel@vger.kernel.org; Moore, Robert > ; Wysocki, Rafael J > ; Len Brown ; linux- > acpi@vger.kernel.org; devel@acpica.org > Subject: RE: [PATCH] ACPICA: use designated initializers > > Hi, > > > From: keescook@google.com [mailto:keescook@google.com] On Behalf Of > > Kees Cook > > Subject: Re: [PATCH] ACPICA: use designated initializers > > > > On Sun, Dec 18, 2016 at 10:06 PM, Zheng, Lv > wrote: > > > Hi, > > > > > >> From: Kees Cook [mailto:keescook@chromium.org] > > >> Subject: [PATCH] ACPICA: use designated initializers > > >> > > >> Prepare to mark sensitive kernel structures for randomization by > > >> making sure they're using designated initializers. These were > > >> identified during allyesconfig builds of x86, arm, and arm64, with > > >> most initializer fixes extracted from grsecurity. > > > > > > This commit is not suitable for ACPICA upstream. > > > It's not portable. Please drop. > > > > What compilers are building this that do not support designated > > initializers? Also, couldn't this be made into a macro so it could be > > supported in either case? > > It's MSVC. > In ACPICA upstream, it supports Intel compiler, GCC and MSVC. > > > > > #ifdef __GNUC__ > > # define ACPI_SLEEP_FUNCTIONS(legacy, extended) { \ > > .legacy_function = legacy, \ > > .extended_function = extended, \ > > } > > #else > > # define ACPI_SLEEP_FUNCTIONS(legacy, extended) { legacy, extended } > > #endif > > > > ... > > > > static struct acpi_sleep_functions acpi_sleep_dispatch[] = { > > ACPI_SLEEP_FUNCTIONS( > > ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_sleep), > > acpi_hw_extended_sleep), ... > > There are many such cases in ACPICA, and I couldn't see the benefit to > introduce such mechanism to such a software whose purposes contain > portability. > Unless you can invent a mechanism that can be utilized by all such > cases. > Then you should put it into acgcc.h and implement a replaceable in > acmsvc.h. > After that, you surely need to do a cleanup in the entire ACPICA code > base using this new mechanism. > > Thanks > Lv > > > > > > > -Kees > > > > > > > > Thanks > > > Lv > > > > > >> > > >> Signed-off-by: Kees Cook > > >> --- > > >> drivers/acpi/acpica/hwxfsleep.c | 11 ++++++----- > > >> 1 file changed, 6 insertions(+), 5 deletions(-) > > >> > > >> diff --git a/drivers/acpi/acpica/hwxfsleep.c > > >> b/drivers/acpi/acpica/hwxfsleep.c index f76e0eab32b8..25cd5c66e102 > > >> 100644 > > >> --- a/drivers/acpi/acpica/hwxfsleep.c > > >> +++ b/drivers/acpi/acpica/hwxfsleep.c > > >> @@ -70,11 +70,12 @@ static acpi_status acpi_hw_sleep_dispatch(u8 > > >> sleep_state, u32 function_id); > > >> /* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE > > >> */ > > >> > > >> static struct acpi_sleep_functions acpi_sleep_dispatch[] = { > > >> - {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_sleep), > > >> - acpi_hw_extended_sleep}, > > >> - {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake_prep), > > >> - acpi_hw_extended_wake_prep}, > > >> - {ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake), > acpi_hw_extended_wake} > > >> + { .legacy_function = > ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_sleep), > > >> + .extended_function = acpi_hw_extended_sleep }, > > >> + { .legacy_function = > ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake_prep), > > >> + .extended_function = acpi_hw_extended_wake_prep }, > > >> + { .legacy_function = > ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake), > > >> + .extended_function = acpi_hw_extended_wake } > > >> }; > > >> > > >> /* > > >> -- > > >> 2.7.4 > > >> > > >> > > >> -- > > >> Kees Cook > > >> Nexus Security > > > > > > > > -- > > Kees Cook > > Pixel Security