Skip to content

Add PTRACE_GET_SYSCALL_INFO #1920

Closed
@maxbla

Description

@maxbla

target triple: unknown-linux-*
docs: https://man7.org/linux/man-pages/man2/ptrace.2.html

PTRACE_GET_SYSCALL_INFO is a linux-specific api (added fairly recently in Linux 5.3) that gives the consumer information about ptrace syscall stops, like if it was syscall entry or exit. Adding support would require a rust definition for the main data structure -

struct ptrace_syscall_info {
    __u8 op;         /* Type of system call stop */
    __u32 arch;      /* AUDIT_ARCH_* value; see seccomp(2) */
    __u64 instruction_pointer; /* CPU instruction pointer */
    __u64 stack_pointer;       /* CPU stack pointer */
    union {
        struct {     /* op == PTRACE_SYSCALL_INFO_ENTRY */
            __u64 nr;          /* System call number */
            __u64 args[6];     /* System call arguments */
        } entry;
        struct {     /* op == PTRACE_SYSCALL_INFO_EXIT */
            __s64 rval;        /* System call return value */
            __u8 is_error;     /* System call error flag;
                                  Boolean: does rval contain
                                  an error value (-ERRCODE) or
                                  a nonerror return value? */
        } exit;
        struct {     /* op == PTRACE_SYSCALL_INFO_SECCOMP */
            __u64 nr;          /* System call number */
            __u64 args[6];     /* System call arguments */
            __u32 ret_data;    /* SECCOMP_RET_DATA portion
                                  of SECCOMP_RET_TRACE
                                  return value */
        } seccomp;
    };
};

in addition to adding the PTRACE_GET_SYSCALL_INFO constant

I could submit a PR for this if it might be merged.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions