Hi Jakub:

Thanks for your review, committed with formatting fixes.

Hi Richard:

Thanks, I'll commit that after gcc 10.2 release :)

On Wed, Jul 22, 2020 at 6:14 PM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Wed, Jul 22, 2020 at 04:53:00PM +0800, Kito Cheng wrote:
> > --- a/gcc/asan.c
> > +++ b/gcc/asan.c
> > @@ -344,6 +344,12 @@ asan_shadow_offset ()
> >    return asan_shadow_offset_value;
> >  }
> >
> > +/* Returns Asan shadow offset has been set.  */
> > +bool asan_shadow_offset_set_p ()
>
> Formatting.  Should be
> bool
> asan_shadow_offset_set_p ()
>
> > +{
> > +  return asan_shadow_offset_computed;
> > +}
> > +
> >  alias_set_type asan_shadow_set = -1;
> >
> >  /* Pointer types to 1, 2 or 4 byte integers in shadow memory.  A separate
>
> > -/* { dg-warning ".'-fsanitize=address' and '-fsanitize=kernel-address' are 
> > not supported for this target" "" { target *-*-* } 0 } */
> > +/* { dg-warning ".'-fsanitize=kernel-address' with stack protection is not 
> > supported without '-fasan-shadow-offset=' for this target." "" { target 
> > *-*-* } 0 } */
>
> Please adjust, see below.
> > index 95eea63380f6..48f13d282c52 100644
> > --- a/gcc/toplev.c
> > +++ b/gcc/toplev.c
> > @@ -1835,7 +1835,7 @@ process_options (void)
> >    /* Address Sanitizer needs porting to each target architecture.  */
> >
> >    if ((flag_sanitize & SANITIZE_ADDRESS)
> > -      && (!FRAME_GROWS_DOWNWARD || targetm.asan_shadow_offset == NULL))
> > +      && !FRAME_GROWS_DOWNWARD)
> >      {
> >        warning_at (UNKNOWN_LOCATION, 0,
> >                 "%<-fsanitize=address%> and %<-fsanitize=kernel-address%> "
> > @@ -1843,6 +1843,25 @@ process_options (void)
> >        flag_sanitize &= ~SANITIZE_ADDRESS;
> >      }
> >
> > +  if ((flag_sanitize & SANITIZE_USER_ADDRESS)
> > +      && targetm.asan_shadow_offset == NULL)
> > +    {
> > +      warning_at (UNKNOWN_LOCATION, 0,
> > +               "%<-fsanitize=address%> not supported for this target");
> > +      flag_sanitize &= ~SANITIZE_ADDRESS;
> > +    }
> > +
> > +  if ((flag_sanitize & SANITIZE_KERNEL_ADDRESS)
> > +      && (targetm.asan_shadow_offset == NULL && param_asan_stack
> > +       && !asan_shadow_offset_set_p ()))
>
> Formatting.  If there are several &&s (or ||s) and it doesn't fit on one
> line, each of them should be on a separate line, so there should be a
> newline and indentation instead of space before "&& param_asan_stack".
> > +    {
> > +      warning_at (UNKNOWN_LOCATION, 0,
> > +               "%<-fsanitize=kernel-address%> with stack protection "
> > +               "is not supported without %<-fasan-shadow-offset=%> "
> > +               "for this target.");
>
> No full stop at the end of diagnostics (plus adjust testcase for it).
>
> Otherwise LGTM for trunk and 10.3 (see Richi's mail).
>
>         Jakub
>

Reply via email to