public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Stefan Liebler <stli@linux.vnet.ibm.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] S390: Sync ptrace.h with kernel. [BZ #21539]
Date: Tue, 18 Jul 2017 10:20:00 -0000	[thread overview]
Message-ID: <20170718102039.GA20971@altlinux.org> (raw)
In-Reply-To: <a70194fb-d96c-d22f-7aba-36be9685d421@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 6989 bytes --]

On Mon, Jun 19, 2017 at 03:10:57PM +0200, Stefan Liebler wrote:
[...]
> --- a/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
> +++ b/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
> @@ -89,25 +89,9 @@ enum __ptrace_request
>    PTRACE_SINGLESTEP = 9,
>  #define PT_STEP PTRACE_SINGLESTEP
>  
> -  /* Get all general purpose registers used by a processes.
> -     This is not supported on all machines.  */
> -   PTRACE_GETREGS = 12,
> -#define PT_GETREGS PTRACE_GETREGS
> -
> -  /* Set all general purpose registers used by a processes.
> -     This is not supported on all machines.  */
> -   PTRACE_SETREGS = 13,
> -#define PT_SETREGS PTRACE_SETREGS
> -
> -  /* Get all floating point registers used by a processes.
> -     This is not supported on all machines.  */
> -   PTRACE_GETFPREGS = 14,
> -#define PT_GETFPREGS PTRACE_GETFPREGS
> -
> -  /* Set all floating point registers used by a processes.
> -     This is not supported on all machines.  */
> -   PTRACE_SETFPREGS = 15,
> -#define PT_SETFPREGS PTRACE_SETFPREGS
> +  /* Execute process until next taken branch.  */
> +  PTRACE_SINGLEBLOCK = 12,
> +#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
>  
>    /* Attach to a process that is already running. */
>    PTRACE_ATTACH = 16,
> @@ -167,8 +151,26 @@ enum __ptrace_request
>    PTRACE_SETSIGMASK = 0x420b,
>  #define PTRACE_SETSIGMASK PTRACE_SETSIGMASK
>  
> -  PTRACE_SECCOMP_GET_FILTER = 0x420c
> +  PTRACE_SECCOMP_GET_FILTER = 0x420c,
>  #define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
> +
> +  PTRACE_PEEKUSR_AREA = 0x5000,
> +#define PTRACE_PEEKUSR_AREA PTRACE_PEEKUSR_AREA
> +
> +  PTRACE_POKEUSR_AREA = 0x5001,
> +#define PTRACE_POKEUSR_AREA PTRACE_POKEUSR_AREA
> +
> +  PTRACE_GET_LAST_BREAK = 0x5006,
> +#define PTRACE_GET_LAST_BREAK PTRACE_GET_LAST_BREAK
> +
> +  PTRACE_ENABLE_TE = 0x5009,
> +#define PTRACE_ENABLE_TE PTRACE_ENABLE_TE
> +
> +  PTRACE_DISABLE_TE = 0x5010,
> +#define PTRACE_DISABLE_TE PTRACE_DISABLE_TE
> +
> +  PTRACE_TE_ABORT_RAND = 0x5011
> +#define PTRACE_TE_ABORT_RAND PTRACE_TE_ABORT_RAND
>  };

Mark Wielaard has spotted [1] a regression that I missed during review.
After this change, this test case fails to compile with the following
diagnostics:

$ gcc -c -xc -o/dev/null - <<'EOF'
#include <asm/ptrace.h>
#include <sys/ptrace.h>
EOF
In file included from <stdin>:1:0:
/usr/include/sys/ptrace.h:93:3: error: expected identifier before numeric constant
   PTRACE_SINGLEBLOCK = 12,
   ^
In file included from <stdin>:2:0:
/usr/include/sys/ptrace.h:158:0: warning: "PTRACE_PEEKUSR_AREA" redefined
 #define PTRACE_PEEKUSR_AREA PTRACE_PEEKUSR_AREA
 ^
In file included from <stdin>:1:0:
/usr/include/asm/ptrace.h:392:0: note: this is the location of the previous definition
 #define PTRACE_PEEKUSR_AREA           0x5000
 ^
In file included from <stdin>:2:0:
/usr/include/sys/ptrace.h:161:0: warning: "PTRACE_POKEUSR_AREA" redefined
 #define PTRACE_POKEUSR_AREA PTRACE_POKEUSR_AREA
 ^
In file included from <stdin>:1:0:
/usr/include/asm/ptrace.h:393:0: note: this is the location of the previous definition
 #define PTRACE_POKEUSR_AREA           0x5001
 ^
In file included from <stdin>:2:0:
/usr/include/sys/ptrace.h:164:0: warning: "PTRACE_GET_LAST_BREAK" redefined
 #define PTRACE_GET_LAST_BREAK PTRACE_GET_LAST_BREAK
 ^
In file included from <stdin>:1:0:
/usr/include/asm/ptrace.h:398:0: note: this is the location of the previous definition
 #define PTRACE_GET_LAST_BREAK       0x5006
 ^
In file included from <stdin>:2:0:
/usr/include/sys/ptrace.h:167:0: warning: "PTRACE_ENABLE_TE" redefined
 #define PTRACE_ENABLE_TE PTRACE_ENABLE_TE
 ^
In file included from <stdin>:1:0:
/usr/include/asm/ptrace.h:401:0: note: this is the location of the previous definition
 #define PTRACE_ENABLE_TE       0x5009
 ^
In file included from <stdin>:2:0:
/usr/include/sys/ptrace.h:170:0: warning: "PTRACE_DISABLE_TE" redefined
 #define PTRACE_DISABLE_TE PTRACE_DISABLE_TE
 ^
In file included from <stdin>:1:0:
/usr/include/asm/ptrace.h:402:0: note: this is the location of the previous definition
 #define PTRACE_DISABLE_TE       0x5010
 ^
In file included from <stdin>:2:0:
/usr/include/sys/ptrace.h:173:0: warning: "PTRACE_TE_ABORT_RAND" redefined
 #define PTRACE_TE_ABORT_RAND PTRACE_TE_ABORT_RAND
 ^
In file included from <stdin>:1:0:
/usr/include/asm/ptrace.h:403:0: note: this is the location of the previous definition
 #define PTRACE_TE_ABORT_RAND       0x5011
 ^

The following change fixes this and similar compilation issues that arise
when sys/ptrace.h is included after linux/ptrace.h:

--- a/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
+++ b/sysdeps/unix/sysv/linux/s390/sys/ptrace.h
@@ -24,24 +24,61 @@
 #include <bits/types.h>
 
 __BEGIN_DECLS
-#ifdef _LINUX_PTRACE_H
+#if defined _LINUX_PTRACE_H || defined _S390_PTRACE_H
 /* Kludge to stop stuff gdb & strace compiles from getting upset
  */
 #undef PTRACE_TRACEME
 #undef PTRACE_PEEKTEXT
 #undef PTRACE_PEEKDATA
-#undef PTRACE_PEEKUSR
 #undef PTRACE_POKETEXT
 #undef PTRACE_POKEDATA
-#undef PTRACE_POKEUSR
 #undef PTRACE_CONT
 #undef PTRACE_KILL
 #undef PTRACE_SINGLESTEP
-
+#undef PTRACE_SINGLEBLOCK
 #undef PTRACE_ATTACH
 #undef PTRACE_DETACH
-
 #undef PTRACE_SYSCALL
+#undef PTRACE_SETOPTIONS
+#undef PTRACE_GETEVENTMSG
+#undef PTRACE_GETSIGINFO
+#undef PTRACE_SETSIGINFO
+#undef PTRACE_GETREGSET
+#undef PTRACE_SETREGSET
+#undef PTRACE_SEIZE
+#undef PTRACE_INTERRUPT
+#undef PTRACE_LISTEN
+#undef PTRACE_PEEKSIGINFO
+#undef PTRACE_GETSIGMASK
+#undef PTRACE_SETSIGMASK
+#undef PTRACE_SECCOMP_GET_FILTER
+#undef PTRACE_PEEKUSR_AREA
+#undef PTRACE_POKEUSR_AREA
+#undef PTRACE_GET_LAST_BREAK
+#undef PTRACE_ENABLE_TE
+#undef PTRACE_DISABLE_TE
+#undef PTRACE_TE_ABORT_RAND
+#undef PTRACE_O_TRACESYSGOOD
+#undef PTRACE_O_TRACEFORK
+#undef PTRACE_O_TRACEVFORK
+#undef PTRACE_O_TRACECLONE
+#undef PTRACE_O_TRACEEXEC
+#undef PTRACE_O_TRACEVFORKDONE
+#undef PTRACE_O_TRACEEXIT
+#undef PTRACE_O_TRACESECCOMP
+#undef PTRACE_O_EXITKILL
+#undef PTRACE_O_SUSPEND_SECCOMP
+#undef PTRACE_O_MASK
+#undef PTRACE_EVENT_FORK
+#undef PTRACE_EVENT_VFORK
+#undef PTRACE_EVENT_CLONE
+#undef PTRACE_EVENT_EXEC
+#undef PTRACE_EVENT_VFORK_DONE
+#undef PTRACE_EVENT_EXIT
+#undef PTRACE_EVENT_SECCOMP
+#undef PTRACE_EVENT_STOP
+#undef PTRACE_PEEKSIGINFO_SHARED
+
 #endif
 /* Type of the REQUEST argument to `ptrace.'  */
 enum __ptrace_request

The list was produced by the following command:
$ sed -n '/USER\|DEVEL/d;s/^[[:space:]]*\(PTRACE_[^=[:space:]]\+\)[[:space:]]*=.*/#undef \1/p' sysdeps/unix/sysv/linux/s390/sys/ptrace.h

PTRACE_PEEKUSER and PTRACE_POKEUSER were excluded because they are not
defined by Linux headers, and PTRACE_SEIZE_DEVEL was excluded because
it's obsolete and should be removed from sys/ptrace.h anyway.

[1] https://sourceware.org/ml/elfutils-devel/2017-q3/msg00018.html


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  parent reply	other threads:[~2017-07-18 10:20 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 10:17 Stefan Liebler
2017-06-06 10:44 ` Andreas Schwab
2017-06-06 10:58   ` Dmitry V. Levin
2017-06-06 11:56   ` Stefan Liebler
2017-06-08 12:02     ` Stefan Liebler
2017-06-13 20:05 ` Dmitry V. Levin
2017-06-19 13:11   ` Stefan Liebler
2017-06-19 13:26     ` Dmitry V. Levin
2017-06-19 14:34       ` Stefan Liebler
2017-06-30 10:09     ` Florian Weimer
2017-07-04  8:22       ` Stefan Liebler
2017-07-04  9:41         ` Florian Weimer
2017-07-04 15:37           ` Stefan Liebler
2017-07-07 10:22             ` Stefan Liebler
2017-07-07 10:45               ` Florian Weimer
2017-07-07 13:54                 ` Stefan Liebler
2017-07-11  8:39                   ` Stefan Liebler
2017-07-18 10:20     ` Dmitry V. Levin [this message]
2017-07-18 13:31       ` Carlos O'Donell
2017-07-18 13:39         ` Dmitry V. Levin
2017-07-18 14:11           ` Carlos O'Donell
2017-07-18 14:28             ` Mark Wielaard
2017-07-18 14:40               ` Mark Wielaard
2017-07-20  7:38             ` Stefan Liebler
2017-07-20  8:07               ` Carlos O'Donell
2017-07-20  8:32                 ` Stefan Liebler
2017-07-24  3:51                   ` Dmitry V. Levin
2017-07-24  7:18                     ` Stefan Liebler
2017-07-18 13:41       ` Stefan Liebler
2017-07-18 14:12         ` Carlos O'Donell
2017-07-18 14:16         ` Dmitry V. Levin
2017-07-19  8:40           ` Stefan Liebler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170718102039.GA20971@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=libc-alpha@sourceware.org \
    --cc=stli@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).