Fix CTS tests for RNG devices.

SELinux-based Mandatory Access Control (MAC) is now specifying access
rules for /dev/random, /dev/random and /dev/hw_random. As a result,
CTS tests that rely solely on Discretionary Access Control (DAC)
(e.g., based on stat) are out of date. In particular, the test that
invoked stat on /dev/hw_random and inspected the file's mode is
breaking because stat is denied by SELinux rules
(see https://android-review.googlesource.com/#/c/67014/).

The fix is to test for access by actually opening the above RNG device
files. DAC/stat-based checks have been left in place to augment the
tests until detailed SELinux-based tests are in place.

Bug: 17259230
Change-Id: I161bd7bc8056c53e5162279af1ce91ea23504075
1 file changed