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