00db10
Note; the test is known to fail on the RHEL 7.7 kernel - the patch
00db10
fixes PT_GETREGS (which we want) but adds PTRACE_SINGLEBLOCK (which we
00db10
don't support yet).  So, the test case was not included.  - DJ
00db10
00db10
commit b08a6a0dea63742313ed3d9577c1e2d83436b196
00db10
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
00db10
Date:   Mon Jun 19 16:27:25 2017 +0200
00db10
00db10
    S390: Sync ptrace.h with kernel. [BZ #21539]
00db10
    
00db10
    This patch removes PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS
00db10
    and PTRACE_SETFPREGS as these requests does not exist on s390 kernel.
00db10
    
00db10
    But the kernel has support for PTRACE_SINGLEBLOCK,
00db10
    PTRACE_SECCOMP_GET_FILTER, PTRACE_PEEKUSR_AREA, PTRACE_POKEUSR_AREA,
00db10
    PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, PTRACE_DISABLE_TE and
00db10
    PTRACE_TE_ABORT_RAND.  Thus those are defined now.
00db10
    
00db10
    The current kernel s390 specific ptrace.h file also defines
00db10
    PTRACE_PEEKTEXT_AREA, PTRACE_PEEKDATA_AREA, PTRACE_POKETEXT_AREA,
00db10
    PTRACE_POKEDATA_AREA, PTRACE_PEEK_SYSTEM_CALL, PTRACE_POKE_SYSTEM_CALL
00db10
    and PTRACE_PROT, but those requests are not supported.
00db10
    Thus those defines are skipped in glibc ptrace.h.
00db10
    
00db10
    There were old includes of ptrace.h in sysdeps/s390/fpu/fesetenv.c.
00db10
    The ptrace feature isn't used there anymore, thus I removed the includes.
00db10
    
00db10
    Before this patch, <glibc>/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
00db10
    uses ptrace-request 12 for PTRACE_GETREGS,
00db10
    but <kernel>/include/uapi/linux/ptrace.h uses 12 for PTRACE_SINGLEBLOCK.
00db10
    
00db10
    The s390 kernel has never had support for PTRACE_GETREGS!
00db10
    Thus glibc ptrace.h is adjusted to match kernel ptrace.h.
00db10
    
00db10
    The new s390 specific test ensures, that PTRACE_SINGLEBLOCK defined
00db10
    in glibc works as expected.  If the kernel would interpret it as
00db10
    PTRACE_GETREGS, then the testcase will not make any progress
00db10
    and will time out.
00db10
    
00db10
    ChangeLog:
00db10
    
00db10
    	[BZ #21539]
00db10
    	* NEWS: Mention s390 ptrace request changes.
00db10
    	* sysdeps/unix/sysv/linux/s390/sys/ptrace.h
00db10
    	(PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS,
00db10
    	PTRACE_SETFPREGS): Remove enum constant.
00db10
    	(PT_GETREGS, PT_SETREGS, PT_GETFPREGS, T_SETFPREGS):
00db10
    	Remove defines.
00db10
    	(PTRACE_SINGLEBLOCK): New enum constant.
00db10
    	(PT_STEPBLOCK): New define.
00db10
    	(PTRACE_PEEKUSR_AREA, PTRACE_POKEUSR_AREA,
00db10
    	PTRACE_GET_LAST_BREAK, PTRACE_ENABLE_TE, PTRACE_DISABLE_TE,
00db10
    	PTRACE_TE_ABORT_RAND): New enum constant and define.
00db10
    	* sysdeps/s390/fpu/fesetenv.c: Remove ptrace.h includes.
00db10
    	* sysdeps/unix/sysv/linux/s390/tst-ptrace-singleblock.c:
00db10
    	New file.
00db10
    	* sysdeps/unix/sysv/linux/s390/Makefile: Add test.
00db10
00db10
diff --git a/sysdeps/s390/fpu/fesetenv.c b/sysdeps/s390/fpu/fesetenv.c
00db10
index 4c9bcf0..0f64a3f 100644
00db10
--- a/sysdeps/s390/fpu/fesetenv.c
00db10
+++ b/sysdeps/s390/fpu/fesetenv.c
00db10
@@ -20,8 +20,6 @@
00db10
 #include <fenv_libc.h>
00db10
 #include <fpu_control.h>
00db10
 #include <stddef.h>
00db10
-#include <asm/ptrace.h>
00db10
-#include <sys/ptrace.h>
00db10
 #include <unistd.h>
00db10
 
00db10
 int
00db10
diff --git a/sysdeps/unix/sysv/linux/s390/sys/ptrace.h b/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
00db10
index 7caf101..88079fc 100644
00db10
--- a/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
00db10
+++ b/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
00db10
@@ -89,25 +89,9 @@ enum __ptrace_request
00db10
   PTRACE_SINGLESTEP = 9,
00db10
 #define PT_STEP PTRACE_SINGLESTEP
00db10
 
00db10
-  /* Get all general purpose registers used by a processes.
00db10
-     This is not supported on all machines.  */
00db10
-   PTRACE_GETREGS = 12,
00db10
-#define PT_GETREGS PTRACE_GETREGS
00db10
-
00db10
-  /* Set all general purpose registers used by a processes.
00db10
-     This is not supported on all machines.  */
00db10
-   PTRACE_SETREGS = 13,
00db10
-#define PT_SETREGS PTRACE_SETREGS
00db10
-
00db10
-  /* Get all floating point registers used by a processes.
00db10
-     This is not supported on all machines.  */
00db10
-   PTRACE_GETFPREGS = 14,
00db10
-#define PT_GETFPREGS PTRACE_GETFPREGS
00db10
-
00db10
-  /* Set all floating point registers used by a processes.
00db10
-     This is not supported on all machines.  */
00db10
-   PTRACE_SETFPREGS = 15,
00db10
-#define PT_SETFPREGS PTRACE_SETFPREGS
00db10
+  /* Execute process until next taken branch.  */
00db10
+  PTRACE_SINGLEBLOCK = 12,
00db10
+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
00db10
 
00db10
   /* Attach to a process that is already running. */
00db10
   PTRACE_ATTACH = 16,
00db10
@@ -167,8 +151,26 @@ enum __ptrace_request
00db10
   PTRACE_SETSIGMASK = 0x420b,
00db10
 #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
00db10
 
00db10
-  PTRACE_SECCOMP_GET_FILTER = 0x420c
00db10
+  PTRACE_SECCOMP_GET_FILTER = 0x420c,
00db10
 #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
00db10
+
00db10
+  PTRACE_PEEKUSR_AREA = 0x5000,
00db10
+#define PTRACE_PEEKUSR_AREA PTRACE_PEEKUSR_AREA
00db10
+
00db10
+  PTRACE_POKEUSR_AREA = 0x5001,
00db10
+#define PTRACE_POKEUSR_AREA PTRACE_POKEUSR_AREA
00db10
+
00db10
+  PTRACE_GET_LAST_BREAK = 0x5006,
00db10
+#define PTRACE_GET_LAST_BREAK PTRACE_GET_LAST_BREAK
00db10
+
00db10
+  PTRACE_ENABLE_TE = 0x5009,
00db10
+#define PTRACE_ENABLE_TE PTRACE_ENABLE_TE
00db10
+
00db10
+  PTRACE_DISABLE_TE = 0x5010,
00db10
+#define PTRACE_DISABLE_TE PTRACE_DISABLE_TE
00db10
+
00db10
+  PTRACE_TE_ABORT_RAND = 0x5011
00db10
+#define PTRACE_TE_ABORT_RAND PTRACE_TE_ABORT_RAND
00db10
 };
00db10
 
00db10