[Bug libc/33699] New: including sys/wait.h breaks sys/ptrace.h on powerpc

sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de sourceware-bugzilla@sourceware.org
Sun Dec 7 14:48:46 GMT 2025


https://sourceware.org/bugzilla/show_bug.cgi?id=33699

            Bug ID: 33699
           Summary: including sys/wait.h breaks sys/ptrace.h on powerpc
           Product: glibc
           Version: 2.41
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: sourceware-bugzilla at mkarcher dot dialup.fu-berlin.de
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Created attachment 16505
  --> https://sourceware.org/bugzilla/attachment.cgi?id=16505&action=edit
Minimal reproducer for the issue (compile as C++)

glibc defines the enumeration type __ptrace_request for the first parameter of
ptrace. On the other hand, the Linux kernel uses #define preprocessor constants
for the ptrace request codes. It's thus important to not get the kernel
definition which will shadow the glibc definition. But thats what happens on
powerpc if <sys/wait.h> is included after <sys/ptrace.h>. The include chain is

- sys/wait.h (ppc specific)
- includes signal.h (arch independent)
- includes bits/sigcontext.h (ppc specific)
- includes uapi/powerpc/asm/sigcontext.h (kernel header, ppc specific)
- includes uapi/powerpc/asm/ptrace.h (kernel header, ppc specific)

The result is that the attached example program can not be compiled with modern
C++ compilers, because a plain int is passed where an enumerator is expected.
(compiler output trimmed to the relevant part)

user@host:~$ g++ -std=c++20 -c pt.cc
pt.cc: In function ‘int main()’:
pt.cc:6:16: error: invalid conversion from ‘int’ to ‘__ptrace_request’
/usr/include/powerpc64-linux-gnu/bits/ptrace-shared.h:152:47: note:
initializing argument 1 of ‘long int ptrace(__ptrace_request, ...)’
user@host:~$

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list