From 39678e16e805d92ebaa465172bd92f5c245a1756 Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Mon, 6 Jul 2026 18:51:24 +0200 Subject: [PATCH] tests/tcg/multiarch: Improve mutator randomness Currently mutators perform the same actions, because the RNG seed is derived from the current time in seconds. Mix in thread ID. Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson Message-ID: <20260706165445.57418-3-iii@linux.ibm.com> --- tests/tcg/multiarch/vma-pthread.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tcg/multiarch/vma-pthread.c b/tests/tcg/multiarch/vma-pthread.c index 7045da08fc..0b8ce9751b 100644 --- a/tests/tcg/multiarch/vma-pthread.c +++ b/tests/tcg/multiarch/vma-pthread.c @@ -11,6 +11,7 @@ * pages, which are guaranteed to have the respective protection bit set. * Two mutator threads change the non-fixed protection bits randomly. */ +#define _GNU_SOURCE #include #include #include @@ -121,7 +122,7 @@ static void *thread_mutate(void *arg) unsigned int seed; int prot, ret; - seed = (unsigned int)time(NULL); + seed = (unsigned int)time(NULL) + (unsigned int)gettid(); for (i = 0; i < 10000; i++) { start_idx = rand_r(&seed) & PAGE_IDX_MASK; end_idx = rand_r(&seed) & PAGE_IDX_MASK;