summary refs log tree commit diff
path: root/manual
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2020-07-07 10:49:11 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2020-07-08 17:32:56 +0100
commit17796419b5fd694348cceb65c3f77601faae082c (patch)
tree077996aa8d9b0151191a812928de0b8d10225c2d /manual
parent0c7b002fac12dcb2f53ba83ee56bb3b5d2439447 (diff)
downloadglibc-17796419b5fd694348cceb65c3f77601faae082c.tar.gz
glibc-17796419b5fd694348cceb65c3f77601faae082c.tar.xz
glibc-17796419b5fd694348cceb65c3f77601faae082c.zip
rtld: Account static TLS surplus for audit modules
The new static TLS surplus size computation is

  surplus_tls = 192 * (nns-1) + 144 * nns + 512

where nns is controlled via the rtld.nns tunable. This commit
accounts audit modules too so nns = rtld.nns + audit modules.

rtld.nns should only include the namespaces required by the
application, namespaces for audit modules are accounted on top
of that so audit modules don't use up the static TLS that is
reserved for the application. This allows loading many audit
modules without tuning rtld.nns or using up static TLS, and it
fixes

FAIL: elf/tst-auditmany

Note that DL_NNS is currently a hard upper limit for nns, and
if rtld.nns + audit modules go over the limit that's a fatal
error. By default rtld.nns is 4 which allows 12 audit modules.

Counting the audit modules is based on existing audit string
parsing code, we cannot use GLRO(dl_naudit) before the modules
are actually loaded.
Diffstat (limited to 'manual')
-rw-r--r--manual/tunables.texi9
1 files changed, 6 insertions, 3 deletions
diff --git a/manual/tunables.texi b/manual/tunables.texi
index dbfb3308d1..7e8140199c 100644
--- a/manual/tunables.texi
+++ b/manual/tunables.texi
@@ -242,9 +242,12 @@ Sets the number of supported dynamic link namespaces (see @code{dlmopen}).
 Currently this limit can be set between 1 and 16 inclusive, the default is 4.
 Each link namespace consumes some memory in all thread, and thus raising the
 limit will increase the amount of memory each thread uses. Raising the limit
-is useful when your application uses more than 4 dynamic linker audit modules
-e.g. @env{LD_AUDIT}, or will use more than 4 dynamic link namespaces as created
-by @code{dlmopen} with an lmid argument of @code{LM_ID_NEWLM}.
+is useful when your application uses more than 4 dynamic link namespaces as
+created by @code{dlmopen} with an lmid argument of @code{LM_ID_NEWLM}.
+Dynamic linker audit modules are loaded in their own dynamic link namespaces,
+but they are not accounted for in @code{glibc.rtld.nns}.  They implicitly
+increase the per-thread memory usage as necessary, so this tunable does
+not need to be changed to allow many audit modules e.g. via @env{LD_AUDIT}.
 @end deftp
 
 @node Elision Tunables