Re: ptrace(PTRACE_SYSCALL) and data field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mike,

(Roland may be able to help out here.)

On Wed, Mar 18, 2009 at 4:46 PM, Mike Frysinger <vapier@xxxxxxxxxx> wrote:
> the ptrace(2) page doesnt say anything about the data field (ignored or
> otherwise).  it seems to be ignored, but i didnt trace the kernel
> exhaustively.  the examples found via google shows that it's ignored.  strace
> usage seems odd (it passes in an irrelevant pointer), which would indicate
> it's ignored as well ...

It's true that this looks like a defect in the man page.  But I'm not
sure what the fix is.

In the kernel source file kernel/ptrace.c, function ptrace_resume() we
have the line

            child->exit_code = data;

which seems to be executed by the PRACE_SYSCALL code path.  That
implies that data is treated as a signal number (like PTRACE_CONT).

That seems consistent with the following in the strace.c source file
of strace(1):


                         if (ptrace(PTRACE_SYSCALL, pid, (char *) 1,
                                   WSTOPSIG(status)) < 0) {
                                perror("trace: ptrace(PTRACE_SYSCALL, ...)");
                                cleanup();
                                return -1;
                        }

Did I misunderstand something?  Your thoughts?

Cheers,

Michael
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux