Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
the libtcmalloc shipped does not support aligned_alloc so use of that function falls through to the libc implementation. A subsequent call to free will result in libtcmalloc reporting 'Invalid free'
Version-Release number of selected component (if applicable):
gperftools-libs-2.6.1-1.el7.x86_64
How reproducible:
100%
$ cat<<EOF>tc_aligned_alloc.c
#include <stdlib.h>
int main (int argc, char **argv)
{
void *p2 = aligned_alloc(1024, 1024*sizeof(p2));
free(p2);
return 0;
}
EOF
$ gcc -ggdb tc_aligned_alloc.c -o tc_aligned_alloc -ltcmalloc
$ ./tc_aligned_alloc
src/tcmalloc.cc:284] Attempt to free invalid pointer 0x2bfa400
Aborted
$ gdb -q -batch -ex 'run' -ex 'bt' ./tc_aligned_alloc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
src/tcmalloc.cc:284] Attempt to free invalid pointer 0xf02400
Program received signal SIGABRT, Aborted.
0x00007ffff764769b in raise () from /lib64/libc.so.6
#0 0x00007ffff764769b in raise () from /lib64/libc.so.6
#1 0x00007ffff76494a0 in abort () from /lib64/libc.so.6
#2 0x00007ffff7a03a29 in tcmalloc::Log(tcmalloc::LogMode, char const*, int, tcmalloc::LogItem, tcmalloc::LogItem, tcmalloc::LogItem, tcmalloc::LogItem) () from /lib64/libtcmalloc.so.4
#3 0x00007ffff79f83d9 in (anonymous namespace)::InvalidFree(void*) () from /lib64/libtcmalloc.so.4
#4 0x0000000000400645 in main (argc=1, argv=0x7fffffffdbe8) at tc_aligned_alloc.c:7
Additional info:
When linked to libc there is no issue and valgrind and libasan report no memory issues obviously.
upstream patch: https://github.com/gperftools/gperftools/commit/d406f228
Under devtoolset-8 compiling in C++17 mode, the 'std::allocator' will automatically call 'aligned_alloc' (via 'operator new(unsigned long, std::align_val_t)') for larger alignments (i.e. cache-line). This results in a crash when the memory is allocated via glibc but freed via tcmalloc.
Description of problem: the libtcmalloc shipped does not support aligned_alloc so use of that function falls through to the libc implementation. A subsequent call to free will result in libtcmalloc reporting 'Invalid free' Version-Release number of selected component (if applicable): gperftools-libs-2.6.1-1.el7.x86_64 How reproducible: 100% $ cat<<EOF>tc_aligned_alloc.c #include <stdlib.h> int main (int argc, char **argv) { void *p2 = aligned_alloc(1024, 1024*sizeof(p2)); free(p2); return 0; } EOF $ gcc -ggdb tc_aligned_alloc.c -o tc_aligned_alloc -ltcmalloc $ ./tc_aligned_alloc src/tcmalloc.cc:284] Attempt to free invalid pointer 0x2bfa400 Aborted $ gdb -q -batch -ex 'run' -ex 'bt' ./tc_aligned_alloc [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". src/tcmalloc.cc:284] Attempt to free invalid pointer 0xf02400 Program received signal SIGABRT, Aborted. 0x00007ffff764769b in raise () from /lib64/libc.so.6 #0 0x00007ffff764769b in raise () from /lib64/libc.so.6 #1 0x00007ffff76494a0 in abort () from /lib64/libc.so.6 #2 0x00007ffff7a03a29 in tcmalloc::Log(tcmalloc::LogMode, char const*, int, tcmalloc::LogItem, tcmalloc::LogItem, tcmalloc::LogItem, tcmalloc::LogItem) () from /lib64/libtcmalloc.so.4 #3 0x00007ffff79f83d9 in (anonymous namespace)::InvalidFree(void*) () from /lib64/libtcmalloc.so.4 #4 0x0000000000400645 in main (argc=1, argv=0x7fffffffdbe8) at tc_aligned_alloc.c:7 Additional info: When linked to libc there is no issue and valgrind and libasan report no memory issues obviously. upstream patch: https://github.com/gperftools/gperftools/commit/d406f228