All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pengfei Xu <pengfei.xu@intel.com>
To: ltp@lists.linux.it
Cc: chang.seok.bae@intel.com, eric.devolder@oracle.com,
	Heng Su <heng.su@intel.com>
Subject: [LTP] [PATCH v3 0/2] Fix ptrace07 hardcoded xstate size issue
Date: Tue, 18 Oct 2022 20:10:45 +0800	[thread overview]
Message-ID: <cover.1666094709.git.pengfei.xu@intel.com> (raw)

Should not use a hardcoded xstate size(512 * 8 = 4096 bytes), and use maximum
XSAVE size specified by CPUID.(EAX=0DH, ECX=0H):EBX instead.
If the CPU's maximum XSAVE size exceeds the hard-coded xstate size 4096 bytes,
it will cause the ptrace07 case to break as below:
"
./ptrace07
tst_test.c:1528: TINFO: Timeout per run is 0h 00m 30s
ptrace07.c:142: TBROK: PTRACE_SETREGSET failed with unexpected error: EFAULT (14)
tst_test.c:1571: TINFO: Killed the leftover descendant processes

Summary:
passed   0
failed   0
broken   1
skipped  0
warnings 0
"

And there is no proper cpuid() function in LTP, so provides the cpuid()
function first in previous commit.

=========
v2 -> v3:
 - Thanks Richard Palethorpe's report, should not use old API cpuid function
   in LTP, and provide the __cpuid_count() function instead
 - Thanks Richard Palethorpe's suggestion, put __cpuid_count() in
   include/lapi/cpuid.h
 - Add the aligned_alloc() successfully check in ptrace07.c
 - Add the cpuid output check prints as Richard Palethorpe's suggestion


Pengfei Xu (2):
  cpuid.h: Provide the macro definition __cpuid_count()
  ptrace07: fix the broken case caused by hardcoded xstate size

 include/lapi/cpuid.h                        | 24 +++++++++++++++++
 testcases/kernel/syscalls/ptrace/ptrace07.c | 29 ++++++++++++++++++---
 2 files changed, 49 insertions(+), 4 deletions(-)
 create mode 100644 include/lapi/cpuid.h

-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2022-10-18 12:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 12:10 Pengfei Xu [this message]
2022-10-18 12:10 ` [LTP] [PATCH v3 1/2] cpuid.h: Provide the macro definition __cpuid_count() Pengfei Xu
2022-10-18 12:10 ` [LTP] [PATCH v3 2/2] ptrace07: fix the broken case caused by hardcoded xstate size Pengfei Xu

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=cover.1666094709.git.pengfei.xu@intel.com \
    --to=pengfei.xu@intel.com \
    --cc=chang.seok.bae@intel.com \
    --cc=eric.devolder@oracle.com \
    --cc=heng.su@intel.com \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.