arrfab / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh1457479-3.patch

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