File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -476,6 +476,29 @@ bool ksu_is_safe_mode()
476476 return false;
477477}
478478
479+ #if LINUX_VERSION_CODE < KERNEL_VERSION (4 , 14 , 0 )
480+ #include "objsec.h" // task_security_struct
481+ bool is_ksu_transition (const struct task_security_struct * old_tsec ,
482+ const struct task_security_struct * new_tsec )
483+ {
484+ static u32 ksu_sid ;
485+ char * secdata ;
486+ u32 seclen ;
487+ bool allowed = false;
488+
489+ if (!ksu_sid )
490+ security_secctx_to_secid ("u:r:su:s0" , strlen ("u:r:su:s0" ), & ksu_sid );
491+
492+ if (security_secid_to_secctx (old_tsec -> sid , & secdata , & seclen ))
493+ return false;
494+
495+ allowed = (!strcmp ("u:r:init:s0" , secdata ) && new_tsec -> sid == ksu_sid );
496+ security_release_secctx (secdata , seclen );
497+
498+ return allowed ;
499+ }
500+ #endif
501+
479502static void stop_vfs_read_hook ()
480503{
481504 ksu_vfs_read_hook = false;
You can’t perform that action at this time.
0 commit comments