Search code examples
embedded-linuxandroid-sourceselinuxandroid-kernellibselinux

Why SELinux policy in /sepolicy and /sys/fs/selinux/policy do not match?


I'm using Android SELinux enforced device and doing the following:

adb pull /sepolicy sepolicy1
adb pull /sys/fs/selinux/policy sepolicy2
diff sepolicy1 sepolicy2

I get:

Binary files sepolicy1 and sepolicy2 differ

From examining with a hex viewer it seems similar in few parts but mostly different.

Why its different? What does that mean?


Solution

  • try to use sediff (SELinux policy difference tool) to compare the policy files. diff is unable to directly compare the files due to non-semantic differences in the two policy images (e.g. ordering issues).