How to Check SELinux Domain of Service / Binary in Android ?

In Android SELinux is the most important thing to be understood in details while working actively for Android development. As we know, all the applications and services / daemons runs within certain SELinux domain in android.

In this post, we will check if there is a daemon , native application , service running in android and to which domain it belongs.

As an examples, we will just check to which SELinux domain the “Top” command belongs to. This can be done as,

First check the absolute path of the binary as,

$ which top
/system/bin/top

Now, we use “ls -Z” command to check the SELinux details, ( “man ln” shows the meaning of “-Z” as print any security context of each file )

$ ls -Z /system/bin/top

u:object_r:system_file:s0 /system/bin/top

As we can see above, we come to know that “top” command belongs to “system_file” domain.

Leave a Comment