From 19fc1ee77c4ff4627617f4e3b1cd6bbac6c2537a Mon Sep 17 00:00:00 2001 From: Filip Kokosinski Date: Fri, 6 Aug 2021 14:06:02 +0200 Subject: [PATCH] subsys/random: change parameters for timer-based PRNG PR #36996 disabled running mem_protect/stack_random test on qemu_riscv32 platform because of this test consistently failing on said platform. This test starts new threads in equal time intervals, and because of that we get repeating values after performing the modulus operation when calculating the stack pointer address. This can be solved by changing the value of the _RAND32_INC constant that is used to increase the value returned by the timer-based PRNG. This commit decreases the value of the mentioned constant from 1000000013U to 1000000003U. Fixes #37006. Signed-off-by: Filip Kokosinski --- subsys/random/rand32_timer.c | 2 +- tests/kernel/mem_protect/stack_random/testcase.yaml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/subsys/random/rand32_timer.c b/subsys/random/rand32_timer.c index 620abbbf807..eaea324eeed 100644 --- a/subsys/random/rand32_timer.c +++ b/subsys/random/rand32_timer.c @@ -28,7 +28,7 @@ */ static atomic_val_t _rand32_counter; -#define _RAND32_INC 1000000013U +#define _RAND32_INC 1000000003U /** * diff --git a/tests/kernel/mem_protect/stack_random/testcase.yaml b/tests/kernel/mem_protect/stack_random/testcase.yaml index 7f2f8caa642..ebf9ec70637 100644 --- a/tests/kernel/mem_protect/stack_random/testcase.yaml +++ b/tests/kernel/mem_protect/stack_random/testcase.yaml @@ -1,5 +1,4 @@ tests: kernel.memory_protection.stack_random: arch_exclude: posix - platform_exclude: qemu_riscv32 tags: kernel memory_protection