Commit Graph

724 Commits

Author SHA1 Message Date
Aliaksey Kandratsenka
35301e2e59 add missing noopt wrappings around more operator new calls
This fixes tests passing on clang which otherwise eliminates those
new/delete calls so checking for hooks being called failed.
2021-02-21 12:41:36 -08:00
Venkatesh Srinivas
fa412adfe3 Fix thread-safety (annotalysis) annotations
tcmalloc contains some thread-safety annotations; however those
annotations have not been exercised for some time, as they used
macros/attributes only supported by a legacy branch of gcc.

Pull request #1251 converted those macros to support modern
versions of clang; this CR fixes the annotations that were
enabled. For the most part, this just requires re-enabling
annotations on member functions that take/release locks. For the
tcmalloc fork (pre-fork and post-fork) handlers, we mark the
functions as exempt from this analysis, as it takes a dynamic
number of locks.
2021-02-17 17:50:43 -08:00
Venkatesh Srinivas
cc496aecb8 tcmalloc: Switch thread-safety annotations to support clang
tcmalloc contains its own copy of thread_annotations.h, wrapper
macros for static thread-safety analysis expressions. These thread-
safety expressions allow asserting (at compile time) that certain
locks are held or excluded or certain data is protected by specific
locks; they are checked at compile-time by recent versions of clang
or a gcc branch (https://gcc.gnu.org/wiki/ThreadSafetyAnnotation).

Convert the #if-guard and macro names from the no-longer-supported
gcc branch's defines & macros to the versions supported by recent
versions of clang.
2021-02-17 16:23:17 -08:00
Aliaksey Kandratsenka
96ba58e19b bump version to 2.9rc 2021-02-14 23:18:57 -08:00
Aliaksey Kandratsenka
9ce32aefa9 upgrade test bot to xenial (ubuntu 16.04 LTS)
Older glibc seemingly doesn't have right unwind info for signal frame,
so fails recently upgraded stacktrace_unittest. But since this version
is not supported anymore, lets just test newer glibc.
2021-02-14 23:02:28 -08:00
Aliaksey Kandratsenka
91ff311449 don't default to generic_fp without frame pointers
I.e. on x86-64 and riscv.
2021-02-14 22:39:30 -08:00
Aliaksey Kandratsenka
4cf7dd0a75 enable emergency_malloc on all architectures with mmap
It is actually needed for libgcc backtracer from time to time. And
we've seen libunwind to need it too. Plus we've not heard of any
problems with it. So lets just always enable it.

This should fix github issue #1248.
2021-02-14 22:28:34 -08:00
Aliaksey Kandratsenka
37087ec536 prefer libunwind on x86-64 even with -fno-omit-frame-pointer
Libunwind is mostly safe on x86-64 and most of OS (e.g. libc) is
compiled without frame pointers anyways. Even when libc is built with
frame pointers, various libc asm routines (e.g. memcpy) are not. And
even for code built with frame pointers we actually sometimes get
SIGPROF inside function prologues, before frame pointer is
established. Which then causes imperfect backtraces.

Libunwind should handle this all (when it doesn't crash or deadlock).
2021-02-14 22:12:47 -08:00
Aliaksey Kandratsenka
f4aa2a435e implement generic frame pointer backtracer
This supports frame pointer backtracing on x86-64, aarch64 and
riscv-s (should work for both 32 and 64 bits).

Also added is detection of borked libunwind on aarch64-s. In this case
frame pointer unwinder is preferred.
2021-02-14 22:11:09 -08:00
Aliaksey Kandratsenka
17bab484ae always respect --enable-frame-pointers
Previously it only was respected on x86_64, but this days lots of modern
ABIs are without frame pointers by default (e.g. arm64 and riscv, and
even older mips).
2021-02-14 16:44:28 -08:00
Aliaksey Kandratsenka
22c0eceddc add emacs mode line annotations to remaining files 2021-02-14 16:29:14 -08:00
Aliaksey Kandratsenka
b12139ddba delete-trailing-whitespace on all files 2021-02-14 16:13:15 -08:00
Aliaksey Kandratsenka
419c85814d amputate unused dynamic annotations support 2021-02-14 16:09:17 -08:00
Aliaksey Kandratsenka
73a72cdb61 don't check for snprintf 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
95b52b0504 don't check for unused uname symbol 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
01c2697fac amputate unused SleepForMilliseconds from sysinfo.{h,cc} 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
ac68c97187 don't check for useless __builtin_stack_pointer
It doesn't seem to be supported anyways, and we're not using it too.
2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
7271bb72be unbreak cmake check for TLS support 2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
7c106ca241 don't bother checking for stl namespace and use std
Because there are no compilers left that don't do std namespace.
2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
0d6f32b9ce use standard way to print size_t-sized ints
I.e. just use zu/zd/zx instead of finding out right size and defining
PRI{u,x,d}S defines. Compilers have long caught up to this part of
standard.
2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
0c11d35f4a amputate checking for __int64
Since everything supports stdint.h this days.
2021-02-14 15:44:14 -08:00
Aliaksey Kandratsenka
92718aaaeb amputate checking for conflict-signal.h
It was never found or used.
2021-02-14 15:12:19 -08:00
Aliaksey Kandratsenka
9bb2937261 amputate checking for inline keyword support
It is supported everywhere now.
2021-02-14 15:12:19 -08:00
Đoàn Trần Công Danh
d9c4c3b481 profile-handler: use documented sigev_notify_thread_id in sigevent
sigevent(7) is documented to have sigev_notify_thread_id as its member.
In glibc system, it's a macro expanded to the legacy _sigev_un._tid,
_sigev_un._tid is obviously an internal implementation detail as
signaled by its underscore prefix. And this macro was hidden inside
linux/signal.h in older version of glibc.

On Linux that use musl libc, sigev_notify_thread_id is also a macro, but
it's expanded to __sev_fields.sigev_notify_thread_id

[alkondratenko@gmail.com: amputated broken linux/signal.h dependency]
[alkondratenko@gmail.com: see https://github.com/gperftools/gperftools/pull/1250]
Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
2021-02-14 12:50:10 -08:00
Đoàn Trần Công Danh
43459feb33 configure.ac: check for features.h once 2021-02-14 11:28:07 -08:00
Venkatesh Srinivas
290b123c01 atomicops: Remove Acquire_Store / Release_Load
gperftools' internal atomicops library included atomic
Release Load and Acquire Store operations; those operations
were unused and expressed ordering constraints that aren't
expressible in the C++ standard memory model.

Remove them, to make a transition to C++11 atomics easier
and to avoid confusing use of them.
2021-02-14 11:23:42 -08:00
SSE4
3b1c60cc4e Add support for Elbrus 2000 (e2k) 2021-01-30 13:45:18 -08:00
Jarno Rajahalme
c5747615da syscall: Mark x8 as clobbered
Mark arm64 register x8 as clobbered by syscall body inline assembly as
it is being used to store the syscall number. Otherwise the compiler
may try to use it for some other purpose.

This fix is derived from a resolution to clang Bugzilla report
https://bugs.llvm.org/show_bug.cgi?id=48798.  See this report for a
minimal reproducer derived from the code fixed here as well as the
resolution.

This should fix SEGFAULTs as reported in
https://github.com/envoyproxy/envoy/issues/14756.

Fixes: #1241
Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
2021-01-30 13:43:03 -08:00
Aliaksey Kandratsenka
d8eb315fb1 bump version to 2.8.1 2020-12-20 23:35:08 -08:00
Aliaksey Kandratsenka
6ed61f8e91 add note that cmake build is preliminary 2020-12-19 19:14:50 -08:00
okhowang(王沛文)
6bbf2ed150 Update cmake 2020-12-19 18:52:40 -08:00
Isaac Hier
913d3eb7d7 Fix a few macros for Apple 2020-12-19 18:52:40 -08:00
Isaac Hier
64a73b1cb8 Work on fixing linking errors in stacktrace 2020-12-19 18:52:40 -08:00
Isaac Hier
b788d51eb4 Fix conditional definitions 2020-12-19 18:52:40 -08:00
Isaac Hier
495229b625 Make internal tcmalloc libs 2020-12-19 18:52:40 -08:00
Isaac Hier
cca7f6f669 More unit tests and libraries 2020-12-19 18:52:40 -08:00
Isaac Hier
11dc65c3c4 Fix config headers, add more unit tests 2020-12-19 18:52:40 -08:00
Isaac Hier
6078fe40d9 Finish configure.ac conversion to CMake, start on Makefile.am 2020-12-19 18:52:40 -08:00
Isaac Hier
515fb22196 Generate config header 2020-12-19 18:52:40 -08:00
Isaac Hier
4adb5ff74d Add architecture checks 2020-12-19 18:52:40 -08:00
Isaac Hier
fa9bedc82c Add most of CMake build 2020-12-19 18:52:40 -08:00
Isaac Hier
9e4f72fd1f Define options, start system checks 2020-12-19 18:52:40 -08:00
Isaac Hier
a6ce98174b Add CMakeLists.txt 2020-12-19 18:52:40 -08:00
Steve Langasek
3134955875 Additional porting for riscv64.
Adds handling for the PC register, malloc_hook_mmap, and syscalls.

Successfully built in Ubuntu with these changes.
2020-12-19 18:16:39 -08:00
Steve Langasek
f0e289bdbb Enable build on riscv64.
Cacheline length may be implementation-specific, but this is known to be
correct on the U54.
2020-12-19 18:16:38 -08:00
Tim Gates
6c715b4fa1 docs: fix simple typo, defininitions -> definitions
There is a small typo in src/base/linux_syscall_support.h.

Should read `definitions` rather than `defininitions`.
2020-12-19 18:15:14 -08:00
Aliaksey Kandratsenka
02d5264018 Revert "drop page heap lock when returning memory back to kernel"
This reverts commit be3da70298.

There are reports of crashes and false-positive OOMs from this
patch. Crashes under aggressive decommit mode are understood, but I
have yet to get confirmations whether false-positive OOMs were seen
under aggressive decommit or not. Thus lets revert for now.

Updates issue #1227 and issue #1204.
2020-12-19 17:15:31 -08:00
Grant Henke
151cbf5146 Add OS X arm64 program counter
[alkondratenko@gmail.com: updated comment that it is tested]

Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
2020-12-19 12:39:15 -08:00
Aliaksey Kandratsenka (aka Aliaksei Kandratsenka)
140e3481d0
Merge pull request #1231 from PatriosTheGreat/master
Fix implicit-int-float-conversion warning.
2020-11-17 14:30:59 -08:00
Levon Ter-Grigoryan
0fc5cabdfc Fix implicit-int-float-conversion warning. 2020-11-17 12:29:22 +01:00