+
    ,i  c                   s   a  R t0 t ^ RIHt ^ RIt^RIHt ^RIHt ^RIH	t	 ^RI
Ht Rt] ^ k Rt] ^k R	t] ^k Rt] ^k  ! R R
]	4      tR# )i    )defaultdictN)	policyrep)TERuleQuery)CheckerModule)ConfigSetDescriptorexempt_write_domainexempt_load_domainexempt_fileReadOnlyKernelModulesc                   s(  a a ] tR t^t oRtRt]! ]]]	34      t
]]P                  ,          ! RRRR7      t]]P                  ,          ! RRRR7      t]]P                  ,          ! RRRR7      tV3R lV 3R lltV3R	 lR
 ltV3R lR ltRtVtV ;t# )r   z>Checker module for asserting all kernel modules are read-only.Zro_kmodsZlookup_type_or_attrFT)Zstrictexpandc                sZ   < V ^8  d   QhRS[ P                  RS[RS[S[S[3,          RR/# )   policy	checknameconfigreturnN)r   ZSELinuxPolicystrZdictformat__classdict__   "=/usr/lib64/python3.14/site-packages/setools/checker/rokmod.py__annotate__"ReadOnlyKernelModules.__annotate__$   s9     : :y66 :3 :c3h:,0:    c                s   < \         SV `  WV4       VP                  \        4      V n        VP                  \
        4      V n        VP                  \        4      V n        R # )N)	Zsuper__init__ZgetEXEMPT_WRITEr   EXEMPT_FILEr   EXEMPT_LOADr   )selfr   r   r   	__class__s   &&&&r   r   ZReadOnlyKernelModules.__init__$   sG     	F3#)::l#; !::k2"(**["9r   c                sn   < V ^8  d   QhRS[ S[P                  S[S[P                  ,          3,          /# r
   r   )r    r   TypesetAVRuler   r   r   r   r   ,   s-      k)..#iFVFVBW2W&X r   c                s0   V P                   P                  R 4       V P                   P                  RV P                  : 24       \        V P                  RRRR7      p\
        \        P                  \        \        P                  ,          3,          ! \        4      pVP                  4        F  p\        VP                  P                  4       4      V P                  ,
          p\        VP                  P                  4       4      V P                  ,
          pWT,          pV'       d	   V'       g!   V P                   P                  RV 24       K  V F;  pV P                   P                  RV RV 24       W&,          P                  V4       K=  	  K  	  V# )	z'Collecting list of kernel module types.zself.exempt_load_domain=ZruletypeZtclassZpermsz!Ignoring empty module_load rule: zDetermined z is a kernel module by: Zallow)Zsystem)Zmodule_load)logdebugr   r   r   r    r   r   r    r!   resultssourcer	   targetr   add)r   queryZ	collectedruleZsourcesZtargetsZts   &      r   _collect_kernel_modsZ*ReadOnlyKernelModules._collect_kernel_mods,   s2   @A2$11345DKK%/#."24
  	I4D4D0E EFsK	MMOD$++,,./$2I2IIG$++,,./$2B2BBG G '!B4&IJQC/GvNO   &	  $$ r   c                sD   < V ^8  d   QhRS[ S[P                  ,          /# r   )Zlistr   r   r   r   r   r   r   I   s     ' 'T)..) 'r   c                sx   V P                   P                  R 4       \        V P                  RRRR7      pV P	                  4       p\        \        4      pVP                  4        F  pV P                   P                  RV R24       WAn	        \        VP                  4       4       FV  p\        VP                  P                  4       4      V P                  ,
          '       g   K?  W4,          P                  V4       KX  	  K  	  \        VP                  4       4       F  pV P                   P#                  R4       V P                   P#                  RV R24       V P                   P#                  R4       \        W$,          4       F"  pV P                   P#                  RV R	24       K$  	  V P                   P#                  R
4       \        W4,          4       F  pV P%                  \'        V4      4       K  	  K  	  V P                   P                  \)        V4       R24       \        VP                  4       4      # )z&Checking kernel modules are read-only.r"   zChecking if kernel module type z is writable.z
------------

zKernel module type z is writable.

zModule load rules:
z    * Z
z
Write rules:
z failure(s)r#   )Zfile)writeZappend)r$   Zinfor   r   r,   r    r    Zkeysr%   r(   Zsortedr&   r'   r	   r   r)   Zoutputr-   Zlog_failr   Zlen)r   r*   ZkmodsZfailuresZ	kmod_typer+   s   &     r   runZReadOnlyKernelModules.runI   s   >?DKK%/#,"57 ))+s#IHHNN<YK}UV$Lu}}/t{{))+,t/G/GGG'++D1 0	 &  0IKK23KK 3I;>OPQKK45u/0!!F4&"34 1 KK01x23c$i( 4 1 	#h-45hmmo&&r   )r   r   r   )Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__doc__Z
check_typeZ	frozensetr   r   r   Zcheck_configr   r   r   r   r   r   r   r,   r.   Z__static_attributes__Z__classdictcell__Z__classcell__)r   r   s   @@r   r   r      s     HJlKEFL-inn=eD:%inn5eD:K,Y^^<eD:: : :' ' 'r   c                sz   V ^8  d   Qh/ ^ \         9   d   \        P                  \        ,          ;R&   ^\         9   d   \        P                  \        ,          ;R&   ^\         9   d   \        P                  \        ,          ;R&   ^\         9   d,   \        P                  \        \        R3,          ,          ;R&   # )r
   r   r   r   .__all__)__conditional_annotations__typingZFinalr   Ztuple)r   s   "r   r   r      s}     # # 8 7fll3 7 $ 6 5V\\# 5 $ / .V\\# . $ D CeCHo	& C $r   )r   )r0   Zcollectionsr    r1   Z r   Zterulequeryr   Zcheckermoduler   Zdescriptorsr   r   r   r   r/   r   r   )r0   s   @r   <module>r2      sK    $ #   % ( ,"7 7!5 5!. .)C CQ'M Q'r   