stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* request for 4.14-stable: 93b3623ada15 ("gcc-plugins: Use dynamic initializers")
@ 2018-09-03  3:36 Lance Albertson
  2018-09-03 16:26 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Lance Albertson @ 2018-09-03  3:36 UTC (permalink / raw)
  To: stable

Hi Greg,

I was trying to compile 4.14.67 using GCC 8.2.0 with gcc-plugins enabled 
and ran into this issue [1]. If I applied both of the commits mentioned, 
it resolved the problem so I think it should be included in 4.14.

Thanks!

[1] 
https://groups.google.com/forum/#!msg/qubes-devel/Q3cdQKQS4Tk/gKr4F52HAAAJ

-- 
Lance Albertson
Director
Oregon State University | Open Source Lab

---

 From 93b3623ada1582379833ea442fbc7b15e6417fbc Mon Sep 17 00:00:00 2001
From: Kees Cook <keescook@chromium.org>
Date: Mon, 5 Feb 2018 17:27:46 -0800
Subject: [PATCH 1/2] gcc-plugins: Use dynamic initializers

GCC 8 changed the order of some fields and is very picky about ordering
in static initializers, so instead just move to dynamic initializers,
and drop the redundant already-zero field assignments.

Suggested-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
  scripts/gcc-plugins/latent_entropy_plugin.c   | 17 ++----
  scripts/gcc-plugins/randomize_layout_plugin.c | 75 
++++++++-------------------
  scripts/gcc-plugins/structleak_plugin.c       | 19 +++----
  3 files changed, 33 insertions(+), 78 deletions(-)

diff --git a/scripts/gcc-plugins/latent_entropy_plugin.c 
b/scripts/gcc-plugins/latent_entropy_plugin.c
index 65264960910d..cbe1d6c4b1a5 100644
--- a/scripts/gcc-plugins/latent_entropy_plugin.c
+++ b/scripts/gcc-plugins/latent_entropy_plugin.c
@@ -255,21 +255,14 @@ static tree handle_latent_entropy_attribute(tree 
*node, tree name,
   return NULL_TREE;
  }

-static struct attribute_spec latent_entropy_attr = {
- .name = "latent_entropy",
- .min_length = 0,
- .max_length = 0,
- .decl_required = true,
- .type_required = false,
- .function_type_required = false,
- .handler = handle_latent_entropy_attribute,
-#if BUILDING_GCC_VERSION >= 4007
- .affects_type_identity = false
-#endif
-};
+static struct attribute_spec latent_entropy_attr = { };

  static void register_attributes(void *event_data __unused, void *data 
__unused)
  {
+ latent_entropy_attr.name = "latent_entropy";
+ latent_entropy_attr.decl_required = true;
+ latent_entropy_attr.handler = handle_latent_entropy_attribute;
+
   register_attribute(&latent_entropy_attr);
  }

diff --git a/scripts/gcc-plugins/randomize_layout_plugin.c 
b/scripts/gcc-plugins/randomize_layout_plugin.c
index 0073af326449..c4a345c3715b 100644
--- a/scripts/gcc-plugins/randomize_layout_plugin.c
+++ b/scripts/gcc-plugins/randomize_layout_plugin.c
@@ -580,68 +580,35 @@ static void finish_type(void *event_data, void *data)
   return;
  }

-static struct attribute_spec randomize_layout_attr = {
- .name = "randomize_layout",
- // related to args
- .min_length = 0,
- .max_length = 0,
- .decl_required = false,
- // need type declaration
- .type_required = true,
- .function_type_required = false,
- .handler = handle_randomize_layout_attr,
-#if BUILDING_GCC_VERSION >= 4007
- .affects_type_identity  = true
-#endif
-};
+static struct attribute_spec randomize_layout_attr = { };
+static struct attribute_spec no_randomize_layout_attr = { };
+static struct attribute_spec randomize_considered_attr = { };
+static struct attribute_spec randomize_performed_attr = { };

-static struct attribute_spec no_randomize_layout_attr = {
- .name = "no_randomize_layout",
- // related to args
- .min_length = 0,
- .max_length = 0,
- .decl_required = false,
- // need type declaration
- .type_required = true,
- .function_type_required = false,
- .handler = handle_randomize_layout_attr,
+static void register_attributes(void *event_data, void *data)
+{
+ randomize_layout_attr.name = "randomize_layout";
+ randomize_layout_attr.type_required = true;
+ randomize_layout_attr.handler = handle_randomize_layout_attr;
  #if BUILDING_GCC_VERSION >= 4007
- .affects_type_identity  = true
+ randomize_layout_attr.affects_type_identity = true;
  #endif
-};

-static struct attribute_spec randomize_considered_attr = {
- .name = "randomize_considered",
- // related to args
- .min_length = 0,
- .max_length = 0,
- .decl_required = false,
- // need type declaration
- .type_required = true,
- .function_type_required = false,
- .handler = handle_randomize_considered_attr,
+ no_randomize_layout_attr.name = "no_randomize_layout";
+ no_randomize_layout_attr.type_required = true;
+ no_randomize_layout_attr.handler = handle_randomize_layout_attr;
  #if BUILDING_GCC_VERSION >= 4007
- .affects_type_identity  = false
+ no_randomize_layout_attr.affects_type_identity = true;
  #endif
-};

-static struct attribute_spec randomize_performed_attr = {
- .name = "randomize_performed",
- // related to args
- .min_length = 0,
- .max_length = 0,
- .decl_required = false,
- // need type declaration
- .type_required = true,
- .function_type_required = false,
- .handler = handle_randomize_performed_attr,
-#if BUILDING_GCC_VERSION >= 4007
- .affects_type_identity  = false
-#endif
-};
+ randomize_considered_attr.name = "randomize_considered";
+ randomize_considered_attr.type_required = true;
+ randomize_considered_attr.handler = handle_randomize_considered_attr;
+
+ randomize_performed_attr.name = "randomize_performed";
+ randomize_performed_attr.type_required = true;
+ randomize_performed_attr.handler = handle_randomize_performed_attr;

-static void register_attributes(void *event_data, void *data)
-{
   register_attribute(&randomize_layout_attr);
   register_attribute(&no_randomize_layout_attr);
   register_attribute(&randomize_considered_attr);
diff --git a/scripts/gcc-plugins/structleak_plugin.c 
b/scripts/gcc-plugins/structleak_plugin.c
index 3f8dd4868178..10292f791e99 100644
--- a/scripts/gcc-plugins/structleak_plugin.c
+++ b/scripts/gcc-plugins/structleak_plugin.c
@@ -57,21 +57,16 @@ static tree handle_user_attribute(tree *node, tree 
name, tree args, int flags, b
   return NULL_TREE;
  }

-static struct attribute_spec user_attr = {
- .name = "user",
- .min_length = 0,
- .max_length = 0,
- .decl_required = false,
- .type_required = false,
- .function_type_required = false,
- .handler = handle_user_attribute,
-#if BUILDING_GCC_VERSION >= 4007
- .affects_type_identity = true
-#endif
-};
+static struct attribute_spec user_attr = { };

  static void register_attributes(void *event_data, void *data)
  {
+ user_attr.name = "user";
+ user_attr.handler = handle_user_attribute;
+#if BUILDING_GCC_VERSION >= 4007
+ user_attr.affects_type_identity = true;
+#endif
+
   register_attribute(&user_attr);
  }


-- 
Lance Albertson
Director
Oregon State University | Open Source Lab

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: request for 4.14-stable: 93b3623ada15 ("gcc-plugins: Use dynamic initializers")
  2018-09-03  3:36 request for 4.14-stable: 93b3623ada15 ("gcc-plugins: Use dynamic initializers") Lance Albertson
@ 2018-09-03 16:26 ` Greg KH
  2018-09-03 20:50   ` Lance Albertson
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2018-09-03 16:26 UTC (permalink / raw)
  To: Lance Albertson; +Cc: stable

On Sun, Sep 02, 2018 at 08:36:13PM -0700, Lance Albertson wrote:
> Hi Greg,
> 
> I was trying to compile 4.14.67 using GCC 8.2.0 with gcc-plugins enabled and
> ran into this issue [1]. If I applied both of the commits mentioned, it
> resolved the problem so I think it should be included in 4.14.
> 

This is also b86729109c5f ("gcc-plugins: Use dynamic initializers"),
right?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: request for 4.14-stable: 93b3623ada15 ("gcc-plugins: Use dynamic initializers")
  2018-09-03 16:26 ` Greg KH
@ 2018-09-03 20:50   ` Lance Albertson
  0 siblings, 0 replies; 3+ messages in thread
From: Lance Albertson @ 2018-09-03 20:50 UTC (permalink / raw)
  To: Greg KH; +Cc: stable

On 9/3/18 9:26 AM, Greg KH wrote:
> On Sun, Sep 02, 2018 at 08:36:13PM -0700, Lance Albertson wrote:
>> Hi Greg,
>>
>> I was trying to compile 4.14.67 using GCC 8.2.0 with gcc-plugins enabled and
>> ran into this issue [1]. If I applied both of the commits mentioned, it
>> resolved the problem so I think it should be included in 4.14.
>>
> 
> This is also b86729109c5f ("gcc-plugins: Use dynamic initializers"),
> right?

That is correct. Looks like I accidentally used the sha I had with my 
test branch with that cherry-picked. Apologies for the oversight.

-- 
Lance Albertson
Director
Oregon State University | Open Source Lab

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-04  1:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-03  3:36 request for 4.14-stable: 93b3623ada15 ("gcc-plugins: Use dynamic initializers") Lance Albertson
2018-09-03 16:26 ` Greg KH
2018-09-03 20:50   ` Lance Albertson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).