[Devel] [PATCH vz10] selftests: syscall_user_dispatch: keep the frame pointer in sud_benchmark

Eva Kurchatova eva.kurchatova at virtuozzo.com
Wed Sep 9 00:32:59 MSK 2026


The SIGSYS handler returns by hand: it loads __NR_rt_sigreturn, runs
leaveq to drop its frame, adjusts the stack and issues the syscall. leaveq
restores the stack from the frame pointer, so the sequence only works in a
function that has one.

gcc omits the frame pointer from -O1 up, so the handler restores a stack
that is not the signal frame and rt_sigreturn resumes at a bogus address:

  Caught sys_ff00
  Segmentation fault

Upstream never sees it, as the Makefile passes no -O and the default is
-O0, but the tests here are built with the distribution optimisation
flags. Measured: -O0 passes, -O1 and -O2 fault, and either of them with
-fno-omit-frame-pointer passes.

Ask for the frame pointer, which is what the assembly needs. sud_test is
unaffected either way.

https://virtuozzo.atlassian.net/browse/VSTOR-144593
Feature: fix selftests

Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
 tools/testing/selftests/syscall_user_dispatch/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/syscall_user_dispatch/Makefile b/tools/testing/selftests/syscall_user_dispatch/Makefile
index 03c120270953..249d9ed30c5c 100644
--- a/tools/testing/selftests/syscall_user_dispatch/Makefile
+++ b/tools/testing/selftests/syscall_user_dispatch/Makefile
@@ -3,7 +3,7 @@ top_srcdir = ../../../..
 INSTALL_HDR_PATH = $(top_srcdir)/usr
 LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/
 
-CFLAGS += -Wall -I$(LINUX_HDR_PATH)
+CFLAGS += -Wall -fno-omit-frame-pointer -I$(LINUX_HDR_PATH)
 
 TEST_GEN_PROGS := sud_test sud_benchmark
 include ../lib.mk
-- 
2.55.0



More information about the Devel mailing list