All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v3 0/2] Fix ptrace07 hardcoded xstate size issue
@ 2022-10-18 12:10 Pengfei Xu
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Pengfei Xu @ 2022-10-18 12:10 UTC (permalink / raw)
  To: ltp; +Cc: chang.seok.bae, eric.devolder, Heng Su

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-18 12:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-18 12:10 [LTP] [PATCH v3 0/2] Fix ptrace07 hardcoded xstate size issue Pengfei Xu
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

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.