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 @@ -432,6 +432,29 @@ bool ksu_is_safe_mode()
432432 return false;
433433}
434434
435+ #if LINUX_VERSION_CODE < KERNEL_VERSION (4 , 14 , 0 )
436+ #include "objsec.h" // task_security_struct
437+ bool is_ksu_transition (const struct task_security_struct * old_tsec ,
438+ const struct task_security_struct * new_tsec )
439+ {
440+ static u32 ksu_sid ;
441+ char * secdata ;
442+ u32 seclen ;
443+ bool allowed = false;
444+
445+ if (!ksu_sid )
446+ security_secctx_to_secid ("u:r:su:s0" , strlen ("u:r:su:s0" ), & ksu_sid );
447+
448+ if (security_secid_to_secctx (old_tsec -> sid , & secdata , & seclen ))
449+ return false;
450+
451+ allowed = (!strcmp ("u:r:init:s0" , secdata ) && new_tsec -> sid == ksu_sid );
452+ security_release_secctx (secdata , seclen );
453+
454+ return allowed ;
455+ }
456+ #endif
457+
435458static void stop_vfs_read_hook ()
436459{
437460 ksu_vfs_read_hook = false;
You can’t perform that action at this time.
0 commit comments