public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/64820] New: Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled.
@ 2015-01-27  9:32 chefmax at gcc dot gnu.org
  2015-01-27  9:43 ` [Bug sanitizer/64820] " y.gribov at samsung dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: chefmax at gcc dot gnu.org @ 2015-01-27  9:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64820
           Summary: Libsanitizer fails with
                    ((AddrIsAlignedByGranularity(addr + size))) != (0)"
                    (0x0, 0x0) if ssp is enabled.
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chefmax at gcc dot gnu.org
                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,
                    ygribov at gcc dot gnu.org
              Host: x86_64-pc-linux-gnu
            Target: i386-linux-gnu, arm-linux-gnueabi

Created attachment 34589
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34589&action=edit
Simple reprocase

If compile with both -fsanitize=address and -fstack-protector for 32-bit
architectures and run with ASAN_OPTIONS=detect_stack_use_after_return=1,
libsanitizer fails with:

$ ~/install/master/bin/gcc -m32 -fsanitize=address  -fstack-protector test.c
$ ASAN_OPTIONS=detect_stack_use_after_return=1 ./a.out

 ==7299==AddressSanitizer CHECK failed:
/home/max/workspace/downloads/gcc/libsanitizer/asan/asan_poisoning.cc:25
"((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0)
    #0 0xf72d8afc in AsanCheckFailed
/home/max/workspace/downloads/gcc/libsanitizer/asan/asan_rtl.cc:68
    #1 0xf72dda89 in __sanitizer::CheckFailed(char const*, int, char const*,
unsigned long long, unsigned long long)
/home/max/workspace/downloads/gcc/libsanitizer/sanitizer_common/sanitizer_common.cc:72
    #2 0xf72d39b1 in __asan::PoisonShadow(unsigned long, unsigned long,
unsigned char)
/home/max/workspace/downloads/gcc/libsanitizer/asan/asan_poisoning.cc:25
    #3 0xf7261e29 in __asan::SetShadow(unsigned long, unsigned long, unsigned
long, unsigned long long)
/home/max/workspace/downloads/gcc/libsanitizer/asan/asan_fake_stack.cc:32
    #4 0xf7261e29 in __asan::OnMalloc(unsigned long, unsigned long, unsigned
long)
/home/max/workspace/downloads/gcc/libsanitizer/asan/asan_fake_stack.cc:198
    #5 0xf7261e29 in __asan_stack_malloc_7
/home/max/workspace/downloads/gcc/libsanitizer/asan/asan_fake_stack.cc:230
    #6 0x8048655 in foo (/tmp/a.out+0x8048655)
    #7 0x8048707 in main (/tmp/a.out+0x8048707)

Simple reprocase is attached.

This happens because size parameter is not aligned by 8 bytes (Granularity)
here:
$~/install/master/bin/gcc -m32 -fsanitize=address-fstack-protector test.c -o-
-S

.......................................................

        cmpl    $0, __asan_option_detect_stack_use_after_return
        je      .L1
        subl    $8, %esp
        pushl   %eax
        pushl   $4188  // Aligned by 4 bytes.
        call    __asan_stack_malloc_7
        addl    $16, %esp


Perhaps we should emit some warning (error) in compile time to prevent the
issue?

$ ~/install/master/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/home/max/install/master/bin/gcc
COLLECT_LTO_WRAPPER=/home/max/install/master/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/max/workspace/downloads/gcc/configure --enable-multilib
--enable-checking --target=x86_64-unknown-linux-gnu
--host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu
--prefix=/home/max/install/master --disable-bootstrap --enable-languages=c,c++
Thread model: posix
gcc version 5.0.0 20150127 (experimental) (GCC)


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

* [Bug sanitizer/64820] Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled.
  2015-01-27  9:32 [Bug sanitizer/64820] New: Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled chefmax at gcc dot gnu.org
@ 2015-01-27  9:43 ` y.gribov at samsung dot com
  2015-03-16 11:18 ` chefmax at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: y.gribov at samsung dot com @ 2015-01-27  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

Yury Gribov <y.gribov at samsung dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |y.gribov at samsung dot com

--- Comment #1 from Yury Gribov <y.gribov at samsung dot com> ---
> Perhaps we should emit some warning (error) in compile time
> to prevent the issue?

Or fix SSP to respect ASan stack requirements.


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

* [Bug sanitizer/64820] Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled.
  2015-01-27  9:32 [Bug sanitizer/64820] New: Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled chefmax at gcc dot gnu.org
  2015-01-27  9:43 ` [Bug sanitizer/64820] " y.gribov at samsung dot com
@ 2015-03-16 11:18 ` chefmax at gcc dot gnu.org
  2015-03-17 22:08 ` ramana at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: chefmax at gcc dot gnu.org @ 2015-03-16 11:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Maxim Ostapenko <chefmax at gcc dot gnu.org> ---
Author: chefmax
Date: Mon Mar 16 11:17:32 2015
New Revision: 221457

URL: https://gcc.gnu.org/viewcvs?rev=221457&root=gcc&view=rev
Log:
2015-03-16  Max Ostapenko  <m.ostapenko@partner.samsung.com>

    PR sanitizer/64820

    gcc/
    * cfgexpand.c (align_base): New function.
    (alloc_stack_frame_space): Call it.
    (expand_stack_vars): Align prev_frame to be sure
    data->asan_vec elements aligned properly.

    gcc/testsuite/
    * c-c++-common/asan/pr64820.c: New test.

Added:
    trunk/gcc/testsuite/c-c++-common/asan/pr64820.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgexpand.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug sanitizer/64820] Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled.
  2015-01-27  9:32 [Bug sanitizer/64820] New: Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled chefmax at gcc dot gnu.org
  2015-01-27  9:43 ` [Bug sanitizer/64820] " y.gribov at samsung dot com
  2015-03-16 11:18 ` chefmax at gcc dot gnu.org
@ 2015-03-17 22:08 ` ramana at gcc dot gnu.org
  2015-03-18  7:23 ` chefmax at gcc dot gnu.org
  2015-03-18  7:43 ` chefmax at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ramana at gcc dot gnu.org @ 2015-03-17 22:08 UTC (permalink / raw)
  To: gcc-bugs

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

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ramana at gcc dot gnu.org

--- Comment #3 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> ---
Fixed ?


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

* [Bug sanitizer/64820] Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled.
  2015-01-27  9:32 [Bug sanitizer/64820] New: Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled chefmax at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-03-17 22:08 ` ramana at gcc dot gnu.org
@ 2015-03-18  7:23 ` chefmax at gcc dot gnu.org
  2015-03-18  7:43 ` chefmax at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: chefmax at gcc dot gnu.org @ 2015-03-18  7:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Maxim Ostapenko <chefmax at gcc dot gnu.org> ---
Fixed by r22145.


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

* [Bug sanitizer/64820] Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled.
  2015-01-27  9:32 [Bug sanitizer/64820] New: Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled chefmax at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2015-03-18  7:23 ` chefmax at gcc dot gnu.org
@ 2015-03-18  7:43 ` chefmax at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: chefmax at gcc dot gnu.org @ 2015-03-18  7:43 UTC (permalink / raw)
  To: gcc-bugs

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

Maxim Ostapenko <chefmax at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Maxim Ostapenko <chefmax at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2015-03-18  7:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27  9:32 [Bug sanitizer/64820] New: Libsanitizer fails with ((AddrIsAlignedByGranularity(addr + size))) != (0)" (0x0, 0x0) if ssp is enabled chefmax at gcc dot gnu.org
2015-01-27  9:43 ` [Bug sanitizer/64820] " y.gribov at samsung dot com
2015-03-16 11:18 ` chefmax at gcc dot gnu.org
2015-03-17 22:08 ` ramana at gcc dot gnu.org
2015-03-18  7:23 ` chefmax at gcc dot gnu.org
2015-03-18  7:43 ` chefmax 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).