File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -531,6 +531,32 @@ int ksu_handle_compat_execve_ksud(const char __user *filename_user,
531
531
}
532
532
#endif
533
533
534
+ #if LINUX_VERSION_CODE < KERNEL_VERSION (4 , 14 , 0 )
535
+ #include "objsec.h" // task_security_struct
536
+ bool is_ksu_transition (const struct task_security_struct * old_tsec ,
537
+ const struct task_security_struct * new_tsec )
538
+ {
539
+ static u32 ksu_sid ;
540
+ char * secdata ;
541
+ u32 seclen ;
542
+ bool allowed = false;
543
+
544
+ if (!ksu_execveat_hook ) // not needed anymore once ksud ran
545
+ return false;
546
+
547
+ if (!ksu_sid )
548
+ security_secctx_to_secid ("u:r:su:s0" , strlen ("u:r:su:s0" ), & ksu_sid );
549
+
550
+ if (security_secid_to_secctx (old_tsec -> sid , & secdata , & seclen ))
551
+ return false;
552
+
553
+ allowed = (!strcmp ("u:r:init:s0" , secdata ) && new_tsec -> sid == ksu_sid );
554
+ security_release_secctx (secdata , seclen );
555
+
556
+ return allowed ;
557
+ }
558
+ #endif
559
+
534
560
static void stop_vfs_read_hook ()
535
561
{
536
562
ksu_vfs_read_hook = false;
You can’t perform that action at this time.
0 commit comments