diff mbox series

[SRU,J:linux/J:hwe-6.8,1/1] UBUNTU SAUCE: Revert "randomize_kstack: Improve entropy diffusion"

Message ID 20240801134549.91291-2-roxana.nicolescu@canonical.com
State New
Headers show
Series Fix virtualbox regression | expand

Commit Message

Roxana Nicolescu Aug. 1, 2024, 1:45 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2073267

This reverts "randomize_kstack: Improve entropy diffusion" that changed
the kernel stack for entropy to 1KiB, limitting the thread kernel stack to
15KiB. This impacts virtualbox 6.1.50 on jammy, that is no longer
maintained upstream. The issue does not persist on version 7.0.20 due to a
code refactoring that probably resulted in less stack usage. Fixing it on
the jammy virtualbox package side is not straightfoward because the fix is
not easy to backport to 6.x and upgrading the jammy package to 7.x breaks
current users machines.
This is a temporary solution needed due to the impact, more investigation
is required.

Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
---
 include/linux/randomize_kstack.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/linux/randomize_kstack.h b/include/linux/randomize_kstack.h
index 5d52d15faee0c..d373f1bcbf7ca 100644
--- a/include/linux/randomize_kstack.h
+++ b/include/linux/randomize_kstack.h
@@ -58,7 +58,7 @@  DECLARE_PER_CPU(u32, kstack_offset);
 	if (static_branch_maybe(CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT,	\
 				&randomize_kstack_offset)) {		\
 		u32 offset = raw_cpu_read(kstack_offset);		\
-		offset = ror32(offset, 5) ^ (rand);			\
+		offset ^= (rand);					\
 		raw_cpu_write(kstack_offset, offset);			\
 	}								\
 } while (0)