Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1543815 > unrolled thread

Re: [PATCH v4 1/4] gcc-plugins: Add the initify gcc plugin

Started by"PaX Team" <pageexec@freemail.hu>
First post2016-12-16 23:50 +0100
Last post2016-12-17 00:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v4 1/4] gcc-plugins: Add the initify gcc plugin "PaX Team" <pageexec@freemail.hu> - 2016-12-16 23:50 +0100
    Re: [PATCH v4 1/4] gcc-plugins: Add the initify gcc plugin Kees Cook <keescook@chromium.org> - 2016-12-17 00:10 +0100
      Re: [PATCH v4 1/4] gcc-plugins: Add the initify gcc plugin "PaX Team" <pageexec@freemail.hu> - 2016-12-17 00:20 +0100

#1543815 — Re: [PATCH v4 1/4] gcc-plugins: Add the initify gcc plugin

From"PaX Team" <pageexec@freemail.hu>
Date2016-12-16 23:50 +0100
SubjectRe: [PATCH v4 1/4] gcc-plugins: Add the initify gcc plugin
Message-ID<sP9u9-1bb-7@gated-at.bofh.it>
On 16 Dec 2016 at 14:06, Kees Cook wrote:

> diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
> index 950fd2e64bb7..369bfb471e58 100644
> --- a/scripts/gcc-plugins/gcc-common.h
> +++ b/scripts/gcc-plugins/gcc-common.h
> @@ -287,6 +287,26 @@ static inline struct cgraph_node *cgraph_next_function_with_gimple_body(struct c
>   return NULL;
>  }
> 
> +static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node,
> +				bool (*callback)(cgraph_node_ptr, void *),
> +				void *data, bool include_overwritable)
> +{
> +	cgraph_node_ptr alias;
> +
> +	if (callback(node, data))
> +		return true;
> +
> +	for (alias = node->same_body; alias; alias = alias->next) {
> +		if (include_overwritable ||
> +			cgraph_function_body_availability(alias) > AVAIL_OVERWRITABLE)
> +			if (cgraph_for_node_and_aliases(alias, callback, data,
> +							include_overwritable))
> +				return true;
> +	}
> +
> +	return false;
> +}
> +
>  #define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
>   for ((node) = cgraph_first_function_with_gimple_body(); (node); \
>    (node) = cgraph_next_function_with_gimple_body(node))

this hunk above and...

> @@ -674,6 +707,14 @@ static inline cgraph_node_ptr cgraph_alias_target(cgraph_node_ptr node)
>   return node->get_alias_target();
>  }
> 
> +static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node,
> +				bool (*callback)(cgraph_node_ptr, void *),
> +				void *data, bool include_overwritable)
> +{
> +	return node->call_for_symbol_thunks_and_aliases(callback, data,
> +							include_overwritable);
> +}
> +
>  static inline struct cgraph_node_hook_list *cgraph_add_function_insertion_hook(cgraph_node_hook hook, void *data)
>  {
>   return symtab->add_cgraph_insertion_hook(hook, data);

...this one aren't needed by any plugins upstream so maybe introduce them when
the needed arises? and the whole patch against gcc-common.h would also conflict
with the version i maintain and that you said you'd sync to so there's a decision
to be made regarding how this will is to be maintained...

[toc] | [next] | [standalone]


#1543823

FromKees Cook <keescook@chromium.org>
Date2016-12-17 00:10 +0100
Message-ID<sP9Nv-1xq-17@gated-at.bofh.it>
In reply to#1543815
On Fri, Dec 16, 2016 at 2:45 PM, PaX Team <pageexec@freemail.hu> wrote:
> On 16 Dec 2016 at 14:06, Kees Cook wrote:
>
>> diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
>> index 950fd2e64bb7..369bfb471e58 100644
>> --- a/scripts/gcc-plugins/gcc-common.h
>> +++ b/scripts/gcc-plugins/gcc-common.h
>> @@ -287,6 +287,26 @@ static inline struct cgraph_node *cgraph_next_function_with_gimple_body(struct c
>>   return NULL;
>>  }
>>
>> +static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node,
>> +                             bool (*callback)(cgraph_node_ptr, void *),
>> +                             void *data, bool include_overwritable)
>> +{
>> +     cgraph_node_ptr alias;
>> +
>> +     if (callback(node, data))
>> +             return true;
>> +
>> +     for (alias = node->same_body; alias; alias = alias->next) {
>> +             if (include_overwritable ||
>> +                     cgraph_function_body_availability(alias) > AVAIL_OVERWRITABLE)
>> +                     if (cgraph_for_node_and_aliases(alias, callback, data,
>> +                                                     include_overwritable))
>> +                             return true;
>> +     }
>> +
>> +     return false;
>> +}
>> +
>>  #define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
>>   for ((node) = cgraph_first_function_with_gimple_body(); (node); \
>>    (node) = cgraph_next_function_with_gimple_body(node))
>
> this hunk above and...
>
>> @@ -674,6 +707,14 @@ static inline cgraph_node_ptr cgraph_alias_target(cgraph_node_ptr node)
>>   return node->get_alias_target();
>>  }
>>
>> +static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node,
>> +                             bool (*callback)(cgraph_node_ptr, void *),
>> +                             void *data, bool include_overwritable)
>> +{
>> +     return node->call_for_symbol_thunks_and_aliases(callback, data,
>> +                                                     include_overwritable);
>> +}
>> +
>>  static inline struct cgraph_node_hook_list *cgraph_add_function_insertion_hook(cgraph_node_hook hook, void *data)
>>  {
>>   return symtab->add_cgraph_insertion_hook(hook, data);
>
> ...this one aren't needed by any plugins upstream so maybe introduce them when
> the needed arises?

Hrm, sure. I was just going off of Emese's v3. (And this is partially
an artifact of basing off of v4.9-rc2... I'll refresh it to v4.10-rc2
once it's out.)

> and the whole patch against gcc-common.h would also conflict
> with the version i maintain and that you said you'd sync to so there's a decision
> to be made regarding how this will is to be maintained...

What's easiest for you? I'm okay to carry "unused by upstream yet"
functions and macros in gcc-common, though I don't like carrying lots
of commented out stuff. :P

-Kees

-- 
Kees Cook
Nexus Security

[toc] | [prev] | [next] | [standalone]


#1543838

From"PaX Team" <pageexec@freemail.hu>
Date2016-12-17 00:20 +0100
Message-ID<sP9Xd-1Cb-53@gated-at.bofh.it>
In reply to#1543823
On 16 Dec 2016 at 15:02, Kees Cook wrote:

> >>  static inline struct cgraph_node_hook_list *cgraph_add_function_insertion_hook(cgraph_node_hook hook, void *data)
> >>  {
> >>   return symtab->add_cgraph_insertion_hook(hook, data);
> >
> > ...this one aren't needed by any plugins upstream so maybe introduce them when
> > the needed arises?
> 
> Hrm, sure. I was just going off of Emese's v3. (And this is partially
> an artifact of basing off of v4.9-rc2... I'll refresh it to v4.10-rc2
> once it's out.)
> 
> > and the whole patch against gcc-common.h would also conflict
> > with the version i maintain and that you said you'd sync to so there's a decision
> > to be made regarding how this will is to be maintained...
> 
> What's easiest for you? I'm okay to carry "unused by upstream yet"
> functions and macros in gcc-common, though I don't like carrying lots
> of commented out stuff. :P

well, as i explained it the other day, my version has 'everything but the
kitchen sink' because i use it for development which isn't necessarily what
other projects need or want for themselves (e.g., consider the consequences
of Arnd's recent call to reduce the number of supported gcc versions, if that
goes anywhere above 4.5, gcc-common.h in linux can be further trimmed from my
version). at the end of the day this is a policy call and i'm not the one to
make it for linux ;).

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web