On Fri, Oct 17, 2014 at 06:15:11PM +0400, Yury Gribov wrote:
> On 10/17/2014 05:49 PM, Jakub Jelinek wrote:
> > Plus if you add misalign tests...
> 
> Sure, can do this on Monday.

Ok, thanks.

> > -  bool use_calls = ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD < INT_MAX
> >-    && asan_num_accesses >= ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD;
> >+  bool use_calls
> >+    = ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD < INT_MAX
> >+      && (flag_sanitize & SANITIZE_KERNEL_ADDRESS)
> >+      && asan_num_accesses >= ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD;
> 
> I agree that original code didn't quite match GNU conventions but can we
> avoid reformatting it to make future backports easier? So e.g.
> 
>  bool use_calls = ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD < INT_MAX
> +    && (flag_sanitize & SANITIZE_KERNEL_ADDRESS)
>    && asan_num_accesses >= ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD;

I can live with that.  So here is updated patch:

2014-10-17  Jakub Jelinek  <ja...@redhat.com>

        * asan.c (instrument_derefs): Allow instrumentation of odd-sized
        accesses even for -fsanitize=address.
        (execute_sanopt): Only allow use_calls for -fsanitize=kernel-address.

        * c-c++-common/asan/instrument-with-calls-1.c: Add
        -fno-sanitize=address -fsanitize=kernel-address to dg-options.
        * c-c++-common/asan/instrument-with-calls-2.c: Likewise.

--- gcc/asan.c.jj       2014-10-17 12:51:27.000000000 +0200
+++ gcc/asan.c  2014-10-17 15:21:29.921495259 +0200
@@ -1707,10 +1707,6 @@ instrument_derefs (gimple_stmt_iterator
   size_in_bytes = int_size_in_bytes (type);
   if (size_in_bytes <= 0)
     return;
-  if ((flag_sanitize & SANITIZE_USER_ADDRESS) != 0
-      && ((size_in_bytes & (size_in_bytes - 1)) != 0
-         || (unsigned HOST_WIDE_INT) size_in_bytes - 1 >= 16))
-    return;
 
   HOST_WIDE_INT bitsize, bitpos;
   tree offset;
@@ -2781,6 +2777,7 @@ execute_sanopt (void)
     }
 
   bool use_calls = ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD < INT_MAX
+    && (flag_sanitize & SANITIZE_KERNEL_ADDRESS)
     && asan_num_accesses >= ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD;
 
   FOR_EACH_BB_FN (bb, cfun)
--- gcc/testsuite/c-c++-common/asan/instrument-with-calls-1.c.jj        
2014-10-17 12:51:27.000000000 +0200
+++ gcc/testsuite/c-c++-common/asan/instrument-with-calls-1.c   2014-10-17 
15:34:06.679627168 +0200
@@ -1,5 +1,5 @@
 /* { dg-do assemble } */
-/* { dg-options "--param asan-instrumentation-with-call-threshold=0 
-save-temps" } */
+/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address --param 
asan-instrumentation-with-call-threshold=0 -save-temps" } */
 
 void f(char *a, int *b) {
   *b = *a;
--- gcc/testsuite/c-c++-common/asan/instrument-with-calls-2.c.jj        
2014-10-17 12:51:27.000000000 +0200
+++ gcc/testsuite/c-c++-common/asan/instrument-with-calls-2.c   2014-10-17 
15:34:15.569472032 +0200
@@ -1,5 +1,5 @@
 /* { dg-do assemble } */
-/* { dg-options "--param asan-instrumentation-with-call-threshold=1 
-save-temps" } */
+/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address --param 
asan-instrumentation-with-call-threshold=1 -save-temps" } */
 
 int x;
 


        Jakub

Reply via email to