]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
cheri: malloc: add tunable to turn narrowing off
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 6 Oct 2022 11:00:39 +0000 (12:00 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 12 Oct 2022 13:22:03 +0000 (14:22 +0100)
elf/dl-tunables.list
malloc/arena.c
manual/tunables.texi

index e6a56b307053a5f9e443f6cebf6c50c25cb559cc..83f47dcd9a8f231d884db3b1269efdc5fc615d1c 100644 (file)
@@ -159,6 +159,13 @@ glibc {
       maxval: 255
       security_level: SXID_IGNORE
     }
+    cap_narrowing {
+      type: INT_32
+      minval: 0
+      maxval: 1
+      default: 1
+      security_level: SXID_IGNORE
+    }
   }
 
   rtld {
index 894f49b91148a354c0ed5dc91de34f656ee063b3..85cc2ad066ee13e53601b5b680122194dcd32c63 100644 (file)
@@ -326,6 +326,12 @@ ptmalloc_init (void)
   tcache_key_initialize ();
 #endif
 
+#ifdef __CHERI_PURE_CAPABILITY__
+  if (TUNABLE_GET_FULL (glibc, mem, cap_narrowing, int32_t, NULL) == 0)
+    cap_narrowing_enabled = false;
+  else
+    cap_narrowing_enabled = true;
+#endif
   cap_init ();
 
 #ifdef USE_MTAG
index 83cdcdac6dc70098b0408133d4a6f1987bd84eca..ffe0202627ff5f69d8312eb1ee4e4453d17b817f 100644 (file)
@@ -612,3 +612,9 @@ 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
+
+@deftp Tunable glibc.mem.cap_narrowing
+On CHERI architecture use capability bounds narrowing in the malloc
+implementation. By default it is set to 1, to disable bounds narrowing
+set it to 0.
+@end deftp