[LTP] [PATCH 1/9] KVM: Disable EBP register use in 32bit code

Martin Doucha mdoucha@suse.cz
Tue Apr 30 14:21:57 CEST 2024


The EBP register points to the stack segment by default but GCC uses
it to access data segment without the proper prefix. This works fine
on most systems because the stack and data segments are usually
identical. However, KVM environment intentionally enforces strict
limits on the stack segment and access to the data segment using
unprefixed EBP would trigger stack segment fault exception in 32bit
LTP builds (stack segment limits are ignored in 64bit mode).

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/kvm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/kvm/Makefile b/testcases/kernel/kvm/Makefile
index ce4a5ede2..c85790e11 100644
--- a/testcases/kernel/kvm/Makefile
+++ b/testcases/kernel/kvm/Makefile
@@ -22,7 +22,7 @@ ifeq ($(HOST_CPU),x86_64)
 endif
 
 ifeq ($(HOST_CPU),x86)
-	GUEST_CFLAGS += -m32
+	GUEST_CFLAGS += -m32 -ffixed-ebp
 	ASFLAGS += --32
 endif
 
-- 
2.44.0



More information about the ltp mailing list