{
    "mode": "man",
    "parameter": "proc_pid_attr",
    "section": "5",
    "url": "https://www.chedong.com/phpMan.php/man/proc_pid_attr/5/json",
    "generated": "2026-10-04T09:42:34Z",
    "sections": {
        "NAME": {
            "content": "/proc/pid/attr/ - security-related attributes\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "/proc/pid/attr/\nThe files in this directory provide an API for security modules.  The contents of this\ndirectory  are files that can be read and written in order to set security-related at‐\ntributes.  This directory was added to support SELinux, but the intention was that the\nAPI be general enough to support other security modules.  For the purpose of  explana‐\ntion, examples of how SELinux uses these files are provided below.\n\nThis directory is present only if the kernel was configured with CONFIGSECURITY.\n\n/proc/pid/attr/current (since Linux 2.6.0)\nThe contents of this file represent the current security attributes of the process.\n\nIn  SELinux,  this  file  is  used to get the security context of a process.  Prior to\nLinux 2.6.11, this file could not be used to set the security context (a write was al‐\nways denied), since SELinux limited process security transitions to execve(2) (see the\ndescription of /proc/pid/attr/exec, below).  Since Linux 2.6.11, SELinux  lifted  this\nrestriction  and  began  supporting \"set\" operations via writes to this node if autho‐\nrized by policy, although use of this operation is only suitable for applications that\nare trusted to maintain any desired separation between the old and new  security  con‐\ntexts.\n\nPrior to Linux 2.6.28, SELinux did not allow threads within a multithreaded process to\nset  their security context via this node as it would yield an inconsistency among the\nsecurity contexts of the threads sharing the same memory space.  Since  Linux  2.6.28,\nSELinux  lifted  this  restriction  and  began supporting \"set\" operations for threads\nwithin a multithreaded process if the new security context is bounded by the old secu‐\nrity context, where the bounded relation is defined in policy and guarantees that  the\nnew security context has a subset of the permissions of the old security context.\n\nOther security modules may choose to support \"set\" operations via writes to this node.\n\n/proc/pid/attr/exec (since Linux 2.6.0)\nThis  file  represents  the  attributes to assign to the process upon a subsequent ex‐\necve(2).\n\nIn SELinux, this is needed to support role/domain transitions, and  execve(2)  is  the\npreferred  point  to  make  such transitions because it offers better control over the\ninitialization of the process in the new security label and the inheritance of  state.\nIn  SELinux,  this  attribute is reset on execve(2) so that the new program reverts to\nthe default behavior for any execve(2) calls that it may make.  In SELinux, a  process\ncan set only its own /proc/pid/attr/exec attribute.\n\n/proc/pid/attr/fscreate (since Linux 2.6.0)\nThis  file represents the attributes to assign to files created by subsequent calls to\nopen(2), mkdir(2), symlink(2), and mknod(2)\n\nSELinux employs this file to support creation of a file (using the aforementioned sys‐\ntem calls) in a secure state, so that there is no risk of inappropriate  access  being\nobtained  between  the  time  of  creation  and  the time that attributes are set.  In\nSELinux, this attribute is reset on execve(2), so that the new program reverts to  the\ndefault  behavior for any file creation calls it may make, but the attribute will per‐\nsist across multiple file creation calls within a program unless it is explicitly  re‐\nset.  In SELinux, a process can set only its own /proc/pid/attr/fscreate attribute.\n\n/proc/pid/attr/keycreate (since Linux 2.6.18)\nIf  a  process writes a security context into this file, all subsequently created keys\n(addkey(2)) will be labeled with this context.  For further information, see the ker‐\nnel source  file  Documentation/security/keys/core.rst  (or  file  Documentation/secu‐\nrity/keys.txt between Linux 3.0 and Linux 4.13, or Documentation/keys.txt before Linux\n3.0).\n\n/proc/pid/attr/prev (since Linux 2.6.0)\nThis file contains the security context of the process before the last execve(2); that\nis, the previous value of /proc/pid/attr/current.\n\n/proc/pid/attr/socketcreate (since Linux 2.6.18)\nIf  a process writes a security context into this file, all subsequently created sock‐\nets will be labeled with this context.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "proc(5)\n\nLinux man-pages 6.7                          2023-08-15                             procpidattr(5)",
            "subsections": []
        }
    },
    "summary": "/proc/pid/attr/ - security-related attributes",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "proc",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/proc/5/json"
        }
    ]
}