diff options
author | Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | 2024-03-19 18:18:21 -0400 |
---|---|---|
committer | Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | 2024-03-19 18:18:21 -0400 |
commit | 6ea98a7bc2e89649d4bb0888eac596429a7c1576 (patch) | |
tree | 2e2b24aac8194770ba19290c989ca99b509bf6e6 | |
parent | dac2ccf0b62a85885812d36e926590ea39c1baf9 (diff) | |
download | librseq-6ea98a7bc2e89649d4bb0888eac596429a7c1576.tar.gz |
mempool: Introduce COW_ZERO poison value
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id7fdfa0ceb8631e1b4bfe594d9e68c4d8663c6ef
-rw-r--r-- | src/rseq-mempool.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rseq-mempool.c b/src/rseq-mempool.c index 4508ff4..15dd4e5 100644 --- a/src/rseq-mempool.c +++ b/src/rseq-mempool.c @@ -56,11 +56,13 @@ #define RANGE_HEADER_OFFSET sizeof(struct rseq_mempool_range) #if RSEQ_BITS_PER_LONG == 64 -# define DEFAULT_PRIVATE_POISON_VALUE 0x5555555555555555ULL +# define DEFAULT_COW_INIT_POISON_VALUE 0x5555555555555555ULL #else -# define DEFAULT_PRIVATE_POISON_VALUE 0x55555555UL +# define DEFAULT_COW_INIT_POISON_VALUE 0x55555555UL #endif +#define DEFAULT_COW_ZERO_POISON_VALUE 0x0 + struct free_list_node; struct free_list_node { @@ -952,7 +954,10 @@ struct rseq_mempool *rseq_mempool_create(const char *pool_name, attr.stride = RSEQ_MEMPOOL_STRIDE; /* Use default */ if (attr.robust_set && !attr.poison_set) { attr.poison_set = true; - attr.poison = DEFAULT_PRIVATE_POISON_VALUE; + if (attr.populate_policy != RSEQ_MEMPOOL_POPULATE_PRIVATE_ALL) + attr.poison = DEFAULT_COW_INIT_POISON_VALUE; + else + attr.poison = DEFAULT_COW_ZERO_POISON_VALUE; } if (item_len > attr.stride || attr.stride < (size_t) rseq_get_page_len() || !is_pow2(attr.stride)) { |