Message ID | 20161217010425.GA140581@beast (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Sat, Dec 17, 2016 at 2:04 AM, Kees Cook <keescook@chromium.org> wrote: > 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. > > Signed-off-by: Kees Cook <keescook@chromium.org> > --- > 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 } > }; > > /* > -- The problem here is like in the other patch sent earlier today. If we change that here, it will diverge from the upstream file it has been generated from. Thanks, Rafael -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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. Thanks Lv > > Signed-off-by: Kees Cook <keescook@chromium.org> > --- > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sun, Dec 18, 2016 at 10:06 PM, Zheng, Lv <lv.zheng@intel.com> 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? #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), ... -Kees > > Thanks > Lv > >> >> Signed-off-by: Kees Cook <keescook@chromium.org> >> --- >> 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
SGksDQoNCj4gRnJvbToga2Vlc2Nvb2tAZ29vZ2xlLmNvbSBbbWFpbHRvOmtlZXNjb29rQGdvb2ds ZS5jb21dIE9uIEJlaGFsZiBPZiBLZWVzIENvb2sNCj4gU3ViamVjdDogUmU6IFtQQVRDSF0gQUNQ SUNBOiB1c2UgZGVzaWduYXRlZCBpbml0aWFsaXplcnMNCj4gDQo+IE9uIFN1biwgRGVjIDE4LCAy MDE2IGF0IDEwOjA2IFBNLCBaaGVuZywgTHYgPGx2LnpoZW5nQGludGVsLmNvbT4gd3JvdGU6DQo+ ID4gSGksDQo+ID4NCj4gPj4gRnJvbTogS2VlcyBDb29rIFttYWlsdG86a2Vlc2Nvb2tAY2hyb21p dW0ub3JnXQ0KPiA+PiBTdWJqZWN0OiBbUEFUQ0hdIEFDUElDQTogdXNlIGRlc2lnbmF0ZWQgaW5p dGlhbGl6ZXJzDQo+ID4+DQo+ID4+IFByZXBhcmUgdG8gbWFyayBzZW5zaXRpdmUga2VybmVsIHN0 cnVjdHVyZXMgZm9yIHJhbmRvbWl6YXRpb24gYnkgbWFraW5nDQo+ID4+IHN1cmUgdGhleSdyZSB1 c2luZyBkZXNpZ25hdGVkIGluaXRpYWxpemVycy4gVGhlc2Ugd2VyZSBpZGVudGlmaWVkIGR1cmlu Zw0KPiA+PiBhbGx5ZXNjb25maWcgYnVpbGRzIG9mIHg4NiwgYXJtLCBhbmQgYXJtNjQsIHdpdGgg bW9zdCBpbml0aWFs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9OKGFjcGlfaHdfbGVnYWN5X3NsZWVwKSwN Cj4gPj4gKyAgICAgICAuZXh0ZW5kZWRfZnVuY3Rpb24gPSBhY3BpX2h3X2V4dGVuZGVkX3NsZWVw IH0sDQo+ID4+ICsgICAgIHsgLmxlZ2FjeV9mdW5jdGlvbiA9IEFDUElfSFdfT1BUSU9OQUxfRlVO Q1RJT04oYWNwaV9od19sZWdhY3lfd2FrZV9wcmVwKSwNCj4gPj4gKyAgICAgICAuZXh0ZW5kZWRf ZnVuY3Rpb24gPSBhY3BpX2h3X2V4dGVuZGVkX3dha2VfcHJlcCB9LA0KPiA+PiArICAgICB7IC5s ZWdhY3lfZnVuY3Rpb24gPSBBQ1BJX0hXX09QVElPTkFMX0ZVTkNUSU9OKGFjcGlfaHdfbGVnYWN5 X3dha2UpLA0KPiA+PiArICAgICAgIC5leHRlbmRlZF9mdW5jdGlvbiA9IGFjcGlfaHdfZXh0ZW5k ZWRfd2FrZSB9DQo+ID4+ICB9Ow0KPiA+Pg0KPiA+PiAgLyoNCj4gPj4gLS0NCj4gPj4gMi43LjQN Cj4gPj4NCj4gPj4NCj4gPj4gLS0NCj4gPj4gS2VlcyBDb29rDQo+ID4+IE5leHVzIFNlY3VyaXR5 DQo+IA0KPiANCj4gDQo+IC0tDQo+IEtlZXMgQ29vaw0KPiBQaXhlbCBTZWN1cml0eQ0K -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
WWVzLCBBQ1BJQ0EgbXVzdCBzdXBwb3J0IG1hbnkgY29tcGlsZXJzLCBzbyB3ZSBrZWVwIHRoZSBj b2RlIGFzIHNpbXBsZSBhcyBwb3NzaWJsZS4NCg0KTWFueSBvZiB0aGUgY29ycG9yYXRlIE9TIHZl bmRvcnMgdXNlIHRoZWlyIG93biBjb21waWxlcnMuDQoNCg0KPiAtLS0tLU9yaWdpbmFsIE1lc3Nh Z2UtLS0tLQ0KPiBGcm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A+ ID4+DQo+ID4gPj4gIC8qDQo+ID4gPj4gLS0NCj4gPiA+PiAyLjcuNA0KPiA+ID4+DQo+ID4gPj4N Cj4gPiA+PiAtLQ0KPiA+ID4+IEtlZXMgQ29vaw0KPiA+ID4+IE5leHVzIFNlY3VyaXR5DQo+ID4N Cj4gPg0KPiA+DQo+ID4gLS0NCj4gPiBLZWVzIENvb2sNCj4gPiBQaXhlbCBTZWN1cml0eQ0K -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Mar 29, 2017 at 7:12 PM, Zheng, Lv <lv.zheng@intel.com> wrote: > 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 <lv.zheng@intel.com> 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. This is only needed in a few cases, so I think general solution would be overkill. That said, it looks like MSVC supports designated initializers. Are people building this with especially old compilers? -Kees > > Thanks > Lv > >> >> >> -Kees >> >> > >> > Thanks >> > Lv >> > >> >> >> >> Signed-off-by: Kees Cook <keescook@chromium.org> >> >> --- >> >> 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
Acpica is built with many compilers, even very old ones. It runs on at least 12 known operating systems, and very probably more. I'm sorry, but no, we are not going to start adding compiler-specific ifdefs/code in the base ACPICA code. I don't care what you do in the Linux-specific or gcc-specific headers, however. If this breaks a customer build, we (you) will hear about it rather quickly. Bob
On Fri, Mar 31, 2017 at 5:45 PM, Moore, Robert <robert.moore@intel.com> wrote: > Acpica is built with many compilers, even very old ones. It runs on at least 12 known operating systems, and very probably more. > > I'm sorry, but no, we are not going to start adding compiler-specific ifdefs/code in the base ACPICA code. > > I don't care what you do in the Linux-specific or gcc-specific headers, however. If this breaks a customer build, we (you) will hear about it rather quickly. Since the change is specific to the one place ACPICA uses an all-function-pointer structure, I made the change local: https://github.com/acpica/acpica/pull/248 would you rather this is in the .h files instead? -Kees
> -----Original Message----- > From: keescook@google.com [mailto:keescook@google.com] On Behalf Of Kees > Cook > Sent: Monday, April 3, 2017 10:29 AM > To: Moore, Robert <robert.moore@intel.com> > Cc: Zheng, Lv <lv.zheng@intel.com>; linux-kernel@vger.kernel.org; > Wysocki, Rafael J <rafael.j.wysocki@intel.com>; Len Brown > <lenb@kernel.org>; linux-acpi@vger.kernel.org; devel@acpica.org > Subject: Re: [PATCH] ACPICA: use designated initializers > > On Fri, Mar 31, 2017 at 5:45 PM, Moore, Robert <robert.moore@intel.com> > wrote: > > Acpica is built with many compilers, even very old ones. It runs on at > least 12 known operating systems, and very probably more. > > > > I'm sorry, but no, we are not going to start adding compiler-specific > ifdefs/code in the base ACPICA code. > > > > I don't care what you do in the Linux-specific or gcc-specific > headers, however. If this breaks a customer build, we (you) will hear > about it rather quickly. > > Since the change is specific to the one place ACPICA uses an all- > function-pointer structure, I made the change local: > > https://github.com/acpica/acpica/pull/248 > > would you rather this is in the .h files instead? > > -Kees > > -- > Kees Cook > Pixel Security [Moore, Robert] I have some questions about this entire issue: + * Some compilers can handle designated initializers, which is needed + * under Linux kernel builds for structures that are entirely function * pointers. I don't understand why this is coming up now, since ACPICA has been integrated with Linux for something like the last 15 years. It's the "which is needed under Linux kernel builds" wording that concerns me the most. Are you saying that the ACPICA build for Linux is broken and does not work? Further, there are quite a few similar dispatch tables in ACPICA, why are these not a problem? Bob
On Tue, Apr 4, 2017 at 8:02 AM, Moore, Robert <robert.moore@intel.com> wrote: >> -----Original Message----- >> From: keescook@google.com [mailto:keescook@google.com] On Behalf Of Kees >> Cook >> Sent: Monday, April 3, 2017 10:29 AM >> To: Moore, Robert <robert.moore@intel.com> >> Cc: Zheng, Lv <lv.zheng@intel.com>; linux-kernel@vger.kernel.org; >> Wysocki, Rafael J <rafael.j.wysocki@intel.com>; Len Brown >> <lenb@kernel.org>; linux-acpi@vger.kernel.org; devel@acpica.org >> Subject: Re: [PATCH] ACPICA: use designated initializers >> >> On Fri, Mar 31, 2017 at 5:45 PM, Moore, Robert <robert.moore@intel.com> >> wrote: >> > Acpica is built with many compilers, even very old ones. It runs on at >> least 12 known operating systems, and very probably more. >> > >> > I'm sorry, but no, we are not going to start adding compiler-specific >> ifdefs/code in the base ACPICA code. >> > >> > I don't care what you do in the Linux-specific or gcc-specific >> headers, however. If this breaks a customer build, we (you) will hear >> about it rather quickly. >> >> Since the change is specific to the one place ACPICA uses an all- >> function-pointer structure, I made the change local: >> >> https://github.com/acpica/acpica/pull/248 >> >> would you rather this is in the .h files instead? >> >> -Kees >> >> -- >> Kees Cook >> Pixel Security > > > > > [Moore, Robert] > > I have some questions about this entire issue: > > + * Some compilers can handle designated initializers, which is needed > + * under Linux kernel builds for structures that are entirely function > * pointers. > > I don't understand why this is coming up now, since ACPICA has been integrated with Linux for something like the last 15 years. It's the "which is needed under Linux kernel builds" wording that concerns me the most. Are you saying that the ACPICA build for Linux is broken and does not work? I was trying to avoid being overly Linux-specific in the ACPICA commit message. More accurately, this is "for future Linux builds using the structure layout randomization plugin." That plugin will randomize the layout of manually marked structures and automatically for structures that are entirely function pointers. (And this acpica structure is one noticed by the plugin.) > Further, there are quite a few similar dispatch tables in ACPICA, why are these not a problem? I can double-check, but I think this was the only one that showed up in an x86 allyesconfig with the plugin enabled. FWIW, I've been making these changes in lots of places, not just ACPICA. ACPICA just has external requirements. :P $ git log --oneline v4.9..next-20170404 | grep -i "designated initializers" b3c829193253 reiserfs: use designated initializers 8291798dcf05 TOMOYO: Use designated initializers f231aebfc4ca rbtree: use designated initializers c4d27f4b4dc9 [media] solo6x10: use designated initializers 6351db2b4df3 [media] mtk-vcodec: use designated initializers 613e61a0252c drm/amdgpu: use designated initializers 8486adf0d755 apparmor: use designated initializers 7f6856b789ff RDMA/i40iw: use designated initializers 6554c9f7f749 RDMA/nes: use designated initializers a641261e9998 video: fbdev: matroxfb: use designated initializers 6895aff47170 video: fbdev: sh_mobile_lcdcfb: use designated initializers 54e22bbf11ca staging: comedi: daqboard2000: use designated initializers 5f5fca6db3d3 scsi: cciss: use designated initializers 93380123fbb5 scsi: hpsa: use designated initializers 2fd2434c3f47 staging: lustre: ldlm: use designated initializers f93a1c9e5e6a ALSA: synth: use designated initializers 2fa70bb9b564 drm/nouveau: use designated initializers 5ca16d8efa66 drm/vmwgfx: use designated initializers 4e98c378a137 drm/ttm: use designated initializers c92f72370571 drm/ttm: use designated initializers ffc7dc8d838c x86/floppy: Use designated initializers e999cb43d51f net/x25: use designated initializers ebf12f1320c7 isdn: use designated initializers 9751362a4fe7 bna: use designated initializers aabd7ad94924 WAN: use designated initializers 9d1c0ca5e1d6 net: use designated initializers 99a5e178bde4 ATM: use designated initializers 4794195058b9 isdn/gigaset: use designated initializers -Kees
On Tue, Apr 4, 2017 at 8:55 AM, Kees Cook <keescook@chromium.org> wrote: > On Tue, Apr 4, 2017 at 8:02 AM, Moore, Robert <robert.moore@intel.com> wrote: >>> -----Original Message----- >>> From: keescook@google.com [mailto:keescook@google.com] On Behalf Of Kees >>> Cook >>> Sent: Monday, April 3, 2017 10:29 AM >>> To: Moore, Robert <robert.moore@intel.com> >>> Cc: Zheng, Lv <lv.zheng@intel.com>; linux-kernel@vger.kernel.org; >>> Wysocki, Rafael J <rafael.j.wysocki@intel.com>; Len Brown >>> <lenb@kernel.org>; linux-acpi@vger.kernel.org; devel@acpica.org >>> Subject: Re: [PATCH] ACPICA: use designated initializers >>> >>> On Fri, Mar 31, 2017 at 5:45 PM, Moore, Robert <robert.moore@intel.com> >>> wrote: >>> > Acpica is built with many compilers, even very old ones. It runs on at >>> least 12 known operating systems, and very probably more. >>> > >>> > I'm sorry, but no, we are not going to start adding compiler-specific >>> ifdefs/code in the base ACPICA code. >>> > >>> > I don't care what you do in the Linux-specific or gcc-specific >>> headers, however. If this breaks a customer build, we (you) will hear >>> about it rather quickly. >>> >>> Since the change is specific to the one place ACPICA uses an all- >>> function-pointer structure, I made the change local: >>> >>> https://github.com/acpica/acpica/pull/248 >>> >>> would you rather this is in the .h files instead? >>> >>> -Kees >>> >>> -- >>> Kees Cook >>> Pixel Security >> >> >> >> >> [Moore, Robert] >> >> I have some questions about this entire issue: >> >> + * Some compilers can handle designated initializers, which is needed >> + * under Linux kernel builds for structures that are entirely function >> * pointers. >> >> I don't understand why this is coming up now, since ACPICA has been integrated with Linux for something like the last 15 years. It's the "which is needed under Linux kernel builds" wording that concerns me the most. Are you saying that the ACPICA build for Linux is broken and does not work? > > I was trying to avoid being overly Linux-specific in the ACPICA commit > message. More accurately, this is "for future Linux builds using the > structure layout randomization plugin." That plugin will randomize the > layout of manually marked structures and automatically for structures > that are entirely function pointers. (And this acpica structure is one > noticed by the plugin.) Here is the merge request in upstream ACPICA. Can anyone re-review it? https://github.com/acpica/acpica/pull/248/ Thanks! -Kees
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 } }; /*
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. Signed-off-by: Kees Cook <keescook@chromium.org> --- drivers/acpi/acpica/hwxfsleep.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)