€•‡DŒ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”Œ1/translations/zh_CN/admin-guide/cgroup-v1/devices”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/zh_TW/admin-guide/cgroup-v1/devices”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/it_IT/admin-guide/cgroup-v1/devices”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/ja_JP/admin-guide/cgroup-v1/devices”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/ko_KR/admin-guide/cgroup-v1/devices”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/pt_BR/admin-guide/cgroup-v1/devices”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/sp_SP/admin-guide/cgroup-v1/devices”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒDevice Whitelist Controller”h]”hŒDevice Whitelist Controller”…””}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³ŒK/var/lib/git/docbuild/linux/Documentation/admin-guide/cgroup-v1/devices.rst”h´Kubh¶)”}”(hhh]”(h»)”}”(hŒ1. Description”h]”hŒ1. Description”…””}”(hhÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhhËh²hh³hÊh´KubhŒ paragraph”“”)”}”(hX£Implement a cgroup to track and enforce open and mknod restrictions on device files. A device cgroup associates a device access whitelist with each cgroup. A whitelist entry has 4 fields. 'type' is a (all), c (char), or b (block). 'all' means it applies to all types and all major and minor numbers. Major and minor are either an integer or * for all. Access is a composition of r (read), w (write), and m (mknod).”h]”hX«Implement a cgroup to track and enforce open and mknod restrictions on device files. A device cgroup associates a device access whitelist with each cgroup. A whitelist entry has 4 fields. ‘type’ is a (all), c (char), or b (block). ‘all’ means it applies to all types and all major and minor numbers. Major and minor are either an integer or * for all. Access is a composition of r (read), w (write), and m (mknod).”…””}”(hhÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KhhËh²hubhÝ)”}”(hXThe root device cgroup starts with rwm to 'all'. A child device cgroup gets a copy of the parent. Administrators can then remove devices from the whitelist or add new entries. A child cgroup can never receive a device access which is denied by its parent.”h]”hXThe root device cgroup starts with rwm to ‘all’. A child device cgroup gets a copy of the parent. Administrators can then remove devices from the whitelist or add new entries. A child cgroup can never receive a device access which is denied by its parent.”…””}”(hhìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KhhËh²hubeh}”(h]”Œ description”ah ]”h"]”Œ1. description”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)”}”(hhh]”(h»)”}”(hŒ2. User Interface”h]”hŒ2. User Interface”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjh²hh³hÊh´KubhÝ)”}”(hŒVAn entry is added using devices.allow, and removed using devices.deny. For instance::”h]”hŒUAn entry is added using devices.allow, and removed using devices.deny. For instance:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khjh²hubhŒ literal_block”“”)”}”(hŒ0echo 'c 1:3 mr' > /sys/fs/cgroup/1/devices.allow”h]”hŒ0echo 'c 1:3 mr' > /sys/fs/cgroup/1/devices.allow”…””}”hj#sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1j!h³hÊh´Khjh²hubhÝ)”}”(hŒQallows cgroup 1 to read and mknod the device usually known as /dev/null. Doing::”h]”hŒPallows cgroup 1 to read and mknod the device usually known as /dev/null. Doing:”…””}”(hj3h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khjh²hubj")”}”(hŒ&echo a > /sys/fs/cgroup/1/devices.deny”h]”hŒ&echo a > /sys/fs/cgroup/1/devices.deny”…””}”hjAsbah}”(h]”h ]”h"]”h$]”h&]”j1j2uh1j!h³hÊh´K hjh²hubhÝ)”}”(hŒ2will remove the default 'a *:* rwm' entry. Doing::”h]”(hŒwill remove the default ‘a ”…””}”(hjOh²hh³Nh´NubhŒemphasis”“”)”}”(hŒ*:*”h]”hŒ:”…””}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jWhjOubhŒ rwm’ entry. Doing:”…””}”(hjOh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K"hjh²hubj")”}”(hŒ'echo a > /sys/fs/cgroup/1/devices.allow”h]”hŒ'echo a > /sys/fs/cgroup/1/devices.allow”…””}”hjqsbah}”(h]”h ]”h"]”h$]”h&]”j1j2uh1j!h³hÊh´K$hjh²hubhÝ)”}”(hŒ0will add the 'a *:* rwm' entry to the whitelist.”h]”(hŒwill add the ‘a ”…””}”(hjh²hh³Nh´NubjX)”}”(hŒ*:*”h]”hŒ:”…””}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jWhjubhŒ rwm’ entry to the whitelist.”…””}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K&hjh²hubeh}”(h]”Œuser-interface”ah ]”h"]”Œ2. user interface”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)”}”(hhh]”(h»)”}”(hŒ 3. Security”h]”hŒ 3. Security”…””}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj§h²hh³hÊh´K)ubhÝ)”}”(hX»Any task can move itself between cgroups. This clearly won't suffice, but we can decide the best way to adequately restrict movement as people get some experience with this. We may just want to require CAP_SYS_ADMIN, which at least is a separate bit from CAP_MKNOD. We may want to just refuse moving to a cgroup which isn't a descendant of the current one. Or we may want to use CAP_MAC_ADMIN, since we really are trying to lock down root.”h]”hX¿Any task can move itself between cgroups. This clearly won’t suffice, but we can decide the best way to adequately restrict movement as people get some experience with this. We may just want to require CAP_SYS_ADMIN, which at least is a separate bit from CAP_MKNOD. We may want to just refuse moving to a cgroup which isn’t a descendant of the current one. Or we may want to use CAP_MAC_ADMIN, since we really are trying to lock down root.”…””}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K+hj§h²hubhÝ)”}”(hŒ‚CAP_SYS_ADMIN is needed to modify the whitelist or move another task to a new cgroup. (Again we'll probably want to change that).”h]”hŒ„CAP_SYS_ADMIN is needed to modify the whitelist or move another task to a new cgroup. (Again we’ll probably want to change that).”…””}”(hjÆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K3hj§h²hubhÝ)”}”(hŒJA cgroup may not be granted more permissions than the cgroup's parent has.”h]”hŒLA cgroup may not be granted more permissions than the cgroup’s parent has.”…””}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K6hj§h²hubeh}”(h]”Œsecurity”ah ]”h"]”Œ 3. security”ah$]”h&]”uh1hµhh·h²hh³hÊh´K)ubh¶)”}”(hhh]”(h»)”}”(hŒ 4. Hierarchy”h]”hŒ 4. Hierarchy”…””}”(hjíh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjêh²hh³hÊh´K:ubhÝ)”}”(hX»device cgroups maintain hierarchy by making sure a cgroup never has more access permissions than its parent. Every time an entry is written to a cgroup's devices.deny file, all its children will have that entry removed from their whitelist and all the locally set whitelist entries will be re-evaluated. In case one of the locally set whitelist entries would provide more access than the cgroup's parent, it'll be removed from the whitelist.”h]”hXÁdevice cgroups maintain hierarchy by making sure a cgroup never has more access permissions than its parent. Every time an entry is written to a cgroup’s devices.deny file, all its children will have that entry removed from their whitelist and all the locally set whitelist entries will be re-evaluated. In case one of the locally set whitelist entries would provide more access than the cgroup’s parent, it’ll be removed from the whitelist.”…””}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K A/devices.deny”h]”hŒ## echo "c 116:* r" > A/devices.deny”…””}”hj3sbah}”(h]”h ]”h"]”h$]”h&]”j1j2uh1j!h³hÊh´KOhjêh²hubhÝ)”}”(hŒlit'll propagate down and after revalidating B's entries, the whitelist entry "c 116:2 rwm" will be removed::”h]”hŒsit’ll propagate down and after revalidating B’s entries, the whitelist entry “c 116:2 rwm†will be removed:”…””}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KQhjêh²hubj")”}”(hŒ×group whitelist entries denied devices A all "b 8:* rwm", "c 116:* rw" B "c 1:3 rwm", "b 3:* rwm" all the rest”h]”hŒ×group whitelist entries denied devices A all "b 8:* rwm", "c 116:* rw" B "c 1:3 rwm", "b 3:* rwm" all the rest”…””}”hjOsbah}”(h]”h ]”h"]”h$]”h&]”j1j2uh1j!h³hÊh´KThjêh²hubhÝ)”}”(hŒdIn case parent's exceptions change and local exceptions are not allowed anymore, they'll be deleted.”h]”hŒhIn case parent’s exceptions change and local exceptions are not allowed anymore, they’ll be deleted.”…””}”(hj]h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KXhjêh²hubhÝ)”}”(hŒ:Notice that new whitelist entries will not be propagated::”h]”hŒ9Notice that new whitelist entries will not be propagated:”…””}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K[hjêh²hubj")”}”(hŒÚ A / \ B group whitelist entries denied devices A "c 1:3 rwm", "c 1:5 r" all the rest B "c 1:3 rwm", "c 1:5 r" all the rest”h]”hŒÚ A / \ B group whitelist entries denied devices A "c 1:3 rwm", "c 1:5 r" all the rest B "c 1:3 rwm", "c 1:5 r" all the rest”…””}”hjysbah}”(h]”h ]”h"]”h$]”h&]”j1j2uh1j!h³hÊh´K]hjêh²hubhÝ)”}”(hŒwhen adding ``c *:3 rwm``::”h]”(hŒ when adding ”…””}”(hj‡h²hh³Nh´NubhŒliteral”“”)”}”(hŒ ``c *:3 rwm``”h]”hŒ c *:3 rwm”…””}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‡ubhŒ:”…””}”(hj‡h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kehjêh²hubj")”}”(hŒ## echo "c *:3 rwm" >A/devices.allow”h]”hŒ## echo "c *:3 rwm" >A/devices.allow”…””}”hj©sbah}”(h]”h ]”h"]”h$]”h&]”j1j2uh1j!h³hÊh´Kghjêh²hubhÝ)”}”(hŒ the result::”h]”hŒ the result:”…””}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kihjêh²hubj")”}”(hŒÊgroup whitelist entries denied devices A "c *:3 rwm", "c 1:5 r" all the rest B "c 1:3 rwm", "c 1:5 r" all the rest”h]”hŒÊgroup whitelist entries denied devices A "c *:3 rwm", "c 1:5 r" all the rest B "c 1:3 rwm", "c 1:5 r" all the rest”…””}”hjÅsbah}”(h]”h ]”h"]”h$]”h&]”j1j2uh1j!h³hÊh´Kkhjêh²hubhÝ)”}”(hŒ3but now it'll be possible to add new entries to B::”h]”hŒ4but now it’ll be possible to add new entries to B:”…””}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kohjêh²hubj")”}”(hŒF# echo "c 2:3 rwm" >B/devices.allow # echo "c 50:3 r" >B/devices.allow”h]”hŒF# echo "c 2:3 rwm" >B/devices.allow # echo "c 50:3 r" >B/devices.allow”…””}”hjásbah}”(h]”h ]”h"]”h$]”h&]”j1j2uh1j!h³hÊh´Kqhjêh²hubhÝ)”}”(hŒ or even::”h]”hŒor even:”…””}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kthjêh²hubj")”}”(hŒ## echo "c *:3 rwm" >B/devices.allow”h]”hŒ## echo "c *:3 rwm" >B/devices.allow”…””}”hjýsbah}”(h]”h ]”h"]”h$]”h&]”j1j2uh1j!h³hÊh´Kvhjêh²hubhÝ)”}”(hŒ‚Allowing or denying all by writing 'a' to devices.allow or devices.deny will not be possible once the device cgroups has children.”h]”hŒ†Allowing or denying all by writing ‘a’ to devices.allow or devices.deny will not be possible once the device cgroups has children.”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kxhjêh²hubh¶)”}”(hhh]”(h»)”}”(hŒ'4.1 Hierarchy (internal implementation)”h]”hŒ'4.1 Hierarchy (internal implementation)”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjh²hh³hÊh´K|ubhÝ)”}”(hXÎdevice cgroups is implemented internally using a behavior (ALLOW, DENY) and a list of exceptions. The internal state is controlled using the same user interface to preserve compatibility with the previous whitelist-only implementation. Removal or addition of exceptions that will reduce the access to devices will be propagated down the hierarchy. For every propagated exception, the effective rules will be re-evaluated based on current parent's access rules.”h]”hXÐdevice cgroups is implemented internally using a behavior (ALLOW, DENY) and a list of exceptions. The internal state is controlled using the same user interface to preserve compatibility with the previous whitelist-only implementation. Removal or addition of exceptions that will reduce the access to devices will be propagated down the hierarchy. For every propagated exception, the effective rules will be re-evaluated based on current parent’s access rules.”…””}”(hj*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K~hjh²hubeh}”(h]”Œ!hierarchy-internal-implementation”ah ]”h"]”Œ'4.1 hierarchy (internal implementation)”ah$]”h&]”uh1hµhjêh²hh³hÊh´K|ubeh}”(h]”Œ hierarchy”ah ]”h"]”Œ 4. hierarchy”ah$]”h&]”uh1hµhh·h²hh³hÊh´K:ubeh}”(h]”Œdevice-whitelist-controller”ah ]”h"]”Œdevice whitelist controller”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jsŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jMjJhÿhüj¤j¡jçjäjEjBj=j:uŒ nametypes”}”(jM‰hÿ‰j¤‰jç‰jE‰j=‰uh}”(jJh·hühËj¡jjäj§jBjêj:juŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.