github.com/ttpreport/gvisor-ligolo@v0.0.0-20240123134145-a858404967ba/pkg/abi/linux/ptrace.go (about) 1 // Copyright 2018 The gVisor Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package linux 16 17 // ptrace commands from include/uapi/linux/ptrace.h. 18 const ( 19 PTRACE_TRACEME = 0 20 PTRACE_PEEKTEXT = 1 21 PTRACE_PEEKDATA = 2 22 PTRACE_PEEKUSR = 3 23 PTRACE_POKETEXT = 4 24 PTRACE_POKEDATA = 5 25 PTRACE_POKEUSR = 6 26 PTRACE_CONT = 7 27 PTRACE_KILL = 8 28 PTRACE_SINGLESTEP = 9 29 PTRACE_ATTACH = 16 30 PTRACE_DETACH = 17 31 PTRACE_SYSCALL = 24 32 PTRACE_SETOPTIONS = 0x4200 33 PTRACE_GETEVENTMSG = 0x4201 34 PTRACE_GETSIGINFO = 0x4202 35 PTRACE_SETSIGINFO = 0x4203 36 PTRACE_GETREGSET = 0x4204 37 PTRACE_SETREGSET = 0x4205 38 PTRACE_SEIZE = 0x4206 39 PTRACE_INTERRUPT = 0x4207 40 PTRACE_LISTEN = 0x4208 41 PTRACE_PEEKSIGINFO = 0x4209 42 PTRACE_GETSIGMASK = 0x420a 43 PTRACE_SETSIGMASK = 0x420b 44 PTRACE_SECCOMP_GET_FILTER = 0x420c 45 PTRACE_SECCOMP_GET_METADATA = 0x420d 46 ) 47 48 // ptrace commands from arch/x86/include/uapi/asm/ptrace-abi.h. 49 const ( 50 PTRACE_GETREGS = 12 51 PTRACE_SETREGS = 13 52 PTRACE_GETFPREGS = 14 53 PTRACE_SETFPREGS = 15 54 PTRACE_GETFPXREGS = 18 55 PTRACE_SETFPXREGS = 19 56 PTRACE_OLDSETOPTIONS = 21 57 PTRACE_GET_THREAD_AREA = 25 58 PTRACE_SET_THREAD_AREA = 26 59 PTRACE_ARCH_PRCTL = 30 60 PTRACE_SYSEMU = 31 61 PTRACE_SYSEMU_SINGLESTEP = 32 62 PTRACE_SINGLEBLOCK = 33 63 ) 64 65 // ptrace event codes from include/uapi/linux/ptrace.h. 66 const ( 67 PTRACE_EVENT_FORK = 1 68 PTRACE_EVENT_VFORK = 2 69 PTRACE_EVENT_CLONE = 3 70 PTRACE_EVENT_EXEC = 4 71 PTRACE_EVENT_VFORK_DONE = 5 72 PTRACE_EVENT_EXIT = 6 73 PTRACE_EVENT_SECCOMP = 7 74 PTRACE_EVENT_STOP = 128 75 ) 76 77 // PTRACE_SETOPTIONS options from include/uapi/linux/ptrace.h. 78 const ( 79 PTRACE_O_TRACESYSGOOD = 1 80 PTRACE_O_TRACEFORK = 1 << PTRACE_EVENT_FORK 81 PTRACE_O_TRACEVFORK = 1 << PTRACE_EVENT_VFORK 82 PTRACE_O_TRACECLONE = 1 << PTRACE_EVENT_CLONE 83 PTRACE_O_TRACEEXEC = 1 << PTRACE_EVENT_EXEC 84 PTRACE_O_TRACEVFORKDONE = 1 << PTRACE_EVENT_VFORK_DONE 85 PTRACE_O_TRACEEXIT = 1 << PTRACE_EVENT_EXIT 86 PTRACE_O_TRACESECCOMP = 1 << PTRACE_EVENT_SECCOMP 87 PTRACE_O_EXITKILL = 1 << 20 88 PTRACE_O_SUSPEND_SECCOMP = 1 << 21 89 ) 90 91 // YAMA ptrace_scope levels from security/yama/yama_lsm.c. 92 const ( 93 YAMA_SCOPE_DISABLED = 0 94 YAMA_SCOPE_RELATIONAL = 1 95 )