From 306c98f802481414cc207de94d938045cb8631ba Mon Sep 17 00:00:00 2001
From: Thibaut Benjamin <thibaut.benjamin@gmail.com>
Date: Fri, 1 Apr 2022 15:20:43 +0200
Subject: [PATCH] [eacsl] increase  tls size to always include standard streams

---
 .../internals/e_acsl_safe_locations.c         |  30 +++
 .../internals/e_acsl_safe_locations.h         |   8 +
 .../segment_model/e_acsl_shadow_concurrency.c |   3 +-
 .../segment_model/e_acsl_shadow_layout.c      |  42 ++-
 .../oracle_dev/threads_debug.e-acsl.err.log   | 246 +++++++++---------
 .../e-acsl/tests/concurrency/threads_debug.c  |   2 +-
 .../e-acsl/tests/special/e-acsl-rt-debug.c    |   2 +-
 .../oracle_dev/e-acsl-rt-debug.e-acsl.err.log |   6 +-
 8 files changed, 202 insertions(+), 137 deletions(-)

diff --git a/src/plugins/e-acsl/share/e-acsl/observation_model/internals/e_acsl_safe_locations.c b/src/plugins/e-acsl/share/e-acsl/observation_model/internals/e_acsl_safe_locations.c
index 4169419fdbf..a8c8f41d96f 100644
--- a/src/plugins/e-acsl/share/e-acsl/observation_model/internals/e_acsl_safe_locations.c
+++ b/src/plugins/e-acsl/share/e-acsl/observation_model/internals/e_acsl_safe_locations.c
@@ -42,14 +42,44 @@ static __thread int safe_location_counter = 0;
     safe_location_counter++;                                                   \
   } while (0)
 
+struct segment_boundaries safe_locations_boundaries = {
+    .start = 0,
+    .end = 0,
+};
+
+uintptr_t get_safe_locations_start() {
+  uintptr_t min = get_safe_location(0)->address;
+  for (int i = 1; i < get_safe_locations_count(); i++) {
+    memory_location *location = get_safe_location(i);
+    if (min >= location->address)
+      min = location->address;
+  }
+  return min;
+}
+
+uintptr_t get_safe_locations_end() {
+  memory_location *first_location = get_safe_location(0);
+  uintptr_t max = first_location->address;
+  for (int i = 1; i < get_safe_locations_count(); i++) {
+    memory_location *location = get_safe_location(i);
+    if (max <= location->address)
+      max = location->address;
+  }
+  return max;
+}
+
 void collect_safe_locations() {
   /* Tracking of errno and standard streams */
   add_safe_location((uintptr_t)&errno, sizeof(int), 1, E_ACSL_OS_IS_LINUX);
   add_safe_location((uintptr_t)stdout, sizeof(FILE), 1, E_ACSL_OS_IS_LINUX);
   add_safe_location((uintptr_t)stderr, sizeof(FILE), 1, E_ACSL_OS_IS_LINUX);
   add_safe_location((uintptr_t)stdin, sizeof(FILE), 1, E_ACSL_OS_IS_LINUX);
+  safe_locations_boundaries.start = get_safe_locations_start();
+  safe_locations_boundaries.end = get_safe_locations_end();
 }
 
+/* collect_safe_locations(); */
+
 size_t get_safe_locations_count() {
   return safe_location_counter;
 }
diff --git a/src/plugins/e-acsl/share/e-acsl/observation_model/internals/e_acsl_safe_locations.h b/src/plugins/e-acsl/share/e-acsl/observation_model/internals/e_acsl_safe_locations.h
index 19c05fec068..f77a3ca4c0f 100644
--- a/src/plugins/e-acsl/share/e-acsl/observation_model/internals/e_acsl_safe_locations.h
+++ b/src/plugins/e-acsl/share/e-acsl/observation_model/internals/e_acsl_safe_locations.h
@@ -50,6 +50,14 @@ struct memory_location {
 };
 typedef struct memory_location memory_location;
 
+struct segment_boundaries {
+  uintptr_t start;
+  uintptr_t end;
+};
+typedef struct segment_boundaries segment_boundaries;
+
+struct segment_boundaries safe_locations_boundaries;
+
 /*! Initialize the array of safe locations */
 void collect_safe_locations();
 
diff --git a/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_shadow_concurrency.c b/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_shadow_concurrency.c
index 042eef56fbc..2292d2f6f17 100644
--- a/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_shadow_concurrency.c
+++ b/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_shadow_concurrency.c
@@ -183,7 +183,8 @@ static void fill_thread_layout_stack(memory_partition *pstack,
 static void fill_thread_layout_tls(memory_partition *ptls) {
   // Since the TLS is by design specific to each thread, we can reuse the
   // method used to identify the TLS segment in the main thread
-  set_application_segment(&ptls->application, get_tls_start(), get_tls_size(),
+  collect_safe_locations();
+  set_application_segment(&ptls->application, get_tls_start(0), get_tls_size(),
                           "thread_tls", NULL);
   set_shadow_segment(&ptls->primary, &ptls->application, 1,
                      "thread_tls_primary");
diff --git a/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_shadow_layout.c b/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_shadow_layout.c
index 258cc25fde8..2b58af42b3b 100644
--- a/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_shadow_layout.c
+++ b/src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_shadow_layout.c
@@ -53,6 +53,9 @@ extern char end;
 /*!\brief The first address of a program. */
 extern char __executable_start;
 
+uintptr_t actual_tls_size = 0;
+uintptr_t registered_tls_start = 0;
+
 size_t increase_stack_limit(const size_t size) {
   rlim_t stacksz = (rlim_t)size;
   struct rlimit rl;
@@ -166,7 +169,7 @@ static size_t get_global_size() {
 
 /*! \brief Return byte-size of the TLS segment */
 inline size_t get_tls_size() {
-  return PGM_TLS_SIZE;
+  return (actual_tls_size == 0 ? PGM_TLS_SIZE : actual_tls_size);
 }
 
 static __thread int id_tdata = 1;
@@ -220,12 +223,30 @@ static void grow_bounds_for_size(uintptr_t *min_bound, uintptr_t *max_bound,
   }
 }
 
+static void init_tls_size() {
+  uintptr_t data = (uintptr_t)&id_tdata, bss = (uintptr_t)&id_tbss;
+  uintptr_t min_safe_loc = safe_locations_boundaries.start;
+  uintptr_t max_safe_loc = safe_locations_boundaries.end;
+  uintptr_t min_addr = data < bss ? data : bss;
+  uintptr_t max_addr = data > bss ? data : bss;
+  min_addr = min_addr < min_safe_loc ? min_addr : min_safe_loc;
+  max_addr = max_addr > max_safe_loc ? max_addr : max_safe_loc;
+  uintptr_t size = (max_addr - min_addr + 1) * 2;
+  actual_tls_size = size > PGM_TLS_SIZE ? size : PGM_TLS_SIZE;
+}
+
 /*! \brief Return start address of a program's TLS */
-uintptr_t get_tls_start() {
+uintptr_t get_tls_start(int main_thread) {
   size_t tls_size = get_tls_size();
   uintptr_t data = (uintptr_t)&id_tdata, bss = (uintptr_t)&id_tbss;
+  uintptr_t min_safe_loc = safe_locations_boundaries.start;
+  uintptr_t max_safe_loc = safe_locations_boundaries.end;
   uintptr_t min_addr = data < bss ? data : bss;
   uintptr_t max_addr = data > bss ? data : bss;
+  if (main_thread) {
+    min_addr = min_addr < min_safe_loc ? min_addr : min_safe_loc;
+    max_addr = max_addr > max_safe_loc ? max_addr : max_safe_loc;
+  }
 
   // We do not exactly know the bounds of the TLS, we can only guess an
   // approximation. To do that, we take TLS's known addresses and add a buffer
@@ -287,15 +308,19 @@ uintptr_t get_tls_start() {
     private_abort("Unsupported TLS area in the middle of heap area.\n"
                   "Example bss TLS address: %a\n"
                   "Example data TLS address: %a\n"
-                  "Estimated bounds of heap area: [%a, %a]\n",
-                  bss, data, min_bound, max_bound);
+                  "Range of safe locations data: [%a, %a]\n"
+                  "Estimated bounds of heap area: [%a, %a]\n"
+                  "Minimal TLS address: %a\n",
+                  bss, data, min_safe_loc, max_safe_loc, min_bound, max_bound,
+                  min_addr);
   }
-
   private_assert(tls_start <= min_addr && max_addr <= tls_end,
                  "Configured TLS size smaller than actual TLS size\n"
                  "Configured TLS size: %" PRIxPTR " MB\n"
                  "Minimum supported TLS size for this execution: %" PRIxPTR
-                 " MB (%" PRIxPTR " B)\n",
+                 " MB (%" PRIxPTR " B)\n"
+                 "Please ensure that the TLS size has been initialize with "
+                 "[init_tls_size()]",
                  MB_SZ(tls_size),
                  // The minimum actual size is found by substracting the lesser
                  // known TLS address to the greater one. Since we estimate the
@@ -328,7 +353,9 @@ static void init_shadow_layout_global() {
 
 static void init_shadow_layout_tls() {
   memory_partition *ptls = &mem_layout.tls;
-  set_application_segment(&ptls->application, get_tls_start(), get_tls_size(),
+  collect_safe_locations();
+  init_tls_size();
+  set_application_segment(&ptls->application, get_tls_start(1), get_tls_size(),
                           "tls", NULL);
   /* Changes of the ratio in the following would require changes in get_tls_start */
   set_shadow_segment(&ptls->primary, &ptls->application, 1, "tls_primary");
@@ -709,7 +736,6 @@ void init_shadow_layout_main(int *argc_ref, char ***argv_ref) {
 }
 
 void register_safe_locations(int thread_only) {
-  collect_safe_locations();
   int count = get_safe_locations_count();
   for (int i = 0; i < count; ++i) {
     memory_location *loc = get_safe_location(i);
diff --git a/src/plugins/e-acsl/tests/concurrency/oracle_dev/threads_debug.e-acsl.err.log b/src/plugins/e-acsl/tests/concurrency/oracle_dev/threads_debug.e-acsl.err.log
index e338b6d403c..22ba0d967c8 100644
--- a/src/plugins/e-acsl/tests/concurrency/oracle_dev/threads_debug.e-acsl.err.log
+++ b/src/plugins/e-acsl/tests/concurrency/oracle_dev/threads_debug.e-acsl.err.log
@@ -11,172 +11,172 @@
    Primary    : xxxkB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
    Secondary  : xxxkB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> TLS ----------------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> VDSO ---------------------
    Application: xxxkB [0x0000-0000-0000, 0x0000-0000-0000]
    Primary    : xxxkB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
    Secondary  : xxxkB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> --------------------------
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread stack -------------
-   Application: 16 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 16 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 19 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 19 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> Thread TLS ---------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
  *** WARNING: Leakedxxxbytes of heap memory in 2 blocks
diff --git a/src/plugins/e-acsl/tests/concurrency/threads_debug.c b/src/plugins/e-acsl/tests/concurrency/threads_debug.c
index 35837359d4f..e5cf53be95a 100644
--- a/src/plugins/e-acsl/tests/concurrency/threads_debug.c
+++ b/src/plugins/e-acsl/tests/concurrency/threads_debug.c
@@ -4,7 +4,7 @@
   MACRO: ROOT_EACSL_GCC_OPTS_EXT --rt-debug --rt-verbose --concurrency
 
   COMMENT: Filter the addresses of the output so that the test is deterministic.
-  MACRO: ROOT_EACSL_EXEC_FILTER sed -e s_0x[0-9a-f-]*_0x0000-0000-0000_g | sed -e s_Offset:\s[0-9-]*_Offset:xxxxx_g | sed -e s/[0-9]*\skB/xxxkB/g | sed -e s/Leaked.*bytes/Leakedxxxbytes/g
+  MACRO: ROOT_EACSL_EXEC_FILTER sed -e s_0x[0-9a-f-]*_0x0000-0000-0000_g | sed -e s_Offset:\s[0-9-]*_Offset:xxxxx_g | sed -e s/[0-9]*\skB/xxxkB/g | sed -e s/Leaked.*bytes/Leakedxxxbytes/g | sed -e s/[0-9]*\sMB/xxMB/g
 */
 
 // Include existing test
diff --git a/src/plugins/e-acsl/tests/special/e-acsl-rt-debug.c b/src/plugins/e-acsl/tests/special/e-acsl-rt-debug.c
index ec28d64c54f..3dad85476b7 100644
--- a/src/plugins/e-acsl/tests/special/e-acsl-rt-debug.c
+++ b/src/plugins/e-acsl/tests/special/e-acsl-rt-debug.c
@@ -5,7 +5,7 @@
 /* run.config_dev
   MACRO: ROOT_EACSL_GCC_OPTS_EXT --rt-debug --rt-verbose --full-mtracking
   COMMENT: Filter the addresses of the output so that the test is deterministic.
-  MACRO: ROOT_EACSL_EXEC_FILTER sed -e s_0x[0-9a-f-]*_0x0000-0000-0000_g | sed -e s_Offset:\s[0-9-]*_Offset:xxxxx_g | sed -e s/[0-9]*\skB/xxxkB/g
+  MACRO: ROOT_EACSL_EXEC_FILTER sed -e s_0x[0-9a-f-]*_0x0000-0000-0000_g | sed -e s_Offset:\s[0-9-]*_Offset:xxxxx_g | sed -e s/[0-9]*\skB/xxxkB/g | sed -e s/[0-9]*\sMB/xxMB/g
  */
 int main() {
   return 0;
diff --git a/src/plugins/e-acsl/tests/special/oracle_dev/e-acsl-rt-debug.e-acsl.err.log b/src/plugins/e-acsl/tests/special/oracle_dev/e-acsl-rt-debug.e-acsl.err.log
index 4606d546818..dba7d415d87 100644
--- a/src/plugins/e-acsl/tests/special/oracle_dev/e-acsl-rt-debug.e-acsl.err.log
+++ b/src/plugins/e-acsl/tests/special/oracle_dev/e-acsl-rt-debug.e-acsl.err.log
@@ -11,9 +11,9 @@
    Primary    : xxxkB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
    Secondary  : xxxkB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> TLS ----------------------
-   Application: 2 MB [0x0000-0000-0000, 0x0000-0000-0000]
-   Primary    : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-   Secondary  : 2 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Application: 3 MB [0x0000-0000-0000, 0x0000-0000-0000]
+   Primary    : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
+   Secondary  : 3 MB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
 >>> VDSO ---------------------
    Application: xxxkB [0x0000-0000-0000, 0x0000-0000-0000]
    Primary    : xxxkB [0x0000-0000-0000, 0x0000-0000-0000]{ Offset:xxxxx }
-- 
GitLab