[Bug sanitizer/61422] False Asan positive in libopus

2014-08-28 Thread m.zakirov at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61422

Marat Zakirov m.zakirov at samsung dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Marat Zakirov m.zakirov at samsung dot com ---
Already fixed by Gribov commit.


[Bug sanitizer/61422] False Asan positive in libopus

2014-06-05 Thread m.zakirov at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61422

--- Comment #1 from Marat Zakirov m.zakirov at samsung dot com ---
Created attachment 32896
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=32896action=edit
Proposed patch

Only tested with asan testsuite on x64.


[Bug sanitizer/61422] False Asan positive in libopus

2014-06-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61422

--- Comment #2 from Jakub Jelinek jakub at gcc dot gnu.org ---
Comment on attachment 32896
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=32896
Proposed patch

Can't reproduce it, are you sure you don't have extra patches in the tree
(stringops currently don't use the the real_size_in_bytes != size_in_bytes
accesses).

The fix is good, except for the bogus whitespace after [ and incorrect testcase
(you should be really using +m instead of =m, otherwise the compiler could
optimize away the stores of 1 or 3.  Also, please don't add * sizeof (char)
there, that is * 1 by definition.  And please use __builtin_memcpy instead of
unprototyped memcpy.  And copying around uninitialized bytes probably isn't a
good idea either, so you should first memset it or fill in or something.


[Bug sanitizer/61422] False Asan positive in libopus

2014-06-05 Thread m.zakirov at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61422

--- Comment #3 from Marat Zakirov m.zakirov at samsung dot com ---
I fix it.


[Bug sanitizer/61422] False Asan positive in libopus

2014-06-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61422

--- Comment #4 from Jakub Jelinek jakub at gcc dot gnu.org ---
If you want a testcase that crashes even for me with current trunk, then e.g.:
struct S { char c[16]; } __attribute__((packed));

__attribute__((noinline, noclone)) struct S
foo (struct S *p)
{
  asm volatile ( : : r (p) : memory);
  return *p;
}

int
main ()
{
  struct S a __attribute__((aligned (16)));
  struct S b __attribute__((aligned (16)));
  __builtin_memset (b, 0, sizeof b);
  a = foo (b);
  asm volatile ( : : m (a), m (b));
  return 0;
}


[Bug sanitizer/61422] False Asan positive in libopus

2014-06-05 Thread m.zakirov at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61422

--- Comment #5 from Marat Zakirov m.zakirov at samsung dot com ---
Thank you for your quick response Jacub. Actually I take this issue from
existing ffmpeg source so the test is just a truncated version. 

Following fail in my 4.10 without discovered fix:

cat test.c

#define N   4
#define M   16

int main ()
{
  int  i = 1, j = 3;
  char ind[N][M];
  __builtin_memset( ind, 0, M * N);
  __asm (\n
   : +m(i), +m(j));
  __builtin_memcpy (ind[j], ind[i], M * 1);
  return 0;
}

gcc test.c -fsanitize=address -static-libasan 
./a.out


[Bug sanitizer/61422] False Asan positive in libopus

2014-06-05 Thread m.zakirov at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61422

--- Comment #6 from Marat Zakirov m.zakirov at samsung dot com ---
Created attachment 32898
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=32898action=edit
Proposed patch

Try this. It is mostly the same. No additional patches is needed. I hope it's
reproducible.


[Bug sanitizer/61422] False Asan positive in libopus

2014-06-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61422

--- Comment #7 from Jakub Jelinek jakub at gcc dot gnu.org ---
You still have:
  tree shadow_ptr_type = shadow_ptr_types[ real_size_in_bytes == 16 ? 1 : 0];
instead of:
  tree shadow_ptr_type = shadow_ptr_types[real_size_in_bytes == 16 ? 1 : 0];
And, I can't really reproduce using your testcase, so either you have local
patches other than this (I think Yuri Gribov has been working on something in
this area), or it really would be better to use a testcase with explicit 16
byte unaligned access (or both). Still no point to use * 1, or \n in the asm
pattern ( is good enough).

That said, patches should be posted to gcc-patches mailing list.