[v2,02/13] elf: Add glibc.rtld.refuse_textrel tunable

Message ID 20261030173000.3245502-3-adhemerval.zanella@linaro.org (mailing list archive)
State Under Review
Delegated to: DJ Delorie
Headers
Series elf: Add loader hardening tunables |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed

Commit Message

Adhemerval Zanella Oct. 30, 2026, 5:27 p.m. UTC
  Setting the new glibc.rtld.refuse_textrel tunable to 1 makes the loader
refuse objects with DT_TEXTREL (or DF_TEXTREL).  The main program fails
to start, a DT_NEEDED dependency fails the program load, an LD_PRELOAD
object is ignored with the usual diagnostic, and dlopen fails.

Objects loaded by _dl_map_object_from_fd are checked after the dynamic
section is parsed, before they are relocated, so no code from such an
object (such as an IFUNC resolver) runs before the check.  The main
program loaded by the kernel is checked in dl_main.

The configure check for text relocations also requires DT_TEXTREL in
the test object, because ARC bfd accepts relocations against local
symbols without setting DT_TEXTREL, so the loader cannot apply them, and
the tests are not built there.

The default tunable value (0) keeps the current behavior.

Checked on x86_64-linux-gnu.
---
 NEWS                                   |  4 ++
 config.make.in                         |  1 +
 configure                              | 32 +++++++++++
 configure.ac                           | 18 ++++++
 elf/Makefile                           | 39 +++++++++++++
 elf/dl-load.c                          |  7 +++
 elf/dl-tunables.list                   |  6 ++
 elf/rtld.c                             |  5 ++
 elf/tst-rtld-list-tunables.exp         |  1 +
 elf/tst-rtld-textrel-default.c         | 20 +++++++
 elf/tst-rtld-textrel-mod.c             | 36 ++++++++++++
 elf/tst-rtld-textrel-needed.c          | 36 ++++++++++++
 elf/tst-rtld-textrel-preload-default.c | 20 +++++++
 elf/tst-rtld-textrel-preload.c         | 47 ++++++++++++++++
 elf/tst-rtld-textrel.c                 | 77 ++++++++++++++++++++++++++
 manual/tunables.texi                   | 12 ++++
 16 files changed, 361 insertions(+)
 create mode 100644 elf/tst-rtld-textrel-default.c
 create mode 100644 elf/tst-rtld-textrel-mod.c
 create mode 100644 elf/tst-rtld-textrel-needed.c
 create mode 100644 elf/tst-rtld-textrel-preload-default.c
 create mode 100644 elf/tst-rtld-textrel-preload.c
 create mode 100644 elf/tst-rtld-textrel.c
  

Patch

diff --git a/NEWS b/NEWS
index 681d676e478..15f1dc86014 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,10 @@  Major new features:
   start position-dependent (non-PIE) executables.  It can be enforced
   system-wide with a nonoverridable entry in /etc/tunables.conf.
 
+* A new tunable, glibc.rtld.refuse_textrel, can be set to 1 to make the
+  dynamic loader refuse to load programs and shared objects with text
+  relocations.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
 * The posix_spawn_file_actions_addchdir and posix_spawn_file_actions_addfchdir
diff --git a/config.make.in b/config.make.in
index 8b467a2efda..9d922717e00 100644
--- a/config.make.in
+++ b/config.make.in
@@ -73,6 +73,7 @@  bind-now = @bindnow@
 have-cxx-thread_local = @libc_cv_cxx_thread_local@
 have-loop-to-function = @libc_cv_cc_loop_to_function@
 have-textrel_ifunc = @libc_cv_textrel_ifunc@
+have-test-textrel = @libc_cv_test_textrel@
 
 multi-arch = @multi_arch@
 
diff --git a/configure b/configure
index 604279533a1..299286a2cea 100755
--- a/configure
+++ b/configure
@@ -673,6 +673,7 @@  SYSINCLUDES
 sysnames
 submachine
 multi_arch
+libc_cv_test_textrel
 libc_cv_textrel_ifunc
 no_stack_protector
 stack_protector
@@ -6355,6 +6356,37 @@  fi
 printf "%s\n" "$libc_cv_textrel_ifunc" >&6; }
 
 
+# Check if the test compiler and linker can create a shared object with a
+# text relocation.
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the test linker supports text relocations" >&5
+printf %s "checking whether the test linker supports text relocations... " >&6; }
+if test ${libc_cv_test_textrel+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) cat > conftest.c <<EOF
+static const __UINTPTR_TYPE__ address __attribute__ ((used, section (".text")))
+  = (__UINTPTR_TYPE__) &address;
+EOF
+libc_cv_test_textrel=no
+if { ac_try='${TEST_CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
+		  -nostdlib -nostartfiles -fPIC -shared -Wl,-z,notext
+		  -o conftest.so conftest.c'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; } \
+   && LC_ALL=C $READELF -dW conftest.so | grep -q TEXTREL; then
+  libc_cv_test_textrel=yes
+fi
+rm -f conftest* ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_textrel" >&5
+printf "%s\n" "$libc_cv_test_textrel" >&6; }
+
+
 # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU attribute retain support" >&5
 printf %s "checking for GNU attribute retain support... " >&6; }
diff --git a/configure.ac b/configure.ac
index 2fe7980fc9c..51e0024ed3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -811,6 +811,24 @@  fi
 rm -f conftest*])
 AC_SUBST(libc_cv_textrel_ifunc)
 
+# Check if the test compiler and linker can create a shared object with a
+# text relocation.
+AC_CACHE_CHECK([whether the test linker supports text relocations],
+	       libc_cv_test_textrel, [dnl
+cat > conftest.c <<EOF
+static const __UINTPTR_TYPE__ address __attribute__ ((used, section (".text")))
+  = (__UINTPTR_TYPE__) &address;
+EOF
+libc_cv_test_textrel=no
+if AC_TRY_COMMAND([${TEST_CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
+		  -nostdlib -nostartfiles -fPIC -shared -Wl,-z,notext
+		  -o conftest.so conftest.c]) \
+   && LC_ALL=C $READELF -dW conftest.so | grep -q TEXTREL; then
+  libc_cv_test_textrel=yes
+fi
+rm -f conftest*])
+AC_SUBST(libc_cv_test_textrel)
+
 # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
 AC_CACHE_CHECK([for GNU attribute retain support],
 	       libc_cv_gnu_retain, [dnl
diff --git a/elf/Makefile b/elf/Makefile
index a347961a6f0..411027dfce4 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -672,6 +672,23 @@  tests-special += \
   $(objpfx)tst-rtld-require-pie-nopie-deny.out \
   # tests-special
 endif
+ifeq (yes,$(have-test-textrel))
+tests += \
+  tst-rtld-textrel \
+  tst-rtld-textrel-default \
+  tst-rtld-textrel-needed \
+  tst-rtld-textrel-preload \
+  tst-rtld-textrel-preload-default \
+  # tests
+ifeq ($(run-built-tests),yes)
+tests-special += \
+  $(objpfx)tst-rtld-textrel-needed-deny.out \
+  # tests-special
+endif
+modules-names += \
+  tst-rtld-textrel-mod \
+  # modules-names
+endif
 ifeq ($(have-dt-relr),yes)
 tests += \
   tst-relr \
@@ -2291,6 +2308,28 @@  $(objpfx)tst-rtld-require-pie-nopie-deny.out: \
 	  && grep -q '^status: 127$$' $@; \
 	  $(evaluate-test)
 
+LDFLAGS-tst-rtld-textrel-mod.so += -Wl,-z,notext
+$(objpfx)tst-rtld-textrel-needed: $(objpfx)tst-rtld-textrel-mod.so
+$(objpfx)tst-rtld-textrel-needed-deny.out: $(objpfx)tst-rtld-textrel-needed
+	$(test-program-cmd-before-env) \
+		$(run-program-env) \
+		GLIBC_TUNABLES=glibc.rtld.refuse_textrel=1 \
+		$(test-program-cmd-after-env) $< \
+		> $@ 2>&1; echo "status: $$?" >> $@; \
+	grep -q ': text relocations are not allowed$$' $@ \
+	  && grep -q '^status: 127$$' $@; \
+	  $(evaluate-test)
+$(objpfx)tst-rtld-textrel-preload.out: $(objpfx)tst-rtld-textrel-mod.so
+$(objpfx)tst-rtld-textrel-preload-default.out: \
+  $(objpfx)tst-rtld-textrel-mod.so
+tst-rtld-textrel-preload-ENV = LD_PRELOAD=$(objpfx)tst-rtld-textrel-mod.so
+tst-rtld-textrel-preload-TUNABLES = glibc.rtld.refuse_textrel=1
+tst-rtld-textrel-preload-default-ENV = \
+  LD_PRELOAD=$(objpfx)tst-rtld-textrel-mod.so
+$(objpfx)tst-rtld-textrel.out: $(objpfx)tst-rtld-textrel-mod.so
+$(objpfx)tst-rtld-textrel-default.out: $(objpfx)tst-rtld-textrel-mod.so
+tst-rtld-textrel-TUNABLES = glibc.rtld.refuse_textrel=1
+
 LDFLAGS-tst-array2 = -Wl,--no-as-needed
 LDFLAGS-tst-array5 = -Wl,--no-as-needed
 
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 1621cb1bdeb..c79e2a0300a 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1305,6 +1305,13 @@  _dl_map_object_from_fd (const char *name, const char *origname, int fd,
       goto lose;
     }
 
+  if (__glibc_unlikely (l->l_info[DT_TEXTREL] != NULL)
+      && TUNABLE_GET (glibc, rtld, refuse_textrel, int32_t, NULL) != 0)
+    {
+      errstring = N_("text relocations are not allowed");
+      goto lose;
+    }
+
   if (l->l_phdr == NULL)
     {
       /* The program header is not contained in any of the segments.
diff --git a/elf/dl-tunables.list b/elf/dl-tunables.list
index 10a2eb77206..c57d72b39ac 100644
--- a/elf/dl-tunables.list
+++ b/elf/dl-tunables.list
@@ -119,6 +119,12 @@  glibc {
       maxval: 1
       default: 0
     }
+    refuse_textrel {
+      type: INT_32
+      minval: 0
+      maxval: 1
+      default: 0
+    }
   }
 
   mem {
diff --git a/elf/rtld.c b/elf/rtld.c
index 3f4c7c2cf71..c1b1395dba0 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1263,6 +1263,11 @@  rtld_check_main_map (const struct link_map *main_map)
       && !rtld_main_map_is_pie (main_map))
     _dl_fatal_printf ("\
 Fatal glibc error: non-PIE executable is not allowed\n");
+
+  if (__glibc_unlikely (main_map->l_info[DT_TEXTREL] != NULL)
+      && TUNABLE_GET (glibc, rtld, refuse_textrel, int32_t, NULL) != 0)
+    _dl_fatal_printf ("\
+Fatal glibc error: text relocations are not allowed\n");
 }
 
 /* Set up the program header information for the dynamic linker
diff --git a/elf/tst-rtld-list-tunables.exp b/elf/tst-rtld-list-tunables.exp
index d8fa523f80e..87b50cd077b 100644
--- a/elf/tst-rtld-list-tunables.exp
+++ b/elf/tst-rtld-list-tunables.exp
@@ -15,4 +15,5 @@  glibc.rtld.enable_secure: 0 (min: 0, max: 1)
 glibc.rtld.execstack: 1 (min: 0, max: 2)
 glibc.rtld.nns: 0x4 (min: 0x1, max: 0x10)
 glibc.rtld.optional_static_tls: 0x200 (min: 0x0, max: 0x[f]+)
+glibc.rtld.refuse_textrel: 0 (min: 0, max: 1)
 glibc.rtld.require_pie: 0 (min: 0, max: 1)
diff --git a/elf/tst-rtld-textrel-default.c b/elf/tst-rtld-textrel-default.c
new file mode 100644
index 00000000000..68e7aa64c0c
--- /dev/null
+++ b/elf/tst-rtld-textrel-default.c
@@ -0,0 +1,20 @@ 
+/* Test that text relocations are allowed by default.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#define TEXTREL_ALLOWED 1
+#include "tst-rtld-textrel.c"
diff --git a/elf/tst-rtld-textrel-mod.c b/elf/tst-rtld-textrel-mod.c
new file mode 100644
index 00000000000..49139012881
--- /dev/null
+++ b/elf/tst-rtld-textrel-mod.c
@@ -0,0 +1,36 @@ 
+/* Shared object with a text relocation, used by tst-rtld-textrel.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdint.h>
+
+/* Force a text relocation in the object.  */
+static const uintptr_t
+address __attribute__ ((used, section (".text"))) = (uintptr_t) &address;
+
+uintptr_t
+tst_rtld_textrel_value (void)
+{
+  /* Read the value from memory, so that the compiler does not fold it.  */
+  return *(const volatile uintptr_t *) &address;
+}
+
+const void *
+tst_rtld_textrel_location (void)
+{
+  return &address;
+}
diff --git a/elf/tst-rtld-textrel-needed.c b/elf/tst-rtld-textrel-needed.c
new file mode 100644
index 00000000000..46f219a0350
--- /dev/null
+++ b/elf/tst-rtld-textrel-needed.c
@@ -0,0 +1,36 @@ 
+/* Test a program with a dependency with text relocations.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <stdint.h>
+#include <support/check.h>
+
+/* tst-rtld-textrel-mod.so is a DT_NEEDED dependency of this program, so
+   it does not start with glibc.rtld.refuse_textrel=1, which
+   tst-rtld-textrel-needed-deny checks.  */
+uintptr_t tst_rtld_textrel_value (void);
+const void *tst_rtld_textrel_location (void);
+
+static int
+do_test (void)
+{
+  TEST_COMPARE (tst_rtld_textrel_value (),
+		(uintptr_t) tst_rtld_textrel_location ());
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/elf/tst-rtld-textrel-preload-default.c b/elf/tst-rtld-textrel-preload-default.c
new file mode 100644
index 00000000000..836e36a99bd
--- /dev/null
+++ b/elf/tst-rtld-textrel-preload-default.c
@@ -0,0 +1,20 @@ 
+/* Test that LD_PRELOAD of an object with text relocations works by default.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#define TEXTREL_ALLOWED 1
+#include "tst-rtld-textrel-preload.c"
diff --git a/elf/tst-rtld-textrel-preload.c b/elf/tst-rtld-textrel-preload.c
new file mode 100644
index 00000000000..e6f2201c3bb
--- /dev/null
+++ b/elf/tst-rtld-textrel-preload.c
@@ -0,0 +1,47 @@ 
+/* Test LD_PRELOAD of a shared object with text relocations.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <dlfcn.h>
+#include <stdint.h>
+#include <support/check.h>
+#include <support/xdlfcn.h>
+
+/* Both tests run with LD_PRELOAD=tst-rtld-textrel-mod.so.
+   tst-rtld-textrel-preload also sets glibc.rtld.refuse_textrel=1, so the
+   preloaded object is ignored, and tst-rtld-textrel-preload-default
+   checks that it is loaded otherwise.  */
+#ifndef TEXTREL_ALLOWED
+# define TEXTREL_ALLOWED 0
+#endif
+
+static int
+do_test (void)
+{
+#if TEXTREL_ALLOWED
+  uintptr_t (*value) (void) = xdlsym (RTLD_DEFAULT, "tst_rtld_textrel_value");
+  const void *(*location) (void)
+    = xdlsym (RTLD_DEFAULT, "tst_rtld_textrel_location");
+  TEST_COMPARE (value (), (uintptr_t) location ());
+#else
+  TEST_VERIFY (dlsym (RTLD_DEFAULT, "tst_rtld_textrel_value") == NULL);
+#endif
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/elf/tst-rtld-textrel.c b/elf/tst-rtld-textrel.c
new file mode 100644
index 00000000000..a8df403f861
--- /dev/null
+++ b/elf/tst-rtld-textrel.c
@@ -0,0 +1,77 @@ 
+/* Test the glibc.rtld.refuse_textrel tunable.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <dlfcn.h>
+#include <link.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <support/check.h>
+#include <support/xdlfcn.h>
+
+/* tst-rtld-textrel runs with glibc.rtld.refuse_textrel=1, and
+   tst-rtld-textrel-default with the default value.  */
+#ifndef TEXTREL_ALLOWED
+# define TEXTREL_ALLOWED 0
+#endif
+
+#define MODULE "tst-rtld-textrel-mod.so"
+
+#if TEXTREL_ALLOWED
+static bool
+has_textrel (const struct link_map *l)
+{
+  for (const ElfW(Dyn) *d = l->l_ld; d->d_tag != DT_NULL; d++)
+    if (d->d_tag == DT_TEXTREL
+	|| (d->d_tag == DT_FLAGS && (d->d_un.d_val & DF_TEXTREL) != 0))
+      return true;
+  return false;
+}
+#endif
+
+static int
+do_test (void)
+{
+#if TEXTREL_ALLOWED
+  void *h = xdlopen (MODULE, RTLD_NOW);
+
+  /* Check that the module has a text relocation, so that the failure in
+     tst-rtld-textrel is caused by the tunable, and that it was applied.  */
+  struct link_map *l;
+  TEST_COMPARE (dlinfo (h, RTLD_DI_LINKMAP, &l), 0);
+  TEST_VERIFY (has_textrel (l));
+
+  uintptr_t (*value) (void) = xdlsym (h, "tst_rtld_textrel_value");
+  const void *(*location) (void) = xdlsym (h, "tst_rtld_textrel_location");
+  TEST_COMPARE (value (), (uintptr_t) location ());
+
+  xdlclose (h);
+#else
+  void *h = dlopen (MODULE, RTLD_NOW);
+  TEST_VERIFY (h == NULL);
+  const char *err = dlerror ();
+  TEST_VERIFY_EXIT (err != NULL);
+  printf ("info: dlopen error: %s\n", err);
+  TEST_VERIFY (strstr (err, "text relocations are not allowed") != NULL);
+#endif
+
+  return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/manual/tunables.texi b/manual/tunables.texi
index 37ec3e89a05..0db586d0647 100644
--- a/manual/tunables.texi
+++ b/manual/tunables.texi
@@ -498,6 +498,18 @@  The default value of this tunable is @samp{0}, which allows
 position-dependent executables.
 @end deftp
 
+@deftp Tunable glibc.rtld.refuse_textrel
+Objects with text relocations (@code{DT_TEXTREL}) require the dynamic
+loader to make their read-only segments, which usually include code,
+writable while they are relocated.  Setting the
+@code{glibc.rtld.refuse_textrel} tunable to @code{1} makes the dynamic
+loader refuse to load such objects: the main program fails to start, and
+@code{dlopen} of such a shared object fails.
+
+The default value of this tunable is @samp{0}, which allows text
+relocations.
+@end deftp
+
 @node POSIX Thread Tunables
 @section POSIX Thread Tunables
 @cindex pthread mutex tunables