linux/include/uapi/linux/prctl.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _LINUX_PRCTL_H
#define _LINUX_PRCTL_H

#include <linux/types.h>

/* Values to pass as first argument to prctl() */

#define PR_SET_PDEATHSIG
#define PR_GET_PDEATHSIG

/* Get/set current->mm->dumpable */
#define PR_GET_DUMPABLE
#define PR_SET_DUMPABLE

/* Get/set unaligned access control bits (if meaningful) */
#define PR_GET_UNALIGN
#define PR_SET_UNALIGN
#define PR_UNALIGN_NOPRINT
#define PR_UNALIGN_SIGBUS

/* Get/set whether or not to drop capabilities on setuid() away from
 * uid 0 (as per security/commoncap.c) */
#define PR_GET_KEEPCAPS
#define PR_SET_KEEPCAPS

/* Get/set floating-point emulation control bits (if meaningful) */
#define PR_GET_FPEMU
#define PR_SET_FPEMU
#define PR_FPEMU_NOPRINT
#define PR_FPEMU_SIGFPE

/* Get/set floating-point exception mode (if meaningful) */
#define PR_GET_FPEXC
#define PR_SET_FPEXC
#define PR_FP_EXC_SW_ENABLE
#define PR_FP_EXC_DIV
#define PR_FP_EXC_OVF
#define PR_FP_EXC_UND
#define PR_FP_EXC_RES
#define PR_FP_EXC_INV
#define PR_FP_EXC_DISABLED
#define PR_FP_EXC_NONRECOV
#define PR_FP_EXC_ASYNC
#define PR_FP_EXC_PRECISE

/* Get/set whether we use statistical process timing or accurate timestamp
 * based process timing */
#define PR_GET_TIMING
#define PR_SET_TIMING
#define PR_TIMING_STATISTICAL
#define PR_TIMING_TIMESTAMP

#define PR_SET_NAME
#define PR_GET_NAME

/* Get/set process endian */
#define PR_GET_ENDIAN
#define PR_SET_ENDIAN
#define PR_ENDIAN_BIG
#define PR_ENDIAN_LITTLE
#define PR_ENDIAN_PPC_LITTLE

/* Get/set process seccomp mode */
#define PR_GET_SECCOMP
#define PR_SET_SECCOMP

/* Get/set the capability bounding set (as per security/commoncap.c) */
#define PR_CAPBSET_READ
#define PR_CAPBSET_DROP

/* Get/set the process' ability to use the timestamp counter instruction */
#define PR_GET_TSC
#define PR_SET_TSC
#define PR_TSC_ENABLE
#define PR_TSC_SIGSEGV

/* Get/set securebits (as per security/commoncap.c) */
#define PR_GET_SECUREBITS
#define PR_SET_SECUREBITS

/*
 * Get/set the timerslack as used by poll/select/nanosleep
 * A value of 0 means "use default"
 */
#define PR_SET_TIMERSLACK
#define PR_GET_TIMERSLACK

#define PR_TASK_PERF_EVENTS_DISABLE
#define PR_TASK_PERF_EVENTS_ENABLE

/*
 * Set early/late kill mode for hwpoison memory corruption.
 * This influences when the process gets killed on a memory corruption.
 */
#define PR_MCE_KILL
#define PR_MCE_KILL_CLEAR
#define PR_MCE_KILL_SET

#define PR_MCE_KILL_LATE
#define PR_MCE_KILL_EARLY
#define PR_MCE_KILL_DEFAULT

#define PR_MCE_KILL_GET

/*
 * Tune up process memory map specifics.
 */
#define PR_SET_MM
#define PR_SET_MM_START_CODE
#define PR_SET_MM_END_CODE
#define PR_SET_MM_START_DATA
#define PR_SET_MM_END_DATA
#define PR_SET_MM_START_STACK
#define PR_SET_MM_START_BRK
#define PR_SET_MM_BRK
#define PR_SET_MM_ARG_START
#define PR_SET_MM_ARG_END
#define PR_SET_MM_ENV_START
#define PR_SET_MM_ENV_END
#define PR_SET_MM_AUXV
#define PR_SET_MM_EXE_FILE
#define PR_SET_MM_MAP
#define PR_SET_MM_MAP_SIZE

/*
 * This structure provides new memory descriptor
 * map which mostly modifies /proc/pid/stat[m]
 * output for a task. This mostly done in a
 * sake of checkpoint/restore functionality.
 */
struct prctl_mm_map {};

/*
 * Set specific pid that is allowed to ptrace the current task.
 * A value of 0 mean "no process".
 */
#define PR_SET_PTRACER
#define PR_SET_PTRACER_ANY

#define PR_SET_CHILD_SUBREAPER
#define PR_GET_CHILD_SUBREAPER

/*
 * If no_new_privs is set, then operations that grant new privileges (i.e.
 * execve) will either fail or not grant them.  This affects suid/sgid,
 * file capabilities, and LSMs.
 *
 * Operations that merely manipulate or drop existing privileges (setresuid,
 * capset, etc.) will still work.  Drop those privileges if you want them gone.
 *
 * Changing LSM security domain is considered a new privilege.  So, for example,
 * asking selinux for a specific new context (e.g. with runcon) will result
 * in execve returning -EPERM.
 *
 * See Documentation/userspace-api/no_new_privs.rst for more details.
 */
#define PR_SET_NO_NEW_PRIVS
#define PR_GET_NO_NEW_PRIVS

#define PR_GET_TID_ADDRESS

#define PR_SET_THP_DISABLE
#define PR_GET_THP_DISABLE

/*
 * No longer implemented, but left here to ensure the numbers stay reserved:
 */
#define PR_MPX_ENABLE_MANAGEMENT
#define PR_MPX_DISABLE_MANAGEMENT

#define PR_SET_FP_MODE
#define PR_GET_FP_MODE
#define PR_FP_MODE_FR
#define PR_FP_MODE_FRE

/* Control the ambient capability set */
#define PR_CAP_AMBIENT
#define PR_CAP_AMBIENT_IS_SET
#define PR_CAP_AMBIENT_RAISE
#define PR_CAP_AMBIENT_LOWER
#define PR_CAP_AMBIENT_CLEAR_ALL

/* arm64 Scalable Vector Extension controls */
/* Flag values must be kept in sync with ptrace NT_ARM_SVE interface */
#define PR_SVE_SET_VL
#define PR_SVE_SET_VL_ONEXEC
#define PR_SVE_GET_VL
/* Bits common to PR_SVE_SET_VL and PR_SVE_GET_VL */
#define PR_SVE_VL_LEN_MASK
#define PR_SVE_VL_INHERIT

/* Per task speculation control */
#define PR_GET_SPECULATION_CTRL
#define PR_SET_SPECULATION_CTRL
/* Speculation control variants */
#define PR_SPEC_STORE_BYPASS
#define PR_SPEC_INDIRECT_BRANCH
#define PR_SPEC_L1D_FLUSH
/* Return and control values for PR_SET/GET_SPECULATION_CTRL */
#define PR_SPEC_NOT_AFFECTED
#define PR_SPEC_PRCTL
#define PR_SPEC_ENABLE
#define PR_SPEC_DISABLE
#define PR_SPEC_FORCE_DISABLE
#define PR_SPEC_DISABLE_NOEXEC

/* Reset arm64 pointer authentication keys */
#define PR_PAC_RESET_KEYS
#define PR_PAC_APIAKEY
#define PR_PAC_APIBKEY
#define PR_PAC_APDAKEY
#define PR_PAC_APDBKEY
#define PR_PAC_APGAKEY

/* Tagged user address controls for arm64 */
#define PR_SET_TAGGED_ADDR_CTRL
#define PR_GET_TAGGED_ADDR_CTRL
#define PR_TAGGED_ADDR_ENABLE
/* MTE tag check fault modes */
#define PR_MTE_TCF_NONE
#define PR_MTE_TCF_SYNC
#define PR_MTE_TCF_ASYNC
#define PR_MTE_TCF_MASK
/* MTE tag inclusion mask */
#define PR_MTE_TAG_SHIFT
#define PR_MTE_TAG_MASK
/* Unused; kept only for source compatibility */
#define PR_MTE_TCF_SHIFT

/* Control reclaim behavior when allocating memory */
#define PR_SET_IO_FLUSHER
#define PR_GET_IO_FLUSHER

/* Dispatch syscalls to a userspace handler */
#define PR_SET_SYSCALL_USER_DISPATCH
#define PR_SYS_DISPATCH_OFF
#define PR_SYS_DISPATCH_ON
/* The control values for the user space selector when dispatch is enabled */
#define SYSCALL_DISPATCH_FILTER_ALLOW
#define SYSCALL_DISPATCH_FILTER_BLOCK

/* Set/get enabled arm64 pointer authentication keys */
#define PR_PAC_SET_ENABLED_KEYS
#define PR_PAC_GET_ENABLED_KEYS

/* Request the scheduler to share a core */
#define PR_SCHED_CORE
#define PR_SCHED_CORE_GET
#define PR_SCHED_CORE_CREATE
#define PR_SCHED_CORE_SHARE_TO
#define PR_SCHED_CORE_SHARE_FROM
#define PR_SCHED_CORE_MAX
#define PR_SCHED_CORE_SCOPE_THREAD
#define PR_SCHED_CORE_SCOPE_THREAD_GROUP
#define PR_SCHED_CORE_SCOPE_PROCESS_GROUP

/* arm64 Scalable Matrix Extension controls */
/* Flag values must be in sync with SVE versions */
#define PR_SME_SET_VL
#define PR_SME_SET_VL_ONEXEC
#define PR_SME_GET_VL
/* Bits common to PR_SME_SET_VL and PR_SME_GET_VL */
#define PR_SME_VL_LEN_MASK
#define PR_SME_VL_INHERIT

/* Memory deny write / execute */
#define PR_SET_MDWE
#define PR_MDWE_REFUSE_EXEC_GAIN
#define PR_MDWE_NO_INHERIT

#define PR_GET_MDWE

#define PR_SET_VMA
#define PR_SET_VMA_ANON_NAME

#define PR_GET_AUXV

#define PR_SET_MEMORY_MERGE
#define PR_GET_MEMORY_MERGE

#define PR_RISCV_V_SET_CONTROL
#define PR_RISCV_V_GET_CONTROL
#define PR_RISCV_V_VSTATE_CTRL_DEFAULT
#define PR_RISCV_V_VSTATE_CTRL_OFF
#define PR_RISCV_V_VSTATE_CTRL_ON
#define PR_RISCV_V_VSTATE_CTRL_INHERIT
#define PR_RISCV_V_VSTATE_CTRL_CUR_MASK
#define PR_RISCV_V_VSTATE_CTRL_NEXT_MASK
#define PR_RISCV_V_VSTATE_CTRL_MASK

#define PR_RISCV_SET_ICACHE_FLUSH_CTX
#define PR_RISCV_CTX_SW_FENCEI_ON
#define PR_RISCV_CTX_SW_FENCEI_OFF
#define PR_RISCV_SCOPE_PER_PROCESS
#define PR_RISCV_SCOPE_PER_THREAD

/* PowerPC Dynamic Execution Control Register (DEXCR) controls */
#define PR_PPC_GET_DEXCR
#define PR_PPC_SET_DEXCR
/* DEXCR aspect to act on */
#define PR_PPC_DEXCR_SBHE
#define PR_PPC_DEXCR_IBRTPD
#define PR_PPC_DEXCR_SRAPD
#define PR_PPC_DEXCR_NPHIE
/* Action to apply / return */
#define PR_PPC_DEXCR_CTRL_EDITABLE
#define PR_PPC_DEXCR_CTRL_SET
#define PR_PPC_DEXCR_CTRL_CLEAR
#define PR_PPC_DEXCR_CTRL_SET_ONEXEC
#define PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC
#define PR_PPC_DEXCR_CTRL_MASK

#endif /* _LINUX_PRCTL_H */