about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2023-04-28 17:07:38 +0200
committerFlorian Weimer <fweimer@redhat.com>2023-04-28 18:52:41 +0200
commit0ea8174d62263c2679c95c0d215d2627e560f7aa (patch)
tree152fa5bc26b21e44b389d7d2ef97503e98ee5c9d
parentf1b15d2005f5125529171db3be39026a1157c2a8 (diff)
downloadglibc-0ea8174d62263c2679c95c0d215d2627e560f7aa.tar.gz
glibc-0ea8174d62263c2679c95c0d215d2627e560f7aa.tar.xz
glibc-0ea8174d62263c2679c95c0d215d2627e560f7aa.zip
gmon: Revert addition of tunables to preserve GLIBC_PRIVATE ABI
Otherwise, processes are likely to crash during concurrent updates
to a new glibc version on the stable release branch.

The test gmon/tst-mcount-overflow depends on those tunables, so
it has to be removed as well.
-rw-r--r--gmon/Makefile14
-rw-r--r--gmon/gmon.c16
-rw-r--r--manual/tunables.texi59
3 files changed, 1 insertions, 88 deletions
diff --git a/gmon/Makefile b/gmon/Makefile
index 7fd9db8f74..8aa17b28a4 100644
--- a/gmon/Makefile
+++ b/gmon/Makefile
@@ -26,7 +26,7 @@ include ../Makeconfig
 headers	:= sys/gmon.h sys/gmon_out.h sys/profil.h
 routines := gmon mcount profil sprofil prof-freq
 
-tests	= tst-sprofil tst-gmon tst-mcount-overflow tst-mcleanup
+tests	= tst-sprofil tst-gmon tst-mcleanup
 ifeq ($(build-profile),yes)
 tests	+= tst-profile-static
 tests-static	+= tst-profile-static
@@ -57,18 +57,6 @@ ifeq ($(run-built-tests),yes)
 tests-special += $(objpfx)tst-gmon-gprof.out
 endif
 
-CFLAGS-tst-mcount-overflow.c := -fno-omit-frame-pointer -pg
-tst-mcount-overflow-no-pie = yes
-CRT-tst-mcount-overflow := $(csu-objpfx)g$(start-installed-name)
-# Intentionally use invalid config where maxarcs<minarcs to check warning is printed
-tst-mcount-overflow-ENV := GMON_OUT_PREFIX=$(objpfx)tst-mcount-overflow.data \
-                           GLIBC_TUNABLES=glibc.gmon.minarcs=51:glibc.gmon.maxarcs=50
-# Send stderr into output file because we make sure expected messages are printed
-tst-mcount-overflow-ARGS := 2>&1 1>/dev/null | cat
-ifeq ($(run-built-tests),yes)
-tests-special += $(objpfx)tst-mcount-overflow-check.out
-endif
-
 CFLAGS-tst-mcleanup.c := -fno-omit-frame-pointer -pg
 tst-mcleanup-no-pie = yes
 CRT-tst-mcleanup := $(csu-objpfx)g$(start-installed-name)
diff --git a/gmon/gmon.c b/gmon/gmon.c
index 5e99a7351d..97be1f72ca 100644
--- a/gmon/gmon.c
+++ b/gmon/gmon.c
@@ -46,11 +46,6 @@
 #include <libc-internal.h>
 #include <not-cancel.h>
 
-#if HAVE_TUNABLES
-# define TUNABLE_NAMESPACE gmon
-# include <elf/dl-tunables.h>
-#endif
-
 #ifdef PIC
 # include <link.h>
 
@@ -130,20 +125,9 @@ __monstartup (u_long lowpc, u_long highpc)
   struct gmonparam *p = &_gmonparam;
   long int minarcs, maxarcs;
 
-#if HAVE_TUNABLES
-  /* Read minarcs/maxarcs tunables. */
-  minarcs = TUNABLE_GET (minarcs, int32_t, NULL);
-  maxarcs = TUNABLE_GET (maxarcs, int32_t, NULL);
-  if (maxarcs < minarcs)
-    {
-      ERR("monstartup: maxarcs < minarcs, setting maxarcs = minarcs\n");
-      maxarcs = minarcs;
-    }
-#else
   /* No tunables, we use hardcoded defaults */
   minarcs = MINARCS;
   maxarcs = MAXARCS;
-#endif
 
   /*
    * If we are incorrectly called twice in a row (without an
diff --git a/manual/tunables.texi b/manual/tunables.texi
index 436cefa85c..a3118bc48d 100644
--- a/manual/tunables.texi
+++ b/manual/tunables.texi
@@ -77,9 +77,6 @@ glibc.malloc.check: 0 (min: 0, max: 3)
 				  capabilities seen by @theglibc{}
 * Memory Related Tunables::  Tunables that control the use of memory by
 			     @theglibc{}.
-* gmon Tunables::  Tunables that control the gmon profiler, used in
-                   conjunction with gprof
-
 @end menu
 
 @node Tunable names
@@ -574,59 +571,3 @@ support in the kernel if this tunable has any non-zero value.
 
 The default value is @samp{0}, which disables all memory tagging.
 @end deftp
-
-@node gmon Tunables
-@section gmon Tunables
-@cindex gmon tunables
-
-@deftp {Tunable namespace} glibc.gmon
-This tunable namespace affects the behaviour of the gmon profiler.
-gmon is a component of @theglibc{} which is normally used in
-conjunction with gprof.
-
-When GCC compiles a program with the @code{-pg} option, it instruments
-the program with calls to the @code{mcount} function, to record the
-program's call graph. At program startup, a memory buffer is allocated
-to store this call graph; the size of the buffer is calculated using a
-heuristic based on code size. If during execution, the buffer is found
-to be too small, profiling will be aborted and no @file{gmon.out} file
-will be produced. In that case, you will see the following message
-printed to standard error:
-
-@example
-mcount: call graph buffer size limit exceeded, gmon.out will not be generated
-@end example
-
-Most of the symbols discussed in this section are defined in the header
-@code{sys/gmon.h}. However, some symbols (for example @code{mcount})
-are not defined in any header file, since they are only intended to be
-called from code generated by the compiler.
-@end deftp
-
-@deftp Tunable glibc.mem.minarcs
-The heuristic for sizing the call graph buffer is known to be
-insufficient for small programs; hence, the calculated value is clamped
-to be at least a minimum size. The default minimum (in units of
-call graph entries, @code{struct tostruct}), is given by the macro
-@code{MINARCS}. If you have some program with an unusually complex
-call graph, for which the heuristic fails to allocate enough space,
-you can use this tunable to increase the minimum to a larger value.
-@end deftp
-
-@deftp Tunable glibc.mem.maxarcs
-To prevent excessive memory consumption when profiling very large
-programs, the call graph buffer is allowed to have a maximum of
-@code{MAXARCS} entries. For some very large programs, the default
-value of @code{MAXARCS} defined in @file{sys/gmon.h} is too small; in
-that case, you can use this tunable to increase it.
-
-Note the value of the @code{maxarcs} tunable must be greater or equal
-to that of the @code{minarcs} tunable; if this constraint is violated,
-a warning will printed to standard error at program startup, and
-the @code{minarcs} value will be used as the maximum as well.
-
-Setting either tunable too high may result in a call graph buffer
-whose size exceeds the available memory; in that case, an out of memory
-error will be printed at program startup, the profiler will be
-disabled, and no @file{gmon.out} file will be generated.
-@end deftp