github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/prctl.txt (about)

     1  # Copyright 2018 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  include <linux/errno.h>
     5  include <linux/pid.h>
     6  include <linux/sched/coredump.h>
     7  include <uapi/linux/prctl.h>
     8  include <uapi/linux/seccomp.h>
     9  include <uapi/linux/capability.h>
    10  include <uapi/linux/securebits.h>
    11  include <asm/prctl.h>
    12  
    13  # Use this variant (which will always return -EINVAL) to explicitly set the 5
    14  # syscall arguments that will enable to properly infer callArgSizes for all
    15  # prctl variants.
    16  
    17  prctl$0(option const[0], arg2 const[0], arg3 const[0], arg4 const[0], arg5 const[0]) (disabled)
    18  
    19  # Only some commands break return values.
    20  # PR_GET_TIMERSLACK and maybe more produce random errno's.
    21  # When/if we have stricter enforcement of arguments for syscall variants, we may remove some of breaks_returns attributes.
    22  prctl$PR_SET_PDEATHSIG(option const[PR_SET_PDEATHSIG], arg signalnoptr) (breaks_returns, ignore_return)
    23  prctl$PR_GET_PDEATHSIG(option const[PR_GET_PDEATHSIG], arg ptr[out, int32]) (breaks_returns, ignore_return)
    24  
    25  prctl$PR_GET_DUMPABLE(option const[PR_GET_DUMPABLE]) (breaks_returns, ignore_return)
    26  prctl$PR_SET_DUMPABLE(option const[PR_SET_DUMPABLE], arg flags[prctl_dump_mode]) (breaks_returns, ignore_return)
    27  
    28  prctl_dump_mode = SUID_DUMP_USER, SUID_DUMP_ROOT
    29  
    30  prctl$PR_GET_UNALIGN(option const[PR_GET_UNALIGN], arg ptr[out, int32]) (breaks_returns, ignore_return)
    31  prctl$PR_SET_UNALIGN(option const[PR_SET_UNALIGN], arg flags[prctl_align_mode]) (breaks_returns, ignore_return)
    32  
    33  prctl_align_mode = PR_UNALIGN_NOPRINT, PR_UNALIGN_SIGBUS
    34  
    35  prctl$PR_GET_KEEPCAPS(option const[PR_GET_KEEPCAPS]) (breaks_returns, ignore_return)
    36  prctl$PR_SET_KEEPCAPS(option const[PR_SET_KEEPCAPS], arg boolptr) (breaks_returns, ignore_return)
    37  
    38  prctl$PR_GET_FPEMU(option const[PR_GET_FPEMU], arg ptr[out, int32]) (breaks_returns, ignore_return)
    39  prctl$PR_SET_FPEMU(option const[PR_SET_FPEMU], arg flags[prctl_fpemu_mode]) (breaks_returns, ignore_return)
    40  
    41  prctl_fpemu_mode = PR_FPEMU_NOPRINT, PR_FPEMU_SIGFPE
    42  
    43  prctl$PR_GET_FPEXC(option const[PR_GET_FPEXC], arg ptr[out, int32]) (breaks_returns, ignore_return)
    44  prctl$PR_SET_FPEXC(option const[PR_SET_FPEXC], arg flags[prctl_fpexc_mode]) (breaks_returns, ignore_return)
    45  
    46  prctl_fpexc_mode = PR_FP_EXC_SW_ENABLE, PR_FP_EXC_DIV, PR_FP_EXC_OVF, PR_FP_EXC_UND, PR_FP_EXC_RES, PR_FP_EXC_INV, PR_FP_EXC_DISABLED, PR_FP_EXC_NONRECOV, PR_FP_EXC_ASYNC, PR_FP_EXC_PRECISE
    47  
    48  # These are not implemented.
    49  _ = PR_GET_TIMING, PR_SET_TIMING
    50  
    51  prctl$PR_SET_NAME(option const[PR_SET_NAME], name ptr[in, string]) (breaks_returns, ignore_return)
    52  prctl$PR_GET_NAME(option const[PR_GET_NAME], name ptr[out, array[int8]]) (breaks_returns, ignore_return)
    53  
    54  prctl$PR_GET_ENDIAN(option const[PR_GET_ENDIAN], arg ptr[out, int32]) (breaks_returns, ignore_return)
    55  prctl$PR_SET_ENDIAN(option const[PR_SET_ENDIAN], arg flags[prctl_endian_mode]) (breaks_returns, ignore_return)
    56  
    57  prctl_endian_mode = PR_ENDIAN_BIG, PR_ENDIAN_LITTLE, PR_ENDIAN_PPC_LITTLE
    58  
    59  prctl$PR_GET_SECCOMP(option const[PR_GET_SECCOMP]) (breaks_returns, ignore_return)
    60  prctl$PR_SET_SECCOMP(option const[PR_SET_SECCOMP], mode flags[prctl_seccomp_mode], prog ptr[in, sock_fprog]) (breaks_returns, ignore_return)
    61  
    62  prctl_seccomp_mode = SECCOMP_MODE_DISABLED, SECCOMP_MODE_STRICT, SECCOMP_MODE_FILTER
    63  
    64  prctl$PR_CAPBSET_READ(option const[PR_CAPBSET_READ], arg intptr[0:CAP_LAST_CAP]) (breaks_returns, ignore_return)
    65  prctl$PR_CAPBSET_DROP(option const[PR_CAPBSET_DROP], arg intptr[0:CAP_LAST_CAP]) (breaks_returns, ignore_return)
    66  
    67  prctl$PR_GET_TSC(option const[PR_GET_TSC], arg ptr[out, int32]) (breaks_returns, ignore_return)
    68  prctl$PR_SET_TSC(option const[PR_SET_TSC], arg flags[prctl_tsc_mode]) (breaks_returns, ignore_return)
    69  
    70  prctl_tsc_mode = PR_TSC_ENABLE, PR_TSC_SIGSEGV
    71  
    72  prctl$PR_GET_SECUREBITS(option const[PR_GET_SECUREBITS]) (breaks_returns, ignore_return)
    73  prctl$PR_SET_SECUREBITS(option const[PR_SET_SECUREBITS], arg flags[prctl_securebits]) (breaks_returns, ignore_return)
    74  
    75  prctl_securebits = SECBIT_NOROOT, SECBIT_NOROOT_LOCKED, SECBIT_NO_SETUID_FIXUP, SECBIT_NO_SETUID_FIXUP_LOCKED, SECBIT_KEEP_CAPS, SECBIT_KEEP_CAPS_LOCKED
    76  
    77  prctl$PR_SET_TIMERSLACK(option const[PR_SET_TIMERSLACK], arg intptr) (breaks_returns, ignore_return)
    78  prctl$PR_GET_TIMERSLACK(option const[PR_GET_TIMERSLACK]) (breaks_returns, ignore_return)
    79  
    80  prctl$PR_TASK_PERF_EVENTS_DISABLE(option const[PR_TASK_PERF_EVENTS_DISABLE]) (breaks_returns, ignore_return)
    81  prctl$PR_TASK_PERF_EVENTS_ENABLE(option const[PR_TASK_PERF_EVENTS_ENABLE]) (breaks_returns, ignore_return)
    82  
    83  prctl$PR_MCE_KILL(option const[PR_MCE_KILL], arg2 flags[prctl_mce_kill_mode], arg3 flags[prctl_mce_kill_submode]) (breaks_returns, ignore_return)
    84  prctl$PR_MCE_KILL_GET(option const[PR_MCE_KILL_GET]) (breaks_returns, ignore_return)
    85  
    86  prctl_mce_kill_mode = PR_MCE_KILL_CLEAR, PR_MCE_KILL_SET
    87  prctl_mce_kill_submode = PR_MCE_KILL_LATE, PR_MCE_KILL_EARLY, PR_MCE_KILL_DEFAULT
    88  
    89  prctl$PR_SET_MM(option const[PR_SET_MM], opt flags[prctl_mm_option], arg vma) (breaks_returns, ignore_return)
    90  prctl$PR_SET_MM_EXE_FILE(option const[PR_SET_MM], opt const[PR_SET_MM_EXE_FILE], arg fd) (breaks_returns, ignore_return)
    91  prctl$PR_SET_MM_AUXV(option const[PR_SET_MM], opt const[PR_SET_MM_AUXV], arg ptr[in, array[int8]], len bytesize[arg]) (breaks_returns, ignore_return)
    92  prctl$PR_SET_MM_MAP(option const[PR_SET_MM], opt const[PR_SET_MM_MAP], arg ptr[in, prctl_mm_map], len bytesize[arg]) (breaks_returns, ignore_return)
    93  prctl$PR_SET_MM_MAP_SIZE(option const[PR_SET_MM], opt const[PR_SET_MM_MAP_SIZE], arg ptr[out, int32]) (breaks_returns, ignore_return)
    94  
    95  prctl_mm_option = PR_SET_MM_START_CODE, PR_SET_MM_END_CODE, PR_SET_MM_START_DATA, PR_SET_MM_END_DATA, PR_SET_MM_START_STACK, PR_SET_MM_START_BRK, PR_SET_MM_BRK, PR_SET_MM_ARG_START, PR_SET_MM_ARG_END, PR_SET_MM_ENV_START, PR_SET_MM_ENV_END
    96  
    97  prctl_mm_map {
    98  	start_code	vma64
    99  	end_code	vma64
   100  	start_data	vma64
   101  	end_data	vma64
   102  	start_brk	vma64
   103  	brk		vma64
   104  	start_stack	vma64
   105  	arg_start	vma64
   106  	arg_end		vma64
   107  	env_start	vma64
   108  	env_end		vma64
   109  	auxv		ptr[in, array[int8]]
   110  	auxv_size	bytesize[auxv, int32]
   111  	exe_fd		fd
   112  }
   113  
   114  prctl$PR_SET_PTRACER(option const[PR_SET_PTRACER], pid pid) (breaks_returns, ignore_return)
   115  
   116  prctl$PR_SET_CHILD_SUBREAPER(option const[PR_SET_CHILD_SUBREAPER], arg boolptr) (breaks_returns, ignore_return)
   117  prctl$PR_GET_CHILD_SUBREAPER(option const[PR_GET_CHILD_SUBREAPER]) (breaks_returns, ignore_return)
   118  
   119  prctl$PR_SET_NO_NEW_PRIVS(option const[PR_SET_NO_NEW_PRIVS], arg const[1]) (breaks_returns, ignore_return)
   120  prctl$PR_GET_NO_NEW_PRIVS(option const[PR_GET_NO_NEW_PRIVS]) (breaks_returns, ignore_return)
   121  
   122  prctl$PR_GET_TID_ADDRESS(option const[PR_GET_TID_ADDRESS], arg ptr[out, intptr]) (breaks_returns, ignore_return)
   123  
   124  prctl$PR_SET_THP_DISABLE(option const[PR_SET_THP_DISABLE], arg boolptr) (breaks_returns, ignore_return)
   125  prctl$PR_GET_THP_DISABLE(option const[PR_GET_THP_DISABLE]) (breaks_returns, ignore_return)
   126  
   127  prctl$PR_MPX_ENABLE_MANAGEMENT(option const[PR_MPX_ENABLE_MANAGEMENT]) (breaks_returns, ignore_return)
   128  prctl$PR_MPX_DISABLE_MANAGEMENT(option const[PR_MPX_DISABLE_MANAGEMENT]) (breaks_returns, ignore_return)
   129  
   130  prctl$PR_SET_FP_MODE(option const[PR_SET_FP_MODE], arg flags[prctl_fp_mode]) (breaks_returns, ignore_return)
   131  prctl$PR_GET_FP_MODE(option const[PR_GET_FP_MODE]) (breaks_returns, ignore_return)
   132  
   133  prctl_fp_mode = PR_FP_MODE_FR, PR_FP_MODE_FRE
   134  
   135  prctl$PR_CAP_AMBIENT(option const[PR_CAP_AMBIENT], arg2 flags[prctl_cap_ambient], arg3 intptr[0:CAP_LAST_CAP]) (breaks_returns, ignore_return)
   136  
   137  prctl_cap_ambient = PR_CAP_AMBIENT_IS_SET, PR_CAP_AMBIENT_RAISE, PR_CAP_AMBIENT_LOWER, PR_CAP_AMBIENT_CLEAR_ALL
   138  
   139  prctl$PR_SVE_SET_VL(option const[PR_SVE_SET_VL], arg intptr[0:PR_SVE_SET_VL_ONEXEC]) (breaks_returns, ignore_return)
   140  prctl$PR_SVE_GET_VL(option const[PR_SVE_GET_VL], arg intptr[0:PR_SVE_VL_INHERIT]) (breaks_returns, ignore_return)
   141  
   142  prctl$PR_GET_SPECULATION_CTRL(option const[PR_GET_SPECULATION_CTRL], arg2 const[PR_SPEC_STORE_BYPASS], arg3 flags[pr_spec_mode]) (breaks_returns, ignore_return)
   143  prctl$PR_SET_SPECULATION_CTRL(option const[PR_SET_SPECULATION_CTRL], arg2 const[PR_SPEC_STORE_BYPASS]) (breaks_returns, ignore_return)
   144  
   145  pr_spec_mode = PR_SPEC_ENABLE, PR_SPEC_DISABLE, PR_SPEC_FORCE_DISABLE
   146  
   147  prctl$PR_PAC_RESET_KEYS(option const[PR_PAC_RESET_KEYS], arg2 flags[prctl_pac_keys]) (breaks_returns, ignore_return)
   148  
   149  prctl_pac_keys = PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY, PR_PAC_APGAKEY
   150  
   151  prctl$PR_SET_TAGGED_ADDR_CTRL(option const[PR_SET_TAGGED_ADDR_CTRL], arg2 flags[prctl_mte_ctl]) (breaks_returns, ignore_return)
   152  prctl$PR_GET_TAGGED_ADDR_CTRL(option const[PR_GET_TAGGED_ADDR_CTRL]) (breaks_returns, ignore_return)
   153  
   154  prctl_mte_ctl = PR_TAGGED_ADDR_ENABLE, PR_MTE_TCF_NONE, PR_MTE_TCF_SYNC, PR_MTE_TCF_ASYNC, PR_MTE_TAG_MASK
   155  
   156  prctl$PR_SET_IO_FLUSHER(option const[PR_SET_IO_FLUSHER], arg2 boolptr) (breaks_returns, ignore_return)
   157  prctl$PR_GET_IO_FLUSHER(option const[PR_GET_IO_FLUSHER]) (breaks_returns, ignore_return)
   158  
   159  prctl$PR_SET_SYSCALL_USER_DISPATCH_OFF(option const[PR_SET_SYSCALL_USER_DISPATCH], mode const[PR_SYS_DISPATCH_OFF]) (breaks_returns, ignore_return)
   160  prctl$PR_SET_SYSCALL_USER_DISPATCH_ON(option const[PR_SET_SYSCALL_USER_DISPATCH], mode const[PR_SYS_DISPATCH_ON], offset intptr, len intptr, selector ptr[in, bool8]) (breaks_returns, ignore_return)
   161  
   162  prctl$PR_SCHED_CORE(option const[PR_SCHED_CORE], cmd intptr[0:PR_SCHED_CORE_MAX], pid pid, type flags[pid_type], uaddr ptr[out, int64, opt]) (breaks_returns, ignore_return)
   163  
   164  pid_type = PIDTYPE_PID, PIDTYPE_TGID, PIDTYPE_PGID, PIDTYPE_SID
   165  
   166  prctl$PR_SET_VMA(option const[PR_SET_VMA], cmd const[PR_SET_VMA_ANON_NAME], addr vma, size bytesize[addr], name ptr[in, string]) (breaks_returns, ignore_return)
   167  
   168  arch_prctl$ARCH_GET_FS(code const[ARCH_GET_FS], arg ptr[out, intptr])
   169  arch_prctl$ARCH_GET_GS(code const[ARCH_GET_GS], arg ptr[out, intptr])
   170  arch_prctl$ARCH_SET_GS(code const[ARCH_SET_GS], arg ptr[out, intptr])
   171  arch_prctl$ARCH_GET_CPUID(code const[ARCH_GET_CPUID])
   172  arch_prctl$ARCH_SET_CPUID(code const[ARCH_SET_CPUID], arg boolptr)
   173  arch_prctl$ARCH_GET_XCOMP_SUPP(code const[ARCH_GET_XCOMP_SUPP], arg ptr[out, int64])
   174  arch_prctl$ARCH_GET_XCOMP_PERM(code const[ARCH_GET_XCOMP_PERM], arg ptr[out, int64])
   175  arch_prctl$ARCH_REQ_XCOMP_PERM(code const[ARCH_REQ_XCOMP_PERM], arg intptr[0:XFEATURE_MAX])
   176  arch_prctl$ARCH_GET_XCOMP_GUEST_PERM(code const[ARCH_GET_XCOMP_GUEST_PERM], arg ptr[out, int64])
   177  arch_prctl$ARCH_REQ_XCOMP_GUEST_PERM(code const[ARCH_REQ_XCOMP_GUEST_PERM], arg intptr[0:XFEATURE_MAX])
   178  arch_prctl$ARCH_MAP_VDSO_X32(code const[ARCH_MAP_VDSO_X32], arg intptr)
   179  arch_prctl$ARCH_MAP_VDSO_32(code const[ARCH_MAP_VDSO_32], arg intptr)
   180  arch_prctl$ARCH_MAP_VDSO_64(code const[ARCH_MAP_VDSO_64], arg intptr)
   181  arch_prctl$ARCH_SHSTK_STATUS(cmd const[ARCH_SHSTK_STATUS], res ptr[out, intptr])
   182  arch_prctl$ARCH_SHSTK_LOCK(cmd const[ARCH_SHSTK_LOCK], features flags[shadow_stack_features])
   183  arch_prctl$ARCH_SHSTK_UNLOCK(cmd const[ARCH_SHSTK_UNLOCK], features flags[shadow_stack_features])
   184  arch_prctl$ARCH_SHSTK_ENABLE(cmd const[ARCH_SHSTK_ENABLE], features flags[shadow_stack_features])
   185  arch_prctl$ARCH_SHSTK_DISABLE(cmd const[ARCH_SHSTK_DISABLE], features flags[shadow_stack_features])
   186  arch_prctl$ARCH_GET_UNTAG_MASK(cmd const[ARCH_GET_UNTAG_MASK], arg ptr[out, intptr])
   187  arch_prctl$ARCH_GET_MAX_TAG_BITS(cmd const[ARCH_GET_MAX_TAG_BITS], arg ptr[out, intptr])
   188  arch_prctl$ARCH_ENABLE_TAGGED_ADDR(cmd const[ARCH_ENABLE_TAGGED_ADDR], arg intptr[1:6])
   189  arch_prctl$ARCH_FORCE_TAGGED_SVA(cmd const[ARCH_FORCE_TAGGED_SVA])
   190  
   191  _ = ARCH_SET_FS
   192  shadow_stack_features = ARCH_SHSTK_SHSTK, ARCH_SHSTK_WRSS