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 | { |
Dmitry V. Levin | b8eec60 | 2016-05-16 22:19:31 +0000 | [diff] [blame] | 76 | const unsigned int option = tcp->u_arg[0]; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 77 | unsigned int i; |
| 78 | |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 79 | if (entering(tcp)) |
Dmitry V. Levin | b8eec60 | 2016-05-16 22:19:31 +0000 | [diff] [blame] | 80 | printxval(prctl_options, option, "PR_???"); |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 81 | |
Dmitry V. Levin | b8eec60 | 2016-05-16 22:19:31 +0000 | [diff] [blame] | 82 | switch (option) { |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 83 | case PR_GET_DUMPABLE: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 84 | case PR_GET_KEEPCAPS: |
| 85 | case PR_GET_SECCOMP: |
| 86 | case PR_GET_TIMERSLACK: |
| 87 | case PR_GET_TIMING: |
Dmitry V. Levin | 1b28330 | 2015-12-06 15:29:04 +0000 | [diff] [blame] | 88 | return RVAL_DECODED; |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 89 | |
| 90 | case PR_GET_CHILD_SUBREAPER: |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 91 | case PR_GET_ENDIAN: |
| 92 | case PR_GET_FPEMU: |
| 93 | case PR_GET_FPEXC: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 94 | if (entering(tcp)) |
| 95 | tprints(", "); |
| 96 | else |
| 97 | printnum_int(tcp, tcp->u_arg[1], "%u"); |
| 98 | break; |
| 99 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 100 | case PR_GET_NAME: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 101 | if (entering(tcp)) |
| 102 | tprints(", "); |
| 103 | else { |
| 104 | if (syserror(tcp)) |
| 105 | printaddr(tcp->u_arg[1]); |
| 106 | else |
| 107 | printstr(tcp, tcp->u_arg[1], -1); |
| 108 | } |
| 109 | break; |
| 110 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 111 | case PR_GET_PDEATHSIG: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 112 | if (entering(tcp)) |
| 113 | tprints(", "); |
| 114 | else if (!umove_or_printaddr(tcp, tcp->u_arg[1], &i)) { |
| 115 | tprints("["); |
| 116 | tprints(signame(i)); |
| 117 | tprints("]"); |
| 118 | } |
| 119 | break; |
| 120 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 121 | case PR_GET_SECUREBITS: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 122 | if (entering(tcp)) |
| 123 | break; |
| 124 | if (syserror(tcp) || tcp->u_rval == 0) |
| 125 | return 0; |
Dmitry V. Levin | 6274ecc | 2016-05-15 14:23:06 +0000 | [diff] [blame] | 126 | tcp->auxstr = sprintflags("", secbits, |
| 127 | (unsigned long) tcp->u_rval); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 128 | return RVAL_STR; |
| 129 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 130 | case PR_GET_TID_ADDRESS: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 131 | if (entering(tcp)) |
| 132 | tprints(", "); |
| 133 | else |
Dmitry V. Levin | 2479ef0 | 2015-08-18 14:58:27 +0000 | [diff] [blame] | 134 | printnum_ptr(tcp, tcp->u_arg[1]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 135 | break; |
| 136 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 137 | case PR_GET_TSC: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 138 | if (entering(tcp)) |
| 139 | tprints(", "); |
| 140 | else if (!umove_or_printaddr(tcp, tcp->u_arg[1], &i)) { |
| 141 | tprints("["); |
| 142 | printxval(pr_tsc, i, "PR_TSC_???"); |
| 143 | tprints("]"); |
| 144 | } |
| 145 | break; |
| 146 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 147 | case PR_GET_UNALIGN: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 148 | if (entering(tcp)) |
| 149 | tprints(", "); |
| 150 | else if (!umove_or_printaddr(tcp, tcp->u_arg[1], &i)) { |
| 151 | tprints("["); |
| 152 | printflags(pr_unalign_flags, i, "PR_UNALIGN_???"); |
| 153 | tprints("]"); |
| 154 | } |
| 155 | break; |
| 156 | |
| 157 | /* PR_TASK_PERF_EVENTS_* take no arguments. */ |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 158 | case PR_TASK_PERF_EVENTS_DISABLE: |
| 159 | case PR_TASK_PERF_EVENTS_ENABLE: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 160 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 161 | |
| 162 | case PR_SET_CHILD_SUBREAPER: |
| 163 | case PR_SET_DUMPABLE: |
| 164 | case PR_SET_ENDIAN: |
| 165 | case PR_SET_FPEMU: |
| 166 | case PR_SET_FPEXC: |
| 167 | case PR_SET_KEEPCAPS: |
| 168 | case PR_SET_TIMING: |
| 169 | tprintf(", %lu", tcp->u_arg[1]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 170 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 171 | |
| 172 | case PR_CAPBSET_DROP: |
Dmitry V. Levin | 1b28330 | 2015-12-06 15:29:04 +0000 | [diff] [blame] | 173 | case PR_CAPBSET_READ: |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 174 | tprints(", "); |
Dmitry V. Levin | c5f6863 | 2016-05-16 23:22:11 +0000 | [diff] [blame] | 175 | printxval_long(cap, tcp->u_arg[1], "CAP_???"); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 176 | return RVAL_DECODED; |
| 177 | |
Dmitry V. Levin | eb76c4b | 2015-12-06 15:33:53 +0000 | [diff] [blame] | 178 | case PR_CAP_AMBIENT: |
| 179 | tprints(", "); |
Dmitry V. Levin | c5f6863 | 2016-05-16 23:22:11 +0000 | [diff] [blame] | 180 | printxval_long(pr_cap_ambient, tcp->u_arg[1], |
| 181 | "PR_CAP_AMBIENT_???"); |
Dmitry V. Levin | eb76c4b | 2015-12-06 15:33:53 +0000 | [diff] [blame] | 182 | switch (tcp->u_arg[1]) { |
| 183 | case PR_CAP_AMBIENT_RAISE: |
| 184 | case PR_CAP_AMBIENT_LOWER: |
| 185 | case PR_CAP_AMBIENT_IS_SET: |
| 186 | tprints(", "); |
Dmitry V. Levin | c5f6863 | 2016-05-16 23:22:11 +0000 | [diff] [blame] | 187 | printxval_long(cap, tcp->u_arg[2], "CAP_???"); |
Dmitry V. Levin | eb76c4b | 2015-12-06 15:33:53 +0000 | [diff] [blame] | 188 | print_prctl_args(tcp, 3); |
| 189 | break; |
| 190 | default: |
| 191 | print_prctl_args(tcp, 2); |
| 192 | break; |
| 193 | } |
| 194 | return RVAL_DECODED; |
| 195 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 196 | case PR_MCE_KILL: |
| 197 | tprints(", "); |
Dmitry V. Levin | c5f6863 | 2016-05-16 23:22:11 +0000 | [diff] [blame] | 198 | printxval_long(pr_mce_kill, tcp->u_arg[1], "PR_MCE_KILL_???"); |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 199 | tprints(", "); |
| 200 | if (PR_MCE_KILL_SET == tcp->u_arg[1]) |
Dmitry V. Levin | c5f6863 | 2016-05-16 23:22:11 +0000 | [diff] [blame] | 201 | printxval_long(pr_mce_kill_policy, tcp->u_arg[2], |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 202 | "PR_MCE_KILL_???"); |
| 203 | else |
| 204 | tprintf("%#lx", tcp->u_arg[2]); |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 205 | print_prctl_args(tcp, 3); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 206 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 207 | |
| 208 | case PR_SET_NAME: |
| 209 | tprints(", "); |
| 210 | printstr(tcp, tcp->u_arg[1], TASK_COMM_LEN); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 211 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 212 | |
Elliott Hughes | 1d246ce | 2015-07-29 22:49:38 +0000 | [diff] [blame] | 213 | #ifdef __ANDROID__ |
Elliott Hughes | 1d246ce | 2015-07-29 22:49:38 +0000 | [diff] [blame] | 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) { |
Elliott Hughes | 612368b | 2016-04-06 14:41:36 -0700 | [diff] [blame] | 219 | tprintf(", PR_SET_VMA_ANON_NAME, %#lx", tcp->u_arg[2]); |
Elliott Hughes | 1d246ce | 2015-07-29 22:49:38 +0000 | [diff] [blame] | 220 | tprintf(", %lu, ", tcp->u_arg[3]); |
| 221 | printstr(tcp, tcp->u_arg[4], -1); |
| 222 | } else { |
| 223 | /* There are no other sub-options now, but there |
| 224 | * might be in future... */ |
| 225 | print_prctl_args(tcp, 1); |
| 226 | } |
| 227 | return RVAL_DECODED; |
| 228 | #endif |
| 229 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 230 | case PR_SET_MM: |
| 231 | tprints(", "); |
| 232 | printxval(pr_set_mm, tcp->u_arg[1], "PR_SET_MM_???"); |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 233 | print_prctl_args(tcp, 2); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 234 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 235 | |
| 236 | case PR_SET_PDEATHSIG: |
| 237 | tprints(", "); |
| 238 | if ((unsigned long) tcp->u_arg[1] > 128) |
| 239 | tprintf("%lu", tcp->u_arg[1]); |
| 240 | else |
| 241 | tprints(signame(tcp->u_arg[1])); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 242 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 243 | |
| 244 | case PR_SET_PTRACER: |
| 245 | tprints(", "); |
| 246 | if (tcp->u_arg[1] == -1) |
| 247 | tprints("PR_SET_PTRACER_ANY"); |
| 248 | else |
| 249 | tprintf("%lu", tcp->u_arg[1]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 250 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 251 | |
| 252 | case PR_SET_SECCOMP: |
| 253 | tprints(", "); |
Dmitry V. Levin | c5f6863 | 2016-05-16 23:22:11 +0000 | [diff] [blame] | 254 | printxval_long(seccomp_mode, tcp->u_arg[1], |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 255 | "SECCOMP_MODE_???"); |
| 256 | if (SECCOMP_MODE_STRICT == tcp->u_arg[1]) |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 257 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 258 | if (SECCOMP_MODE_FILTER == tcp->u_arg[1]) { |
| 259 | tprints(", "); |
| 260 | print_seccomp_filter(tcp, tcp->u_arg[2]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 261 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 262 | } |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 263 | print_prctl_args(tcp, 2); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 264 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 265 | |
| 266 | case PR_SET_SECUREBITS: |
| 267 | tprints(", "); |
Dmitry V. Levin | c5f6863 | 2016-05-16 23:22:11 +0000 | [diff] [blame] | 268 | printflags_long(secbits, tcp->u_arg[1], "SECBIT_???"); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 269 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 270 | |
| 271 | case PR_SET_TIMERSLACK: |
| 272 | tprintf(", %ld", tcp->u_arg[1]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 273 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 274 | |
| 275 | case PR_SET_TSC: |
| 276 | tprints(", "); |
| 277 | printxval(pr_tsc, tcp->u_arg[1], "PR_TSC_???"); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 278 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 279 | |
| 280 | case PR_SET_UNALIGN: |
| 281 | tprints(", "); |
| 282 | printflags(pr_unalign_flags, tcp->u_arg[1], "PR_UNALIGN_???"); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 283 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 284 | |
| 285 | case PR_SET_NO_NEW_PRIVS: |
| 286 | case PR_SET_THP_DISABLE: |
| 287 | tprintf(", %lu", tcp->u_arg[1]); |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 288 | print_prctl_args(tcp, 2); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 289 | return RVAL_DECODED; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 290 | |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 291 | case PR_MCE_KILL_GET: |
Dmitry V. Levin | 3691562 | 2015-07-25 09:43:01 +0000 | [diff] [blame] | 292 | if (entering(tcp)) { |
| 293 | print_prctl_args(tcp, 1); |
| 294 | return 0; |
| 295 | } |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 296 | if (syserror(tcp)) |
| 297 | return 0; |
Dmitry V. Levin | 9134aab | 2016-05-14 21:46:05 +0000 | [diff] [blame] | 298 | tcp->auxstr = xlookup(pr_mce_kill_policy, |
| 299 | (unsigned long) tcp->u_rval); |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 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 | b8eec60 | 2016-05-16 22:19:31 +0000 | [diff] [blame] | 319 | const unsigned int option = tcp->u_arg[0]; |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 320 | |
Dmitry V. Levin | b8eec60 | 2016-05-16 22:19:31 +0000 | [diff] [blame] | 321 | if (entering(tcp)) |
| 322 | printxval(archvals, option, "ARCH_???"); |
| 323 | |
| 324 | switch (option) { |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 325 | case ARCH_GET_GS: |
| 326 | case ARCH_GET_FS: |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 327 | if (entering(tcp)) |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 328 | tprints(", "); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 329 | else |
Dmitry V. Levin | 2479ef0 | 2015-08-18 14:58:27 +0000 | [diff] [blame] | 330 | printnum_ptr(tcp, tcp->u_arg[1]); |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 331 | return 0; |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 332 | } |
Dmitry V. Levin | 1e88073 | 2015-02-14 01:51:03 +0000 | [diff] [blame] | 333 | |
| 334 | tprintf(", %#lx", tcp->u_arg[1]); |
Dmitry V. Levin | 210a6b6 | 2015-07-17 21:49:17 +0000 | [diff] [blame] | 335 | return RVAL_DECODED; |
Dmitry V. Levin | 53c993d | 2014-12-11 19:25:02 +0000 | [diff] [blame] | 336 | } |
| 337 | #endif /* X86_64 || X32 */ |