Add definitions for PTRACE_GET_SYSCALL_INFO API

Provide fallback definitions for PTRACE_GET_SYSCALL_INFO API.
Add very basic PTRACE_GET_SYSCALL_INFO support in the parser
of ptrace syscall.

* ptrace.h: Include <stdint.h>.
[!PTRACE_GET_SYSCALL_INFO] (PTRACE_GET_SYSCALL_INFO,
PTRACE_SYSCALL_INFO_NONE, PTRACE_SYSCALL_INFO_ENTRY,
PTRACE_SYSCALL_INFO_EXIT, PTRACE_SYSCALL_INFO_SECCOMP,
struct ptrace_syscall_info): Define.
* xlat/ptrace_cmds.in: Add PTRACE_GET_SYSCALL_INFO.
* process.c (SYS_FUNC(ptrace)): Handle it.
This commit is contained in:
Дмитрий Левин 2018-11-21 01:44:16 +00:00
parent b93d52fe3d
commit 86d073674e
3 changed files with 32 additions and 0 deletions

View File

@ -111,6 +111,7 @@ SYS_FUNC(ptrace)
case PTRACE_SETSIGMASK:
case PTRACE_SECCOMP_GET_FILTER:
case PTRACE_SECCOMP_GET_METADATA:
case PTRACE_GET_SYSCALL_INFO:
tprintf(", %" PRI_klu, addr);
break;
case PTRACE_PEEKSIGINFO: {

View File

@ -17,6 +17,7 @@
#ifndef STRACE_PTRACE_H
#define STRACE_PTRACE_H
#include <stdint.h>
#include <sys/ptrace.h>
#ifdef HAVE_STRUCT_IA64_FPREG
@ -155,6 +156,35 @@
#ifndef PTRACE_SECCOMP_GET_METADATA
# define PTRACE_SECCOMP_GET_METADATA 0x420d
#endif
#ifndef PTRACE_GET_SYSCALL_INFO
# define PTRACE_GET_SYSCALL_INFO 0x420e
# define PTRACE_SYSCALL_INFO_NONE 0
# define PTRACE_SYSCALL_INFO_ENTRY 1
# define PTRACE_SYSCALL_INFO_EXIT 2
# define PTRACE_SYSCALL_INFO_SECCOMP 3
struct ptrace_syscall_info {
uint8_t op;
uint8_t pad[3];
uint32_t arch;
uint64_t instruction_pointer;
uint64_t stack_pointer;
union {
struct {
uint64_t nr;
uint64_t args[6];
} entry;
struct {
int64_t rval;
uint8_t is_error;
} exit;
struct {
uint64_t nr;
uint64_t args[6];
uint32_t ret_data;
} seccomp;
};
};
#endif
#if !HAVE_DECL_PTRACE_PEEKUSER
# define PTRACE_PEEKUSER PTRACE_PEEKUSR

View File

@ -34,6 +34,7 @@ PTRACE_GETSIGMASK
PTRACE_SETSIGMASK
PTRACE_SECCOMP_GET_FILTER
PTRACE_SECCOMP_GET_METADATA
PTRACE_GET_SYSCALL_INFO
/* arch-specific */
PTRACE_GET_THREAD_AREA
PTRACE_SET_THREAD_AREA