public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/113258] New: Pre-C++17 code that supplies operator new/delete crashes when mixed with post-C+17 code that uses the align_val_t variants of new/delete
@ 2024-01-07 23:34 nmiell at gmail dot com
  2024-01-07 23:37 ` [Bug libstdc++/113258] " pinskia at gcc dot gnu.org
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: nmiell at gmail dot com @ 2024-01-07 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113258
           Summary: Pre-C++17 code that supplies operator new/delete
                    crashes when mixed with post-C+17 code that uses the
                    align_val_t variants of new/delete
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nmiell at gmail dot com
  Target Milestone: ---

Correctly functioning pre-C++17 applications that supply their own versions of
operator new and delete as allowed by the standard crash when mixed with
correctly functioning post-C++17 shared libraries that used the
std::align_val_t variants of operator new/delete.

This is typically the result of the libstdc++ version of operator delete(void*
ptr, std::align_val_t alignment) calling the application-supplied version of
operator delete(void* ptr), and the application-supplied allocator asserting or
crashing because the original pointer was produced by the libstdc++ version of
operator new(std::size_t size, std::align_val_t alignment) and not the
application-supplied operator new(std::size_t size).

This is both a regression and an ABI breakage.

A typical stack trace looks like the following:

 thread #1, name = 'bms_linux', stop reason = signal SIGABRT
  * frame #0: 0xf7f69589 [vdso]`__kernel_vsyscall + 9
    frame #1: 0xf7d5a2c7 libc.so.6`__pthread_kill_implementation + 279
    frame #2: 0xf7d05fc5 libc.so.6`raise + 37
    frame #3: 0xf7ced370 libc.so.6`abort + 242
    frame #4: 0xf7ed7e8a libtcmalloc_minimal.so.4`tcmalloc::Log(mode=kCrash,
filename="", line=278, a=LogItem @ 0xff92cd0c, b=LogItem @ 0xff92cd18,
c=LogItem @ 0xff92cd24, d=LogItem @ 0xff92cd30) at internal_logging.cc:120
    frame #5: 0xf7ed335d libtcmalloc_minimal.so.4`(anonymous
namespace)::InvalidFree(ptr=0x0a5c7d00) at tcmalloc.cc:278
    frame #6: 0xf7ee4762 libtcmalloc_minimal.so.4`::tc_free(void *) [inlined]
free_null_or_invalid(ptr=0x0a5c7d00, invalid_free_fn=0x0000b2b0) at
tcmalloc.cc:1141
    frame #7: 0xf7ee4751 libtcmalloc_minimal.so.4`::tc_free(void *) at
tcmalloc.cc:1185
    frame #8: 0xf7ee4720 libtcmalloc_minimal.so.4`::tc_free(void *) at
tcmalloc.cc:1225
    frame #9: 0xf7ee4720 libtcmalloc_minimal.so.4`::tc_free(void *) [inlined]
do_free(ptr=0x0a5c7d00) at tcmalloc.cc:1234
    frame #10: 0xf7ee4720 libtcmalloc_minimal.so.4`tc_free(ptr=0x0a5c7d00) at
tcmalloc.cc:1585
    frame #11: 0xf7899f4c libstdc++.so.6`operator delete(void*,
std::align_val_t) + 28
    frame #12: 0xeaaac2c8 libLLVM-17.so`llvm::deallocate_buffer(void*, unsigned
int, unsigned int) + 40
    frame #13: 0xeacd0ef6 libLLVM-17.so`llvm::DenseMap<void const*,
llvm::PassInfo const*, llvm::DenseMapInfo<void const*, void>,
llvm::detail::DenseMapPair<void const*, llvm::PassInfo const*>>::grow(unsigned
int) + 662
    frame #14: 0xead0db09 libLLVM-17.so`llvm::detail::DenseMapPair<void const*,
llvm::PassInfo const*>* llvm::DenseMapBase<llvm::DenseMap<void const*,
llvm::PassInfo const*, llvm::DenseMapInfo<void const*, void>,
llvm::detail::DenseMapPair<void const*, llvm::PassInfo const*>>, void const*,
llvm::PassInfo const*, llvm::DenseMapInfo<void const*, void>,
llvm::detail::DenseMapPair<void const*, llvm::PassInfo
const*>>::InsertIntoBucket<void const*, llvm::PassInfo
const*>(llvm::detail::DenseMapPair<void const*, llvm::PassInfo const*>*, void
const*&&, llvm::PassInfo const*&&) + 121
    frame #15: 0xead0d1fb
libLLVM-17.so`llvm::PassRegistry::registerPass(llvm::PassInfo const&, bool) +
283
    frame #16: 0xed0e209a
libLLVM-17.so`initializeSIFoldOperandsPassOnce(llvm::PassRegistry&) + 138
    frame #17: 0xeac6f832
libLLVM-17.so`std::once_flag::_Prepare_execution::_Prepare_execution<void
std::call_once<void* (&)(llvm::PassRegistry&),
std::reference_wrapper<llvm::PassRegistry>>(std::once_flag&, void*
(&)(llvm::PassRegistry&),
std::reference_wrapper<llvm::PassRegistry>&&)::'lambda'()>(void*
(&)(llvm::PassRegistry&))::'lambda'()::__invoke() + 50
    frame #18: 0xf7d5d4da libc.so.6`__pthread_once_slow + 250
    frame #19: 0xed0e1fd2
libLLVM-17.so`llvm::initializeSIFoldOperandsPass(llvm::PassRegistry&) + 130
    frame #20: 0xed042916 libLLVM-17.so`LLVMInitializeAMDGPUTarget + 166
    frame #21: 0xf238c8c7 radeonsi_dri.so`ac_init_llvm_target + 71
    frame #22: 0xf7d5d4da libc.so.6`__pthread_once_slow + 250
    frame #23: 0xf1ae26c0 radeonsi_dri.so`call_once + 32
    frame #24: 0xf238c946 radeonsi_dri.so`ac_init_shared_llvm_once + 38
    frame #25: 0xf238c968 radeonsi_dri.so`ac_init_llvm_once + 24

etc.

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

end of thread, other threads:[~2024-02-08 21:28 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-07 23:34 [Bug libstdc++/113258] New: Pre-C++17 code that supplies operator new/delete crashes when mixed with post-C+17 code that uses the align_val_t variants of new/delete nmiell at gmail dot com
2024-01-07 23:37 ` [Bug libstdc++/113258] " pinskia at gcc dot gnu.org
2024-01-07 23:43 ` pinskia at gcc dot gnu.org
2024-01-07 23:44 ` nmiell at gmail dot com
2024-01-07 23:48 ` nmiell at gmail dot com
2024-01-07 23:49 ` pinskia at gcc dot gnu.org
2024-01-07 23:57 ` pinskia at gcc dot gnu.org
2024-01-08  0:08 ` redi at gcc dot gnu.org
2024-01-08  1:00 ` nmiell at gmail dot com
2024-01-08  1:23 ` pinskia at gcc dot gnu.org
2024-01-08  1:57 ` pinskia at gcc dot gnu.org
2024-01-08  1:59 ` pinskia at gcc dot gnu.org
2024-01-08  2:18 ` nmiell at gmail dot com
2024-01-08  2:36 ` pinskia at gcc dot gnu.org
2024-01-08  4:42 ` nmiell at gmail dot com
2024-01-08  4:50 ` pinskia at gcc dot gnu.org
2024-01-08  4:53 ` pinskia at gcc dot gnu.org
2024-01-08  9:43 ` redi at gcc dot gnu.org
2024-01-08 10:15 ` redi at gcc dot gnu.org
2024-01-09  6:48 ` nmiell at gmail dot com
2024-01-09  6:55 ` pinskia at gcc dot gnu.org
2024-01-09 10:13 ` redi at gcc dot gnu.org
2024-01-09 11:16 ` [Bug libstdc++/113258] Pre-C++17 code that replaces malloc/free crashes when mixed with post-C++17 " redi at gcc dot gnu.org
2024-01-09 22:33 ` redi at gcc dot gnu.org
2024-01-11 17:55 ` cvs-commit at gcc dot gnu.org
2024-01-12  0:24 ` redi at gcc dot gnu.org
2024-01-16  7:43 ` sjames at gcc dot gnu.org
2024-02-08 15:51 ` cvs-commit at gcc dot gnu.org
2024-02-08 21:28 ` cvs-commit 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).