Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: shuah@kernel.org, luto@kernel.org, dave.hansen@intel.com,
	tglx@linutronix.de, bp@suse.de, jun.miao@windriver.com,
	chang.seok.bae@intel.com
Subject: [PATCH v1 0/4] selftests/x86: Improve signal test code
Date: Sun,  2 Apr 2023 21:43:36 -0700	[thread overview]
Message-ID: <20230403044340.1312-1-chang.seok.bae@intel.com> (raw)

Hi all,

This is a cleanup series to consolidate a common signal setup code.
Right now quite a bit of duplicated code is there in an unorganized
way. Here is a rework of that signal-related code:

(1) Consolidate the signal handler helpers

  They have been exactly copied everywhere. Place them in the shared
  code. Then, remove those duplicates.

(2) Simplify altstack code

  Most cases require just a usable alternate stack. So, there is a
  chance to simplify them all. Abstract the entire setup code to one
  setup call. Then, it can reduce the amount of code there.

  For testing sigaltstack() specifically, another helper is provided
  that excludes the syscall part.

The series also includes some preparatory changes for them:

* Along with the rework, some existing problem was uncovered. A couple
  of tests look to free the altstack memory even before the signal
  delivery. Adjust the memory cleanup to resolve this issue.

* Also resolve a define conflict separately before including the
  refactored header.

Then, there is another selftest fix that I posted:
  https://lore.kernel.org/lkml/20230330233520.21937-1-chang.seok.bae@intel.com/
which has a conflict with this. As the fix should go first, this
cleanup series is based on it.

FWIW, at the moment, the new x86 selftest cases -- lam and
test_shadow_stack do not conflict with this.

Here is the repository where this series can be found:
  git://github.com/intel/amx-linux.git selftest-signal

Thanks,
Chang

Chang S. Bae (4):
  selftests/x86: Fix the altstack free
  selftests/x86/mov_ss_trap: Include processor-flags.h
  selftests/x86: Consolidate signal handler helpers
  selftests/x86: Refactor altstack setup code

 tools/testing/selftests/x86/Makefile          |  16 ++-
 tools/testing/selftests/x86/amx.c             |  67 +++--------
 .../selftests/x86/corrupt_xstate_header.c     |  15 +--
 tools/testing/selftests/x86/entry_from_vm86.c |  25 +---
 tools/testing/selftests/x86/fsgsbase.c        |  25 +---
 tools/testing/selftests/x86/helpers.c         | 110 ++++++++++++++++++
 tools/testing/selftests/x86/helpers.h         |  10 ++
 tools/testing/selftests/x86/ioperm.c          |  26 +----
 tools/testing/selftests/x86/iopl.c            |  26 +----
 tools/testing/selftests/x86/ldt_gdt.c         |  19 +--
 tools/testing/selftests/x86/mov_ss_trap.c     |  26 +----
 tools/testing/selftests/x86/ptrace_syscall.c  |  24 +---
 tools/testing/selftests/x86/sigaltstack.c     |  67 +++--------
 tools/testing/selftests/x86/sigreturn.c       |  35 +-----
 .../selftests/x86/single_step_syscall.c       |  36 +-----
 .../testing/selftests/x86/syscall_arg_fault.c |  24 +---
 tools/testing/selftests/x86/syscall_nt.c      |  13 ---
 tools/testing/selftests/x86/sysret_rip.c      |  24 +---
 tools/testing/selftests/x86/test_vsyscall.c   |  13 ---
 tools/testing/selftests/x86/unwind_vdso.c     |  13 ---
 20 files changed, 205 insertions(+), 409 deletions(-)
 create mode 100644 tools/testing/selftests/x86/helpers.c

-- 
2.17.1


             reply	other threads:[~2023-04-03  4:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03  4:43 Chang S. Bae [this message]
2023-04-03  4:43 ` [PATCH v1 1/4] selftests/x86: Fix the altstack free Chang S. Bae
2023-04-03  4:43 ` [PATCH v1 2/4] selftests/x86/mov_ss_trap: Include processor-flags.h Chang S. Bae
2023-04-03  4:43 ` [PATCH v1 3/4] selftests/x86: Consolidate signal handler helpers Chang S. Bae
2023-04-03  4:43 ` [PATCH v1 4/4] selftests/x86: Refactor altstack setup code Chang S. Bae

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=20230403044340.1312-1-chang.seok.bae@intel.com \
    --to=chang.seok.bae@intel.com \
    --cc=bp@suse.de \
    --cc=dave.hansen@intel.com \
    --cc=jun.miao@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    /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