This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, CHKP, PR target/65044] Restrict pointer bounds checker with Sanitizer
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 16 Feb 2015 17:01:00 +0100
- Subject: Re: [PATCH, CHKP, PR target/65044] Restrict pointer bounds checker with Sanitizer
- Authentication-results: sourceware.org; auth=none
- References: <20150216152059 dot GA51560 at msticlxl57 dot ims dot intel dot com> <20150216153154 dot GF1746 at tucnak dot redhat dot com> <20150216155645 dot GB51560 at msticlxl57 dot ims dot intel dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Feb 16, 2015 at 06:56:45PM +0300, Ilya Enkovich wrote:
> On 16 Feb 16:31, Jakub Jelinek wrote:
> > On Mon, Feb 16, 2015 at 06:20:59PM +0300, Ilya Enkovich wrote:
> > > This patch restricts usage of Pointer Bounds Checker with Sanitizer. OK for trunk?
> >
> > There are many sanitizers, and for most of them I don't see why they would
> > be in any conflict with -mmpx, it is just -fsanitize=address and
> > -fsanitize=kernel-address.
> > So perhaps test instead if (flag_sanitize & SANITIZE_ADDRESS) != 0, and
> > better clear the flag_pointer_bounds after issuing the error, error () is
> > not a fatal function, so you need something sensible for error-recovery.
> >
> > Jakub
>
> I don't know all sanitizers in details. Code generated by some of them may be incorrect from checker point of view. Thus I just wanted to disable unexplored and untested combinations.
Shouldn't be that hard to write a testcase and test it.
Most of the sanitizers just add code like
if (some_condition)
__ubsan_handle_... ();
where from the POV of the program the __ubsan_* function reports or might
report some problem, and optionally abort the program.
That some_condition can be a check of the pointer value, shift count,
divisor check, etc.
Jakub