public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/63802] New: UBSan doesn't catch misaligned access if address is 16-bytes (or more) aligned
@ 2014-11-10  8:28 ryabinin.a.a at gmail dot com
  2014-11-13 16:19 ` [Bug sanitizer/63802] " y.gribov at samsung dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ryabinin.a.a at gmail dot com @ 2014-11-10  8:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63802

            Bug ID: 63802
           Summary: UBSan doesn't catch misaligned access if address is
                    16-bytes (or more) aligned
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryabinin.a.a at gmail dot com
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org,
                    mpolacek at gcc dot gnu.org

Created attachment 33929
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33929&action=edit
Repro case

Let's say we have struct that requires 64-bytes alignment.

struct test_struct {
  unsigned long a;
  int b;
} __attribute__((__aligned__(64)));


UBSan will not catch misaligned access if address of such struct is 16 bytes
aligned.

If address is not aligned to 16 bytes, UBSan will catch it, but alignment in
report is wrong (16 instead of 64):

misaligned_test.c:14:80: runtime error: member access within misaligned address
0x0000006011cf for type 'struct test_struct', which requires 16 byte alignment
0x0000006011cf: note: pointer points here
 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
00 00 00 00  00 00 00
             ^


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-18  7:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-10  8:28 [Bug sanitizer/63802] New: UBSan doesn't catch misaligned access if address is 16-bytes (or more) aligned ryabinin.a.a at gmail dot com
2014-11-13 16:19 ` [Bug sanitizer/63802] " y.gribov at samsung dot com
2014-11-13 16:48 ` jakub at gcc dot gnu.org
2014-11-13 17:02 ` y.gribov at samsung dot com
2014-11-18  7:37 ` ygribov at gcc dot gnu.org

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).