OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH vz10] selftests: syscall_user_dispatch: keep the frame pointer in sud_benchmark
Date: Wed,  9 Sep 2026 00:32:59 +0300	[thread overview]
Message-ID: <20260908213300.2677462-1-eva.kurchatova@virtuozzo.com> (raw)

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@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

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

             reply	other threads:[~2026-09-08 21:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 21:32 Eva Kurchatova [this message]
2026-09-23 18:59 ` Konstantin Khorenko
2026-09-23 19:23 ` Konstantin Khorenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260908213300.2677462-1-eva.kurchatova@virtuozzo.com \
    --to=eva.kurchatova@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox