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