]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Add a tunable to control use of tagged memory
authorRichard Earnshaw <rearnsha@arm.com>
Fri, 20 Nov 2020 17:20:10 +0000 (17:20 +0000)
committerRichard Earnshaw <rearnsha@arm.com>
Fri, 20 Nov 2020 17:20:10 +0000 (17:20 +0000)
Add a new glibc tunable: mtag.enable, bound to the environment variable
_MTAG_ENABLE.  This is a decimal constant in the range 0-255 but used
as a bit-field.

Bit 0 enables use of tagged memory in the malloc family of functions.
Bit 1 enables precise faulting of tag failure on platforms where this
can be controlled.
Other bits are currently unused, but if set will cause memory tag
checking for the current process to be enabled in the kernel.

elf/dl-tunables.list
manual/tunables.texi

index e1d8225128dbb7bc28f5da0674019983a1804476..652cadc334a082c36103694427e8c44d1600b3b2 100644 (file)
@@ -141,4 +141,13 @@ glibc {
       default: 512
     }
   }
+
+memtag {
+    enable {
+      type: INT_32
+      minval: 0
+      maxval: 255
+      env_alias: _MTAG_ENABLE
+    }
+  }
 }
index d72d7a5ec07b7147387927afb7b12ea2b7466a2e..6ab432a73f21519d4cc9bd78439871a997ece60d 100644 (file)
@@ -36,6 +36,8 @@ their own namespace.
 * POSIX Thread Tunables:: Tunables in the POSIX thread subsystem
 * Hardware Capability Tunables::  Tunables that modify the hardware
                                  capabilities seen by @theglibc{}
+* Memory Tagging Tunables::  Tunables that control the use of hardware
+                            memory tagging
 @end menu
 
 @node Tunable names
@@ -484,3 +486,32 @@ instead.
 
 This tunable is specific to i386 and x86-64.
 @end deftp
+
+@node Memory Tagging Tunables
+@section Memory Tagging Tunables
+@cindex memory tagging tunables
+
+@deftp {Tunable namespace} glibc.memtag
+If the hardware supports memory tagging, these tunables can be used to
+control the way @theglibc{} uses this feature.  Currently, only AArch64
+supports this feature.
+@end deftp
+
+@deftp Tunable glibc.memtag.enable
+This tunable takes a value between 0 and 255 and acts as a bitmask
+that enables various capabilities.
+
+Bit 0 (the least significant bit) causes the malloc subsystem to allocate
+tagged memory, with each allocation being assigned a random tag.
+
+Bit 1 enables precise faulting mode for tag violations on systems that
+support deferred tag violation reporting.  This may cause programs
+to run more slowly.
+
+Other bits are currently reserved.
+
+@Theglibc{} startup code will automatically enable memory tagging
+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