€•‰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”Œ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Œ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”…””}”(hhñhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hhîhž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:”…””}”(hhÿhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h Khhîhž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”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1j hŸh¶h Khhîhž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:”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h Khhîhžhubj)”}”(hŒ&echo a > /sys/fs/cgroup/1/devices.deny”h]”hŒ&echo a > /sys/fs/cgroup/1/devices.deny”…””}”hj-sbah}”(h]”h ]”h"]”h$]”h&]”jjuh1j hŸh¶h K hhîhžhubhÉ)”}”(hŒ2will remove the default 'a *:* rwm' entry. Doing::”h]”(hŒwill remove the default ‘a ”…””}”(hj;hžhhŸNh NubhŒemphasis”“”)”}”(hŒ*:*”h]”hŒ:”…””}”(hjEhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jChj;ubhŒ rwm’ entry. Doing:”…””}”(hj;hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h K"hhîhžhubj)”}”(hŒ'echo a > /sys/fs/cgroup/1/devices.allow”h]”hŒ'echo a > /sys/fs/cgroup/1/devices.allow”…””}”hj]sbah}”(h]”h ]”h"]”h$]”h&]”jjuh1j hŸh¶h K$hhîhžhubhÉ)”}”(hŒ0will add the 'a *:* rwm' entry to the whitelist.”h]”(hŒwill add the ‘a ”…””}”(hjkhžhhŸNh NubjD)”}”(hŒ*:*”h]”hŒ:”…””}”(hjshžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jChjkubhŒ rwm’ entry to the whitelist.”…””}”(hjkhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÈhŸh¶h K&hhîhž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”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”jjuh1j 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:”…””}”(hj-hž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”…””}”hj;sbah}”(h]”h ]”h"]”h$]”h&]”jjuh1j 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.”…””}”(hjIhž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:”…””}”(hjWhž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”…””}”hjesbah}”(h]”h ]”h"]”h$]”h&]”jjuh1j hŸh¶h K]hjÖhžhubhÉ)”}”(hŒwhen adding ``c *:3 rwm``::”h]”(hŒ when adding ”…””}”(hjshžhhŸNh NubhŒliteral”“”)”}”(hŒ ``c *:3 rwm``”h]”hŒ c *:3 rwm”…””}”(hj}hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j{hjsubhŒ:”…””}”(hjshž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&]”jjuh1j 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&]”jjuh1j 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&]”jjuh1j 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&]”jjuh1j 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.”…””}”(hjhž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”j_Œ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”}”(j9j6hëhèjjjÓjÐj1j.j)j&uŒ nametypes”}”(j9‰hë‰j‰jÓ‰j1‰j)‰uh}”(j6h£hèh·jhîjÐj“j.jÖ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.