This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/12197] New: ptrace seems to clobber pid argument


http://sourceware.org/bugzilla/show_bug.cgi?id=12197

           Summary: ptrace seems to clobber pid argument
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: eteran@alum.rit.edu


Created attachment 5113
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5113
test case that fails on my machine.

I have encountered some very weird behavior where calling ptrace with
PTRACE_GETEVENTMSG causes the variable passed as the pid to be set to 0 after
the call.

Certainly this is not the expected behavior since the documentation seems to
indicate that the only "out" parameter is the data parameter.

I've created a basic test case that triggers this issue on my system (gentoo
linux x86-64, gcc-4.5.1, glibc-2.11.2-r3, gentoo-sources-2.6.34-r6).

I will attach the test case that I've created. It uses a clone event to give
reason to do a PTRACE_GETEVENTMSG ptrace request. Afterwards, the pid variable
is set to 0 for some reason.

PS: As a side note. I think I understand why ptrace is a variadic function as
this enables variables of different types to be passed. But why is the pid
passed as one of the variadic parameter? That parameter should always be of
type pid_t right? I would have guessed that the prototype could just as easily
be:

long ptrace(enum __ptrace_request request, pid_t pid, ...);

Thanks,
Evan Teran

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]