public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/97414] New: AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs
@ 2020-10-14  7:51 chfast at gmail dot com
  2020-10-15 15:24 ` [Bug sanitizer/97414] " marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: chfast at gmail dot com @ 2020-10-14  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97414
           Summary: AddressSanitizer CHECK failed:
                    detect_stack_use_after_return and
                    detect_invalid_pointer_pairs
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chfast 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, marxin at gcc dot gnu.org
  Target Milestone: ---

==638106==AddressSanitizer CHECK failed:
../../../../src/libsanitizer/asan/asan_thread.cpp:369 "((bottom)) != (0)" (0x0,
0x0)
    #0 0x7f00888e08b8  (/lib/x86_64-linux-gnu/libasan.so.6+0xb98b8)
    #1 0x7f00889007ce  (/lib/x86_64-linux-gnu/libasan.so.6+0xd97ce)
    #2 0x7f00888e64f0  (/lib/x86_64-linux-gnu/libasan.so.6+0xbf4f0)
    #3 0x7f00888dd68b  (/lib/x86_64-linux-gnu/libasan.so.6+0xb668b)
    #4 0x7f00888e0269 in __sanitizer_ptr_sub
(/lib/x86_64-linux-gnu/libasan.so.6+0xb9269)
    #5 0x55e8cd6641f2 in pointer_diff(int const*, int const*)
/home/chfast/Projects/compiler_bugs/sanitizers/pointer_subtract_crash/pointer_subtract_crash.cpp:2
    #6 0x55e8cd664248 in main
/home/chfast/Projects/compiler_bugs/sanitizers/pointer_subtract_crash/pointer_subtract_crash.cpp:10
    #7 0x7f008865c0b2 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #8 0x55e8cd66410d in _start
(/home/chfast/Projects/compiler_bugs/sanitizers/pointer_subtract_crash/a.out+0x110d)


When running the program

[[gnu::noinline]] auto pointer_diff(const int *begin, const int *end) {
  return end - begin;
}

int main() {
  constexpr auto size = (2048 / sizeof(int)) + 1;

  auto buf = new int[size];
  auto end = buf + size;
  pointer_diff(end, buf);
  delete[] buf;

  return 0;
}


compiled with
gcc -fsanitize=address,pointer-subtract -g pointer_subtract_crash.cpp

To reproduce the crash, both runtime options must be enabled:
ASAN_OPTIONS=detect_stack_use_after_return=1:detect_invalid_pointer_pairs=1

This bug was previously reported in LLVM's AddressSanitizer project
https://bugs.llvm.org/show_bug.cgi?id=47626, but pointer-subtract is not
supported there.

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

* [Bug sanitizer/97414] AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs
  2020-10-14  7:51 [Bug sanitizer/97414] New: AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs chfast at gmail dot com
@ 2020-10-15 15:24 ` marxin at gcc dot gnu.org
  2020-10-16  9:53 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-10-15 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-10-15
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, I'll take a look at it.
Thank you for the bug report.

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

* [Bug sanitizer/97414] AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs
  2020-10-14  7:51 [Bug sanitizer/97414] New: AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs chfast at gmail dot com
  2020-10-15 15:24 ` [Bug sanitizer/97414] " marxin at gcc dot gnu.org
@ 2020-10-16  9:53 ` marxin at gcc dot gnu.org
  2020-10-16 13:41 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-10-16  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mail at milianw dot de

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
*** Bug 97416 has been marked as a duplicate of this bug. ***

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

* [Bug sanitizer/97414] AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs
  2020-10-14  7:51 [Bug sanitizer/97414] New: AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs chfast at gmail dot com
  2020-10-15 15:24 ` [Bug sanitizer/97414] " marxin at gcc dot gnu.org
  2020-10-16  9:53 ` marxin at gcc dot gnu.org
@ 2020-10-16 13:41 ` marxin at gcc dot gnu.org
  2020-10-20 10:04 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-10-16 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://reviews.llvm.org/D8
                   |                            |9552

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
I've just an upstream fix:
https://reviews.llvm.org/D89552

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

* [Bug sanitizer/97414] AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs
  2020-10-14  7:51 [Bug sanitizer/97414] New: AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs chfast at gmail dot com
                   ` (2 preceding siblings ...)
  2020-10-16 13:41 ` marxin at gcc dot gnu.org
@ 2020-10-20 10:04 ` marxin at gcc dot gnu.org
  2020-10-21  7:31 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-10-20 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Waiting for upstream to apply the fix.

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

* [Bug sanitizer/97414] AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs
  2020-10-14  7:51 [Bug sanitizer/97414] New: AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs chfast at gmail dot com
                   ` (3 preceding siblings ...)
  2020-10-20 10:04 ` marxin at gcc dot gnu.org
@ 2020-10-21  7:31 ` cvs-commit at gcc dot gnu.org
  2020-10-21  7:33 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-21  7:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:6c5b08a2ca935c5db68e79d33e5c5b752252115c

commit r11-4177-g6c5b08a2ca935c5db68e79d33e5c5b752252115c
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Oct 21 09:28:56 2020 +0200

    libsanitizer: add test-case

    gcc/testsuite/ChangeLog:

            PR sanitizer/97414
            * g++.dg/asan/pr97414.C: New test.

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

* [Bug sanitizer/97414] AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs
  2020-10-14  7:51 [Bug sanitizer/97414] New: AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs chfast at gmail dot com
                   ` (4 preceding siblings ...)
  2020-10-21  7:31 ` cvs-commit at gcc dot gnu.org
@ 2020-10-21  7:33 ` marxin at gcc dot gnu.org
  2020-10-21  9:22 ` cvs-commit at gcc dot gnu.org
  2020-10-21  9:23 ` marxin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-10-21  7:33 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.0
             Status|WAITING                     |ASSIGNED

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master so far.

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

* [Bug sanitizer/97414] AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs
  2020-10-14  7:51 [Bug sanitizer/97414] New: AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs chfast at gmail dot com
                   ` (5 preceding siblings ...)
  2020-10-21  7:33 ` marxin at gcc dot gnu.org
@ 2020-10-21  9:22 ` cvs-commit at gcc dot gnu.org
  2020-10-21  9:23 ` marxin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-21  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Martin Liska
<marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:98cd020ebc50a197de17aecd15afdff718cb06d3

commit r10-8932-g98cd020ebc50a197de17aecd15afdff718cb06d3
Author: Martin Liska <mliska@suse.cz>
Date:   Wed Oct 21 09:28:56 2020 +0200

    libsanitizer: add test-case

    gcc/testsuite/ChangeLog:

            PR sanitizer/97414
            * g++.dg/asan/pr97414.C: New test.

    (cherry picked from commit 6c5b08a2ca935c5db68e79d33e5c5b752252115c)

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

* [Bug sanitizer/97414] AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs
  2020-10-14  7:51 [Bug sanitizer/97414] New: AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs chfast at gmail dot com
                   ` (6 preceding siblings ...)
  2020-10-21  9:22 ` cvs-commit at gcc dot gnu.org
@ 2020-10-21  9:23 ` marxin at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-10-21  9:23 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |10.2.1

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on all active branches.

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

end of thread, other threads:[~2020-10-21  9:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14  7:51 [Bug sanitizer/97414] New: AddressSanitizer CHECK failed: detect_stack_use_after_return and detect_invalid_pointer_pairs chfast at gmail dot com
2020-10-15 15:24 ` [Bug sanitizer/97414] " marxin at gcc dot gnu.org
2020-10-16  9:53 ` marxin at gcc dot gnu.org
2020-10-16 13:41 ` marxin at gcc dot gnu.org
2020-10-20 10:04 ` marxin at gcc dot gnu.org
2020-10-21  7:31 ` cvs-commit at gcc dot gnu.org
2020-10-21  7:33 ` marxin at gcc dot gnu.org
2020-10-21  9:22 ` cvs-commit at gcc dot gnu.org
2020-10-21  9:23 ` marxin 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).