| 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 | // PR_* flags, from <linux/pcrtl.h> for prctl(2). |
| 18 | const ( |
| 19 | // PR_SET_PDEATHSIG sets the process' death signal. |
| 20 | PR_SET_PDEATHSIG = 1 |
| 21 | |
| 22 | // PR_GET_PDEATHSIG gets the process' death signal. |
| 23 | PR_GET_PDEATHSIG = 2 |
| 24 | |
| 25 | // PR_GET_DUMPABLE gets the process' dumpable flag. |
| 26 | PR_GET_DUMPABLE = 3 |
| 27 | |
| 28 | // PR_SET_DUMPABLE sets the process' dumpable flag. |
| 29 | PR_SET_DUMPABLE = 4 |
| 30 | |
| 31 | // PR_GET_KEEPCAPS gets the value of the keep capabilities flag. |
| 32 | PR_GET_KEEPCAPS = 7 |
| 33 | |
| 34 | // PR_SET_KEEPCAPS sets the value of the keep capabilities flag. |
| 35 | PR_SET_KEEPCAPS = 8 |
| 36 | |
| 37 | // PR_GET_TIMING gets the process' timing method. |
| 38 | PR_GET_TIMING = 13 |
| 39 | |
| 40 | // PR_SET_TIMING sets the process' timing method. |
| 41 | PR_SET_TIMING = 14 |
| 42 | |
| 43 | // PR_SET_NAME sets the process' name. |
| 44 | PR_SET_NAME = 15 |
| 45 | |
| 46 | // PR_GET_NAME gets the process' name. |
| 47 | PR_GET_NAME = 16 |
| 48 | |
| 49 | // PR_GET_SECCOMP gets a process' seccomp mode. |
| 50 | PR_GET_SECCOMP = 21 |
| 51 | |
| 52 | // PR_SET_SECCOMP sets a process' seccomp mode. |
| 53 | PR_SET_SECCOMP = 22 |
| 54 | |
| 55 | // PR_CAPBSET_READ gets the capability bounding set. |
| 56 | PR_CAPBSET_READ = 23 |
| 57 | |
| 58 | // PR_CAPBSET_DROP sets the capability bounding set. |
| 59 | PR_CAPBSET_DROP = 24 |
| 60 | |
| 61 | // PR_GET_TSC gets the value of the flag determining whether the |
| 62 | // timestamp counter can be read. |
| 63 | PR_GET_TSC = 25 |
| 64 | |
| 65 | // PR_SET_TSC sets the value of the flag determining whether the |
| 66 | // timestamp counter can be read. |
| 67 | PR_SET_TSC = 26 |
| 68 | |
| 69 | // PR_SET_TIMERSLACK sets the process' time slack. |
| 70 | PR_SET_TIMERSLACK = 29 |
| 71 | |
| 72 | // PR_GET_TIMERSLACK gets the process' time slack. |
| 73 | PR_GET_TIMERSLACK = 30 |
| 74 | |
| 75 | // PR_TASK_PERF_EVENTS_DISABLE disables all performance counters |
| 76 | // attached to the calling process. |
| 77 | PR_TASK_PERF_EVENTS_DISABLE = 31 |
| 78 | |
| 79 | // PR_TASK_PERF_EVENTS_ENABLE enables all performance counters attached |
| 80 | // to the calling process. |
| 81 | PR_TASK_PERF_EVENTS_ENABLE = 32 |
| 82 | |
| 83 | // PR_MCE_KILL sets the machine check memory corruption kill policy for |
| 84 | // the calling thread. |
| 85 | PR_MCE_KILL = 33 |
| 86 | |
| 87 | // PR_MCE_KILL_GET gets the machine check memory corruption kill policy |
| 88 | // for the calling thread. |
| 89 | PR_MCE_KILL_GET = 34 |
| 90 | |
| 91 | // PR_SET_MM modifies certain kernel memory map descriptor fields of |
| 92 | // the calling process. See prctl(2) for more information. |
| 93 | PR_SET_MM = 35 |
| 94 | |
| 95 | PR_SET_MM_START_CODE = 1 |
| 96 | PR_SET_MM_END_CODE = 2 |
| 97 | PR_SET_MM_START_DATA = 3 |
| 98 | PR_SET_MM_END_DATA = 4 |
| 99 | PR_SET_MM_START_STACK = 5 |
| 100 | PR_SET_MM_START_BRK = 6 |
| 101 | PR_SET_MM_BRK = 7 |
| 102 | PR_SET_MM_ARG_START = 8 |
| 103 | PR_SET_MM_ARG_END = 9 |
| 104 | PR_SET_MM_ENV_START = 10 |
| 105 | PR_SET_MM_ENV_END = 11 |
| 106 | PR_SET_MM_AUXV = 12 |
| 107 | // PR_SET_MM_EXE_FILE supersedes the /proc/pid/exe symbolic link with a |
| 108 | // new one pointing to a new executable file identified by the file |
| 109 | // descriptor provided in arg3 argument. See prctl(2) for more |
| 110 | // information. |
| 111 | PR_SET_MM_EXE_FILE = 13 |
| 112 | PR_SET_MM_MAP = 14 |
| 113 | PR_SET_MM_MAP_SIZE = 15 |
| 114 | |
| 115 | // PR_SET_CHILD_SUBREAPER sets the "child subreaper" attribute of the |
| 116 | // calling process. |
| 117 | PR_SET_CHILD_SUBREAPER = 36 |
| 118 | |
| 119 | // PR_GET_CHILD_SUBREAPER gets the "child subreaper" attribute of the |
| 120 | // calling process. |
| 121 | PR_GET_CHILD_SUBREAPER = 37 |
| 122 | |
| 123 | // PR_SET_NO_NEW_PRIVS sets the calling thread's no_new_privs bit. |
| 124 | PR_SET_NO_NEW_PRIVS = 38 |
| 125 | |
| 126 | // PR_GET_NO_NEW_PRIVS gets the calling thread's no_new_privs bit. |
| 127 | PR_GET_NO_NEW_PRIVS = 39 |
| 128 | |
| 129 | // PR_GET_TID_ADDRESS retrieves the clear_child_tid address. |
| 130 | PR_GET_TID_ADDRESS = 40 |
| 131 | |
| 132 | // PR_SET_THP_DISABLE sets the state of the "THP disable" flag for the |
| 133 | // calling thread. |
| 134 | PR_SET_THP_DISABLE = 41 |
| 135 | |
| 136 | // PR_GET_THP_DISABLE gets the state of the "THP disable" flag for the |
| 137 | // calling thread. |
| 138 | PR_GET_THP_DISABLE = 42 |
| 139 | |
| 140 | // PR_MPX_ENABLE_MANAGEMENT enables kernel management of Memory |
| 141 | // Protection eXtensions (MPX) bounds tables. |
| 142 | PR_MPX_ENABLE_MANAGEMENT = 43 |
| 143 | |
| 144 | // PR_MPX_DISABLE_MANAGEMENT disables kernel management of Memory |
| 145 | // Protection eXtensions (MPX) bounds tables. |
| 146 | PR_MPX_DISABLE_MANAGEMENT = 44 |
| 147 | |
| 148 | // PR_SET_PTRACER allows a specific process (or any, if PR_SET_PTRACER_ANY is |
| 149 | // specified) to ptrace the current task. |
| 150 | PR_SET_PTRACER = 0x59616d61 |
| 151 | PR_SET_PTRACER_ANY = -1 |
| 152 | ) |
| 153 | |
| 154 | // From <asm/prctl.h> |
| 155 | // Flags are used in syscall arch_prctl(2). |
| 156 | const ( |
| 157 | ARCH_SET_GS = 0x1001 |
| 158 | ARCH_SET_FS = 0x1002 |
| 159 | ARCH_GET_FS = 0x1003 |
| 160 | ARCH_GET_GS = 0x1004 |
| 161 | ARCH_SET_CPUID = 0x1012 |
| 162 | ) |
| 163 | |
| 164 | // Flags for prctl(PR_SET_DUMPABLE), defined in include/linux/sched/coredump.h. |
| 165 | const ( |
| 166 | SUID_DUMP_DISABLE = 0 |
| 167 | SUID_DUMP_USER = 1 |
| 168 | SUID_DUMP_ROOT = 2 |
| 169 | ) |