Dmitry V. Levin | 38a34c9 | 2015-12-17 17:56:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1994-1996 Rick Sladkey <jrs@world.std.com> |
| 3 | * Copyright (c) 1996-2000 Wichert Akkerman <wichert@cistron.nl> |
| 4 | * Copyright (c) 2005-2007 Roland McGrath <roland@redhat.com> |
| 5 | * Copyright (c) 2008-2015 Dmitry V. Levin <ldv@altlinux.org> |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions |
| 10 | * are met: |
| 11 | * 1. Redistributions of source code must retain the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer. |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer in the |
| 15 | * documentation and/or other materials provided with the distribution. |
| 16 | * 3. The name of the author may not be used to endorse or promote products |
| 17 | * derived from this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ |
| 30 | |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 31 | #include "defs.h" |
| 32 | |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 33 | #include <sys/prctl.h> |
| 34 | |
| 35 | #include "xlat/prctl_options.h" |
Dmitry V. Levin | eb76c4b | 2015-12-06 15:33:53 +0000 | [diff] [blame] | 36 | #include "xlat/pr_cap_ambient.h" |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 37 | #include "xlat/pr_mce_kill.h" |
| 38 | #include "xlat/pr_mce_kill_policy.h" |
| 39 | #include "xlat/pr_set_mm.h" |
| 40 | #include "xlat/pr_tsc.h" |
Dmitry V. Levin | eb76c4b | 2015-12-06 15:33:53 +0000 | [diff] [blame] | 41 | #include "xlat/pr_unalign_flags.h" |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 42 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 43 | #ifndef TASK_COMM_LEN |
| 44 | # define TASK_COMM_LEN 16 |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 45 | #endif |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 46 | |
Dmitry V. Levin | 2af6903 | 2015-02-04 23:50:50 +0000 | [diff] [blame] | 47 | #ifdef HAVE_LINUX_SECCOMP_H |
| 48 | # include <linux/seccomp.h> |
| 49 | #endif |
Dmitry V. Levin | 2af6903 | 2015-02-04 23:50:50 +0000 | [diff] [blame] | 50 | #include "xlat/seccomp_mode.h" |
| 51 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 52 | #ifdef HAVE_LINUX_SECUREBITS_H |
| 53 | # include <linux/securebits.h> |
| 54 | #endif |
| 55 | #include "xlat/secbits.h" |
| 56 | |
| 57 | /* these constants are the same as in <linux/capability.h> */ |
| 58 | enum { |
| 59 | #include "caps0.h" |
| 60 | #include "caps1.h" |
| 61 | }; |
| 62 | |
| 63 | #include "xlat/cap.h" |
| 64 | |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 65 | static void |
| 66 | print_prctl_args(struct tcb *tcp, const unsigned int first) |
| 67 | { |
| 68 | unsigned int i; |
| 69 | |
| 70 | for (i = first; i < tcp->s_ent->nargs; ++i) |
| 71 | tprintf(", %#lx", tcp->u_arg[i]); |
| 72 | } |
| 73 | |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 74 | SYS_FUNC(prctl) |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 75 | { |
| 76 | unsigned int i; |
| 77 | |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 78 | if (entering(tcp)) |
| 79 | printxval(prctl_options, tcp->u_arg[0], "PR_???"); |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 80 | |
| 81 | switch (tcp->u_arg[0]) { |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 82 | case PR_GET_DUMPABLE: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 83 | case PR_GET_KEEPCAPS: |
| 84 | case PR_GET_SECCOMP: |
| 85 | case PR_GET_TIMERSLACK: |
| 86 | case PR_GET_TIMING: |
Dmitry V. Levin | 1b28330 | 2015-12-06 15:29:04 +0000 | [diff] [blame] | 87 | return RVAL_DECODED; |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 88 | |
| 89 | case PR_GET_CHILD_SUBREAPER: |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 90 | case PR_GET_ENDIAN: |
| 91 | case PR_GET_FPEMU: |
| 92 | case PR_GET_FPEXC: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 93 | if (entering(tcp)) |
| 94 | tprints(", "); |
| 95 | else |
| 96 | printnum_int(tcp, tcp->u_arg[1], "%u"); |
| 97 | break; |
| 98 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 99 | case PR_GET_NAME: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 100 | if (entering(tcp)) |
| 101 | tprints(", "); |
| 102 | else { |
| 103 | if (syserror(tcp)) |
| 104 | printaddr(tcp->u_arg[1]); |
| 105 | else |
| 106 | printstr(tcp, tcp->u_arg[1], -1); |
| 107 | } |
| 108 | break; |
| 109 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 110 | case PR_GET_PDEATHSIG: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 111 | if (entering(tcp)) |
| 112 | tprints(", "); |
| 113 | else if (!umove_or_printaddr(tcp, tcp->u_arg[1], &i)) { |
| 114 | tprints("["); |
| 115 | tprints(signame(i)); |
| 116 | tprints("]"); |
| 117 | } |
| 118 | break; |
| 119 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 120 | case PR_GET_SECUREBITS: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 121 | if (entering(tcp)) |
| 122 | break; |
| 123 | if (syserror(tcp) || tcp->u_rval == 0) |
| 124 | return 0; |
| 125 | tcp->auxstr = sprintflags("", secbits, tcp->u_rval); |
| 126 | return RVAL_STR; |
| 127 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 128 | case PR_GET_TID_ADDRESS: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 129 | if (entering(tcp)) |
| 130 | tprints(", "); |
| 131 | else |
Dmitry V. Levin | 2479ef0 | 2015-08-18 14:58:27 +0000 | [diff] [blame] | 132 | printnum_ptr(tcp, tcp->u_arg[1]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 133 | break; |
| 134 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 135 | case PR_GET_TSC: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 136 | if (entering(tcp)) |
| 137 | tprints(", "); |
| 138 | else if (!umove_or_printaddr(tcp, tcp->u_arg[1], &i)) { |
| 139 | tprints("["); |
| 140 | printxval(pr_tsc, i, "PR_TSC_???"); |
| 141 | tprints("]"); |
| 142 | } |
| 143 | break; |
| 144 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 145 | case PR_GET_UNALIGN: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 146 | if (entering(tcp)) |
| 147 | tprints(", "); |
| 148 | else if (!umove_or_printaddr(tcp, tcp->u_arg[1], &i)) { |
| 149 | tprints("["); |
| 150 | printflags(pr_unalign_flags, i, "PR_UNALIGN_???"); |
| 151 | tprints("]"); |
| 152 | } |
| 153 | break; |
| 154 | |
| 155 | /* PR_TASK_PERF_EVENTS_* take no arguments. */ |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 156 | case PR_TASK_PERF_EVENTS_DISABLE: |
| 157 | case PR_TASK_PERF_EVENTS_ENABLE: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 158 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 159 | |
| 160 | case PR_SET_CHILD_SUBREAPER: |
| 161 | case PR_SET_DUMPABLE: |
| 162 | case PR_SET_ENDIAN: |
| 163 | case PR_SET_FPEMU: |
| 164 | case PR_SET_FPEXC: |
| 165 | case PR_SET_KEEPCAPS: |
| 166 | case PR_SET_TIMING: |
| 167 | tprintf(", %lu", tcp->u_arg[1]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 168 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 169 | |
| 170 | case PR_CAPBSET_DROP: |
Dmitry V. Levin | 1b28330 | 2015-12-06 15:29:04 +0000 | [diff] [blame] | 171 | case PR_CAPBSET_READ: |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 172 | tprints(", "); |
| 173 | printxval(cap, tcp->u_arg[1], "CAP_???"); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 174 | return RVAL_DECODED; |
| 175 | |
Dmitry V. Levin | eb76c4b | 2015-12-06 15:33:53 +0000 | [diff] [blame] | 176 | case PR_CAP_AMBIENT: |
| 177 | tprints(", "); |
| 178 | printxval(pr_cap_ambient, tcp->u_arg[1], "PR_CAP_AMBIENT_???"); |
| 179 | switch (tcp->u_arg[1]) { |
| 180 | case PR_CAP_AMBIENT_RAISE: |
| 181 | case PR_CAP_AMBIENT_LOWER: |
| 182 | case PR_CAP_AMBIENT_IS_SET: |
| 183 | tprints(", "); |
| 184 | printxval(cap, tcp->u_arg[2], "CAP_???"); |
| 185 | print_prctl_args(tcp, 3); |
| 186 | break; |
| 187 | default: |
| 188 | print_prctl_args(tcp, 2); |
| 189 | break; |
| 190 | } |
| 191 | return RVAL_DECODED; |
| 192 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 193 | case PR_MCE_KILL: |
| 194 | tprints(", "); |
| 195 | printxval(pr_mce_kill, tcp->u_arg[1], "PR_MCE_KILL_???"); |
| 196 | tprints(", "); |
| 197 | if (PR_MCE_KILL_SET == tcp->u_arg[1]) |
| 198 | printxval(pr_mce_kill_policy, tcp->u_arg[2], |
| 199 | "PR_MCE_KILL_???"); |
| 200 | else |
| 201 | tprintf("%#lx", tcp->u_arg[2]); |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 202 | print_prctl_args(tcp, 3); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 203 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 204 | |
| 205 | case PR_SET_NAME: |
| 206 | tprints(", "); |
| 207 | printstr(tcp, tcp->u_arg[1], TASK_COMM_LEN); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 208 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 209 | |
Elliott Hughes | 1d246ce | 2015-07-29 22:49:38 +0000 | [diff] [blame] | 210 | #ifdef __ANDROID__ |
| 211 | # ifndef PR_SET_VMA |
| 212 | # define PR_SET_VMA 0x53564d41 |
| 213 | # endif |
| 214 | # ifndef PR_SET_VMA_ANON_NAME |
| 215 | # define PR_SET_VMA_ANON_NAME 0 |
| 216 | # endif |
| 217 | case PR_SET_VMA: |
| 218 | if (tcp->u_arg[1] == PR_SET_VMA_ANON_NAME) { |
| 219 | tprintf(", %lu", tcp->u_arg[1]); |
| 220 | tprintf(", %#lx", tcp->u_arg[2]); |
| 221 | tprintf(", %lu, ", tcp->u_arg[3]); |
| 222 | printstr(tcp, tcp->u_arg[4], -1); |
| 223 | } else { |
| 224 | /* There are no other sub-options now, but there |
| 225 | * might be in future... */ |
| 226 | print_prctl_args(tcp, 1); |
| 227 | } |
| 228 | return RVAL_DECODED; |
| 229 | #endif |
| 230 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 231 | case PR_SET_MM: |
| 232 | tprints(", "); |
| 233 | printxval(pr_set_mm, tcp->u_arg[1], "PR_SET_MM_???"); |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 234 | print_prctl_args(tcp, 2); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 235 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 236 | |
| 237 | case PR_SET_PDEATHSIG: |
| 238 | tprints(", "); |
| 239 | if ((unsigned long) tcp->u_arg[1] > 128) |
| 240 | tprintf("%lu", tcp->u_arg[1]); |
| 241 | else |
| 242 | tprints(signame(tcp->u_arg[1])); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 243 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 244 | |
| 245 | case PR_SET_PTRACER: |
| 246 | tprints(", "); |
| 247 | if (tcp->u_arg[1] == -1) |
| 248 | tprints("PR_SET_PTRACER_ANY"); |
| 249 | else |
| 250 | tprintf("%lu", tcp->u_arg[1]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 251 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 252 | |
| 253 | case PR_SET_SECCOMP: |
| 254 | tprints(", "); |
| 255 | printxval(seccomp_mode, tcp->u_arg[1], |
| 256 | "SECCOMP_MODE_???"); |
| 257 | if (SECCOMP_MODE_STRICT == tcp->u_arg[1]) |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 258 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 259 | if (SECCOMP_MODE_FILTER == tcp->u_arg[1]) { |
| 260 | tprints(", "); |
| 261 | print_seccomp_filter(tcp, tcp->u_arg[2]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 262 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 263 | } |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 264 | print_prctl_args(tcp, 2); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 265 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 266 | |
| 267 | case PR_SET_SECUREBITS: |
| 268 | tprints(", "); |
| 269 | printflags(secbits, tcp->u_arg[1], "SECBIT_???"); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 270 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 271 | |
| 272 | case PR_SET_TIMERSLACK: |
| 273 | tprintf(", %ld", tcp->u_arg[1]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 274 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 275 | |
| 276 | case PR_SET_TSC: |
| 277 | tprints(", "); |
| 278 | printxval(pr_tsc, tcp->u_arg[1], "PR_TSC_???"); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 279 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 280 | |
| 281 | case PR_SET_UNALIGN: |
| 282 | tprints(", "); |
| 283 | printflags(pr_unalign_flags, tcp->u_arg[1], "PR_UNALIGN_???"); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 284 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 285 | |
| 286 | case PR_SET_NO_NEW_PRIVS: |
| 287 | case PR_SET_THP_DISABLE: |
| 288 | tprintf(", %lu", tcp->u_arg[1]); |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 289 | print_prctl_args(tcp, 2); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 290 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 291 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 292 | case PR_MCE_KILL_GET: |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 293 | if (entering(tcp)) { |
| 294 | print_prctl_args(tcp, 1); |
| 295 | return 0; |
| 296 | } |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 297 | if (syserror(tcp)) |
| 298 | return 0; |
| 299 | tcp->auxstr = xlookup(pr_mce_kill_policy, tcp->u_rval); |
| 300 | return tcp->auxstr ? RVAL_STR : RVAL_UDECIMAL; |
| 301 | |
Dmitry V. Levin | 1b28330 | 2015-12-06 15:29:04 +0000 | [diff] [blame] | 302 | case PR_GET_NO_NEW_PRIVS: |
| 303 | case PR_GET_THP_DISABLE: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 304 | case PR_MPX_DISABLE_MANAGEMENT: |
| 305 | case PR_MPX_ENABLE_MANAGEMENT: |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 306 | default: |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 307 | print_prctl_args(tcp, 1); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 308 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 309 | } |
| 310 | return 0; |
| 311 | } |
| 312 | |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 313 | #if defined X86_64 || defined X32 |
| 314 | # include <asm/prctl.h> |
| 315 | # include "xlat/archvals.h" |
| 316 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 317 | SYS_FUNC(arch_prctl) |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 318 | { |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 319 | if (entering(tcp)) |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 320 | printxval(archvals, tcp->u_arg[0], "ARCH_???"); |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 321 | |
| 322 | switch (tcp->u_arg[0]) { |
| 323 | case ARCH_GET_GS: |
| 324 | case ARCH_GET_FS: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 325 | if (entering(tcp)) |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 326 | tprints(", "); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 327 | else |
Dmitry V. Levin | 2479ef0 | 2015-08-18 14:58:27 +0000 | [diff] [blame] | 328 | printnum_ptr(tcp, tcp->u_arg[1]); |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 329 | return 0; |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 330 | } |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 331 | |
| 332 | tprintf(", %#lx", tcp->u_arg[1]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 333 | return RVAL_DECODED; |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 334 | } |
| 335 | #endif /* X86_64 || X32 */ |