From: Jeff Law <law@redhat.com>
To: Ilya Enkovich <enkovich.gnu@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH, Pointer Bounds Checker 3/x] Target hooks for Pointer Bounds Checker
Date: Thu, 11 Sep 2014 21:12:00 -0000 [thread overview]
Message-ID: <54121035.1030805@redhat.com> (raw)
In-Reply-To: <20140815150300.GA59799@msticlxl57.ims.intel.com>
On 08/15/14 09:08, Ilya Enkovich wrote:
> On 17 Jul 03:36, Jeff Law wrote:
>> On 04/16/14 05:52, Ilya Enkovich wrote:
>>> diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
>>> index b8ca17e..d868129 100644
>>> --- a/gcc/doc/tm.texi
>>> +++ b/gcc/doc/tm.texi
>>> @@ -4333,6 +4333,13 @@ This hook returns the va_list type of the calling convention specified by
>>> The default version of this hook returns @code{va_list_type_node}.
>>> @end deftypefn
>>>
>>> +@deftypefn {Target Hook} tree TARGET_FN_ABI_VA_LIST_BOUNDS_SIZE (tree @var{fndecl})
>>> +This hook returns size for @code{va_list} object in function specified
>>> +by @var{fndecl}. This hook is used by Pointer Bounds Checker to build bounds
>>> +for @code{va_list} object. Return @code{integer_zero_node} if no bounds
>>> +should be used (e.g. @code{va_list} is a scalar pointer to the stack).
>>> +@end deftypefn
>> What if va_list is an aggregate, but lives in registers? I'm not
>> familiar with the different va_list implementations on all the
>> targets, but GCC has supported aggregates in registers for various
>> ABIs through the years.
>>
>>> +@deftypefn {Built-in Function} size_t __chkp_sizeof (const void *@var{ptr})
>>> +Function code - @code{BUILT_IN_CHKP_SIZEOF}. This built-in function
>>> +returns size of object referenced by @var{ptr}. @var{ptr} is always
>>> +@code{ADDR_EXPR} of @code{VAR_DECL}. This built-in is used by
>>> +Pointer Boudns Checker when bounds of object cannot be computed statically
>>> +(e.g. object has incomplete type).
>> s/Boudns/Bounds/
>>
>> OK for the trunk with those two doc fixes. As with the other
>> patches, wait for the remainder to be approved before committing.
>>
>> jeff
>>
>
> Thanks for comments!
>
> TARGET_FN_ABI_VA_LIST_BOUNDS_SIZE was supposed to be used when va_list is a pointer to a structure holding args (as it is for x86_64 where we have a structure holding all incoming registers). I decided to remove TARGET_FN_ABI_VA_LIST_BOUNDS_SIZE hook because all loads from va_list are generated by compiler and should be safely within its bounds.
>
> Here is an updated patch.
>
> Thanks,
> Ilya
> --
> 2014-08-15 Ilya Enkovich <ilya.enkovich@intel.com>
>
> * target.def (builtin_chkp_function): New.
> (chkp_bound_type): New.
> (chkp_bound_mode): New.
> (chkp_make_bounds_constant): New.
> (chkp_initialize_bounds): New.
> (load_bounds_for_arg): New.
> (store_bounds_for_arg): New.
> (load_returned_bounds): New.
> (store_returned_bounds): New.
> (chkp_function_value_bounds): New.
> (setup_incoming_vararg_bounds): New.
> * targhooks.h (default_load_bounds_for_arg): New.
> (default_store_bounds_for_arg): New.
> (default_load_returned_bounds): New.
> (default_store_returned_bounds): New.
> (default_chkp_bound_type): New.
> (default_chkp_bound_mode): New.
> (default_builtin_chkp_function): New.
> (default_chkp_function_value_bounds): New.
> (default_chkp_make_bounds_constant): New.
> (default_chkp_initialize_bounds): New.
> (default_setup_incoming_vararg_bounds): New.
> * targhooks.c (default_load_bounds_for_arg): New.
> (default_store_bounds_for_arg): New.
> (default_load_returned_bounds): New.
> (default_store_returned_bounds): New.
> (default_chkp_bound_type): New.
> (default_chkp_bound_mode); New.
> (default_builtin_chkp_function): New.
> (default_chkp_function_value_bounds): New.
> (default_chkp_make_bounds_constant): New.
> (default_chkp_initialize_bounds): New.
> (default_setup_incoming_vararg_bounds): New.
> * doc/tm.texi.in (TARGET_LOAD_BOUNDS_FOR_ARG): New.
> (TARGET_STORE_BOUNDS_FOR_ARG): New.
> (TARGET_LOAD_RETURNED_BOUNDS): New.
> (TARGET_STORE_RETURNED_BOUNDS): New.
> (TARGET_CHKP_FUNCTION_VALUE_BOUNDS): New.
> (TARGET_SETUP_INCOMING_VARARG_BOUNDS): New.
> (TARGET_BUILTIN_CHKP_FUNCTION): New.
> (TARGET_CHKP_BOUND_TYPE): New.
> (TARGET_CHKP_BOUND_MODE): New.
> (TARGET_CHKP_MAKE_BOUNDS_CONSTANT): New.
> (TARGET_CHKP_INITIALIZE_BOUNDS): New.
> * doc/tm.texi: Regenerated.
>
Just to be explicit, this is OK when the rest of the pointer bounds
stuff goes in.
jeff
prev parent reply other threads:[~2014-09-11 21:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-16 12:09 Ilya Enkovich
2014-05-06 12:11 ` Ilya Enkovich
2014-06-27 8:10 ` Ilya Enkovich
2014-07-18 5:07 ` Jeff Law
2014-08-15 15:08 ` Ilya Enkovich
2014-09-11 21:12 ` Jeff Law [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54121035.1030805@redhat.com \
--to=law@redhat.com \
--cc=enkovich.gnu@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).