include/uapi/linux/ptrace.h

Source file repositories/reference/linux-study-clean/include/uapi/linux/ptrace.h

File Facts

System
Linux kernel
Corpus path
include/uapi/linux/ptrace.h
Extension
.h
Size
5633 bytes
Lines
192
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ptrace_peeksiginfo_args {
	__u64 off;	/* from which siginfo to start */
	__u32 flags;
	__s32 nr;	/* how may siginfos to take */
};

#define PTRACE_GETSIGMASK	0x420a
#define PTRACE_SETSIGMASK	0x420b

#define PTRACE_SECCOMP_GET_FILTER	0x420c
#define PTRACE_SECCOMP_GET_METADATA	0x420d

struct seccomp_metadata {
	__u64 filter_off;	/* Input: which filter */
	__u64 flags;		/* Output: filter's flags */
};

#define PTRACE_GET_SYSCALL_INFO		0x420e
#define PTRACE_SET_SYSCALL_INFO		0x4212
#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 {
	__u8 op;	/* PTRACE_SYSCALL_INFO_* */
	__u8 reserved;
	__u16 flags;
	__u32 arch;
	__u64 instruction_pointer;
	__u64 stack_pointer;
	union {
		struct {
			__u64 nr;
			__u64 args[6];
		} entry;
		struct {
			__s64 rval;
			__u8 is_error;
		} exit;
		struct {
			__u64 nr;
			__u64 args[6];
			__u32 ret_data;
			__u32 reserved2;
		} seccomp;
	};
};

#define PTRACE_GET_RSEQ_CONFIGURATION	0x420f

struct ptrace_rseq_configuration {
	__u64 rseq_abi_pointer;
	__u32 rseq_abi_size;
	__u32 signature;
	__u32 flags;
	__u32 pad;
};

#define PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG 0x4210
#define PTRACE_GET_SYSCALL_USER_DISPATCH_CONFIG 0x4211

/*
 * struct ptrace_sud_config - Per-task configuration for Syscall User Dispatch
 * @mode:	One of PR_SYS_DISPATCH_ON or PR_SYS_DISPATCH_OFF
 * @selector:	Tracees user virtual address of SUD selector
 * @offset:	SUD exclusion area (virtual address)
 * @len:	Length of SUD exclusion area
 *
 * Used to get/set the syscall user dispatch configuration for a tracee.
 * Selector is optional (may be NULL), and if invalid will produce
 * a SIGSEGV in the tracee upon first access.
 *
 * If mode is PR_SYS_DISPATCH_ON, syscall dispatch will be enabled. If
 * PR_SYS_DISPATCH_OFF, syscall dispatch will be disabled and all other
 * parameters must be 0.  The value in *selector (if not null), also determines
 * whether syscall dispatch will occur.
 *
 * The Syscall User Dispatch Exclusion area described by offset/len is the
 * virtual address space from which syscalls will not produce a user
 * dispatch.
 */
struct ptrace_sud_config {
	__u64 mode;
	__u64 selector;
	__u64 offset;
	__u64 len;
};

/* 0x4212 is PTRACE_SET_SYSCALL_INFO */

Annotation

Implementation Notes