€••CŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ,/translations/zh_CN/core-api/protection-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ,/translations/zh_TW/core-api/protection-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ,/translations/it_IT/core-api/protection-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ,/translations/ja_JP/core-api/protection-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ,/translations/ko_KR/core-api/protection-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ,/translations/sp_SP/core-api/protection-keys”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh£sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1h¡hhhžhhŸŒF/var/lib/git/docbuild/linux/Documentation/core-api/protection-keys.rst”h KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒMemory Protection Keys”h]”hŒMemory Protection Keys”…””}”(hh»hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hh¶hžhhŸh³h KubhŒ paragraph”“”)”}”(hŒ¶Memory Protection Keys provide a mechanism for enforcing page-based protections, but without requiring modification of the page tables when an application changes protection domains.”h]”hŒ¶Memory Protection Keys provide a mechanism for enforcing page-based protections, but without requiring modification of the page tables when an application changes protection domains.”…””}”(hhËhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khh¶hžhubhŒdefinition_list”“”)”}”(hhh]”hŒdefinition_list_item”“”)”}”(hŒõPkeys Userspace (PKU) is a feature which can be found on: * Intel server CPUs, Skylake and later * Intel client CPUs, Tiger Lake (11th Gen Core) and later * Future AMD CPUs * arm64 CPUs implementing the Permission Overlay Extension (FEAT_S1POE) ”h]”(hŒterm”“”)”}”(hŒ9Pkeys Userspace (PKU) is a feature which can be found on:”h]”hŒ9Pkeys Userspace (PKU) is a feature which can be found on:”…””}”(hhæhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hähŸh³h KhhàubhŒ definition”“”)”}”(hhh]”hŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ$Intel server CPUs, Skylake and later”h]”hÊ)”}”(hjh]”hŒ$Intel server CPUs, Skylake and later”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hþhhûubhÿ)”}”(hŒ7Intel client CPUs, Tiger Lake (11th Gen Core) and later”h]”hÊ)”}”(hjh]”hŒ7Intel client CPUs, Tiger Lake (11th Gen Core) and later”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hþhhûubhÿ)”}”(hŒFuture AMD CPUs”h]”hÊ)”}”(hj0h]”hŒFuture AMD CPUs”…””}”(hj2hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khj.ubah}”(h]”h ]”h"]”h$]”h&]”uh1hþhhûubhÿ)”}”(hŒFarm64 CPUs implementing the Permission Overlay Extension (FEAT_S1POE) ”h]”hÊ)”}”(hŒEarm64 CPUs implementing the Permission Overlay Extension (FEAT_S1POE)”h]”hŒEarm64 CPUs implementing the Permission Overlay Extension (FEAT_S1POE)”…””}”(hjIhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhjEubah}”(h]”h ]”h"]”h$]”h&]”uh1hþhhûubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ*”uh1hùhŸh³h K hhöubah}”(h]”h ]”h"]”h$]”h&]”uh1hôhhàubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÞhŸh³h KhhÛubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙhh¶hžhhŸNh Nubhµ)”}”(hhh]”(hº)”}”(hŒx86_64”h]”hŒx86_64”…””}”(hjzhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjwhžhhŸh³h KubhÊ)”}”(hŒ|Pkeys work by dedicating 4 previously Reserved bits in each page table entry to a "protection key", giving 16 possible keys.”h]”hŒ€Pkeys work by dedicating 4 previously Reserved bits in each page table entry to a “protection keyâ€, giving 16 possible keys.”…””}”(hjˆhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhjwhžhubhÊ)”}”(hŒÁProtections for each key are defined with a per-CPU user-accessible register (PKRU). Each of these is a 32-bit register storing two bits (Access Disable and Write Disable) for each of 16 keys.”h]”hŒÁProtections for each key are defined with a per-CPU user-accessible register (PKRU). Each of these is a 32-bit register storing two bits (Access Disable and Write Disable) for each of 16 keys.”…””}”(hj–hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhjwhžhubhÊ)”}”(hŒBeing a CPU register, PKRU is inherently thread-local, potentially giving each thread a different set of protections from every other thread.”h]”hŒBeing a CPU register, PKRU is inherently thread-local, potentially giving each thread a different set of protections from every other thread.”…””}”(hj¤hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhjwhžhubhÊ)”}”(hXThere are two instructions (RDPKRU/WRPKRU) for reading and writing to the register. The feature is only available in 64-bit mode, even though there is theoretically space in the PAE PTEs. These permissions are enforced on data access only and have no effect on instruction fetches.”h]”hXThere are two instructions (RDPKRU/WRPKRU) for reading and writing to the register. The feature is only available in 64-bit mode, even though there is theoretically space in the PAE PTEs. These permissions are enforced on data access only and have no effect on instruction fetches.”…””}”(hj²hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khjwhžhubeh}”(h]”Œx86-64”ah ]”h"]”Œx86_64”ah$]”h&]”uh1h´hh¶hžhhŸh³h Kubhµ)”}”(hhh]”(hº)”}”(hŒarm64”h]”hŒarm64”…””}”(hjËhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjÈhžhhŸh³h K#ubhÊ)”}”(hŒfPkeys use 3 bits in each page table entry, to encode a "protection key index", giving 8 possible keys.”h]”hŒjPkeys use 3 bits in each page table entry, to encode a “protection key indexâ€, giving 8 possible keys.”…””}”(hjÙhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K%hjÈhžhubhÊ)”}”(hŒËProtections for each key are defined with a per-CPU user-writable system register (POR_EL0). This is a 64-bit register encoding read, write and execute overlay permissions for each protection key index.”h]”hŒËProtections for each key are defined with a per-CPU user-writable system register (POR_EL0). This is a 64-bit register encoding read, write and execute overlay permissions for each protection key index.”…””}”(hjçhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K(hjÈhžhubhÊ)”}”(hŒBeing a CPU register, POR_EL0 is inherently thread-local, potentially giving each thread a different set of protections from every other thread.”h]”hŒBeing a CPU register, POR_EL0 is inherently thread-local, potentially giving each thread a different set of protections from every other thread.”…””}”(hjõhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K,hjÈhžhubhÊ)”}”(hŒPUnlike x86_64, the protection key permissions also apply to instruction fetches.”h]”hŒPUnlike x86_64, the protection key permissions also apply to instruction fetches.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K/hjÈhžhubeh}”(h]”Œarm64”ah ]”h"]”Œarm64”ah$]”h&]”uh1h´hh¶hžhhŸh³h K#ubhµ)”}”(hhh]”(hº)”}”(hŒSyscalls”h]”hŒSyscalls”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjhžhhŸh³h K3ubhÊ)”}”(hŒ=There are 3 system calls which directly interact with pkeys::”h]”hŒ