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

Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH 09/16] sys/ptrace.h: Import from musl



Hello Costin,

this patch looks good.

Thank you.


Reviewed-by: Charalampos Mainas <charalampos.mainas@xxxxxxxxx>




From: Costin Lupu <costin.lupu@xxxxxxxxx>
Sent: Thursday, August 22, 2019 12:10 PM
To: minios-devel@xxxxxxxxxxxxx
Cc: Felipe Huici; Charalampos Mainas
Subject: [UNIKRAFT/NEWLIB PATCH 09/16] sys/ptrace.h: Import from musl
 
Copied as is from the official musl git mirror
git://git.musl-libc.org/musl, commit 6fcb440d.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 Makefile.uk                             |   1 +
 musl-imported/arch/x86_64/bits/ptrace.h |  13 +++
 musl-imported/include/sys/ptrace.h      | 109 ++++++++++++++++++++++++
 3 files changed, 123 insertions(+)
 create mode 100644 musl-imported/arch/x86_64/bits/ptrace.h
 create mode 100644 musl-imported/include/sys/ptrace.h

diff --git a/Makefile.uk b/Makefile.uk
index 36d8635..75e074a 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -68,6 +68,7 @@ LIBNEWLIB_LIBM = $(LIBNEWLIBC_ORIGIN)/$(LIBNEWLIB_SUBDIR)/newlib/libm
 LIBNEWLIBC_COMMON_INCLUDES-y     += -I$(LIBNEWLIBC_BASE)/include
 LIBNEWLIBC_COMMON_INCLUDES-y     += -I$(LIBNEWLIBC_BASE)/musl-imported/include
 LIBNEWLIBC_COMMON_INCLUDES-y     += -I$(LIBNEWLIBC_BASE)/musl-imported/arch/generic
+LIBNEWLIBC_COMMON_INCLUDES-$(CONFIG_ARCH_X86_64) += -I$(LIBNEWLIBC_BASE)/musl-imported/arch/x86_64
 LIBNEWLIBC_COMMON_INCLUDES-y     += -I$(LIBNEWLIB_LIBC)/include
 
 CINCLUDES-$(CONFIG_LIBNEWLIBC)   += $(LIBNEWLIBC_COMMON_INCLUDES-y)
diff --git a/musl-imported/arch/x86_64/bits/ptrace.h b/musl-imported/arch/x86_64/bits/ptrace.h
new file mode 100644
index 0000000..7f8a09b
--- /dev/null
+++ b/musl-imported/arch/x86_64/bits/ptrace.h
@@ -0,0 +1,13 @@
+#define PTRACE_GET_THREAD_AREA         25
+#define PTRACE_SET_THREAD_AREA         26
+#define PTRACE_ARCH_PRCTL              30
+#define PTRACE_SYSEMU                  31
+#define PTRACE_SYSEMU_SINGLESTEP       32
+#define PTRACE_SINGLEBLOCK             33
+
+#define PT_GET_THREAD_AREA PTRACE_GET_THREAD_AREA
+#define PT_SET_THREAD_AREA PTRACE_SET_THREAD_AREA
+#define PT_ARCH_PRCTL PTRACE_ARCH_PRCTL
+#define PT_SYSEMU PTRACE_SYSEMU
+#define PT_SYSEMU_SINGLESTEP PTRACE_SYSEMU_SINGLESTEP
+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
diff --git a/musl-imported/include/sys/ptrace.h b/musl-imported/include/sys/ptrace.h
new file mode 100644
index 0000000..229e1f3
--- /dev/null
+++ b/musl-imported/include/sys/ptrace.h
@@ -0,0 +1,109 @@
+#ifndef _SYS_PTRACE_H
+#define _SYS_PTRACE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define PTRACE_TRACEME 0
+#define PT_TRACE_ME PTRACE_TRACEME
+
+#define PTRACE_PEEKTEXT 1
+#define PTRACE_PEEKDATA 2
+#define PTRACE_PEEKUSER 3
+#define PTRACE_POKETEXT 4
+#define PTRACE_POKEDATA 5
+#define PTRACE_POKEUSER 6
+#define PTRACE_CONT 7
+#define PTRACE_KILL 8
+#define PTRACE_SINGLESTEP 9
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+#define PTRACE_ATTACH 16
+#define PTRACE_DETACH 17
+#define PTRACE_GETFPXREGS 18
+#define PTRACE_SETFPXREGS 19
+#define PTRACE_SYSCALL 24
+#define PTRACE_SETOPTIONS 0x4200
+#define PTRACE_GETEVENTMSG 0x4201
+#define PTRACE_GETSIGINFO 0x4202
+#define PTRACE_SETSIGINFO 0x4203
+#define PTRACE_GETREGSET 0x4204
+#define PTRACE_SETREGSET 0x4205
+#define PTRACE_SEIZE 0x4206
+#define PTRACE_INTERRUPT 0x4207
+#define PTRACE_LISTEN 0x4208
+#define PTRACE_PEEKSIGINFO 0x4209
+#define PTRACE_GETSIGMASK 0x420a
+#define PTRACE_SETSIGMASK 0x420b
+#define PTRACE_SECCOMP_GET_FILTER 0x420c
+#define PTRACE_SECCOMP_GET_METADATA 0x420d
+
+#define PT_READ_I PTRACE_PEEKTEXT
+#define PT_READ_D PTRACE_PEEKDATA
+#define PT_READ_U PTRACE_PEEKUSER
+#define PT_WRITE_I PTRACE_POKETEXT
+#define PT_WRITE_D PTRACE_POKEDATA
+#define PT_WRITE_U PTRACE_POKEUSER
+#define PT_CONTINUE PTRACE_CONT
+#define PT_KILL PTRACE_KILL
+#define PT_STEP PTRACE_SINGLESTEP
+#define PT_GETREGS PTRACE_GETREGS
+#define PT_SETREGS PTRACE_SETREGS
+#define PT_GETFPREGS PTRACE_GETFPREGS
+#define PT_SETFPREGS PTRACE_SETFPREGS
+#define PT_ATTACH PTRACE_ATTACH
+#define PT_DETACH PTRACE_DETACH
+#define PT_GETFPXREGS PTRACE_GETFPXREGS
+#define PT_SETFPXREGS PTRACE_SETFPXREGS
+#define PT_SYSCALL PTRACE_SYSCALL
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
+
+#define PTRACE_O_TRACESYSGOOD   0x00000001
+#define PTRACE_O_TRACEFORK      0x00000002
+#define PTRACE_O_TRACEVFORK     0x00000004
+#define PTRACE_O_TRACECLONE     0x00000008
+#define PTRACE_O_TRACEEXEC      0x00000010
+#define PTRACE_O_TRACEVFORKDONE 0x00000020
+#define PTRACE_O_TRACEEXIT      0x00000040
+#define PTRACE_O_TRACESECCOMP   0x00000080
+#define PTRACE_O_EXITKILL       0x00100000
+#define PTRACE_O_SUSPEND_SECCOMP 0x00200000
+#define PTRACE_O_MASK           0x003000ff
+
+#define PTRACE_EVENT_FORK 1
+#define PTRACE_EVENT_VFORK 2
+#define PTRACE_EVENT_CLONE 3
+#define PTRACE_EVENT_EXEC 4
+#define PTRACE_EVENT_VFORK_DONE 5
+#define PTRACE_EVENT_EXIT 6
+#define PTRACE_EVENT_SECCOMP 7
+#define PTRACE_EVENT_STOP 128
+
+#define PTRACE_PEEKSIGINFO_SHARED 1
+
+#include <bits/ptrace.h>
+
+struct __ptrace_peeksiginfo_args {
+       uint64_t off;
+       uint32_t flags;
+       int32_t nr;
+};
+
+struct __ptrace_seccomp_metadata {
+       uint64_t filter_off;
+       uint64_t flags;
+};
+
+long ptrace(int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--
2.20.1

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.