In the future, you may want to send your question to seli...@vger.kernel.org
instead of this mailing list.

To help debug this, we'll need three pieces of information.

1) The relevant SELinux policy, which can be extracted from the device
using "adb pull /sys/fs/selinux/policy". Please attach it to your reply.

2) The SELinux label of /sys/power/state and all directories leading to
that point. This can be collected with:

  ls -ladZ /sys /sys/power /sys/power/state

3) The SELinux domain for the process attempting the access. This can be
collected by running "ps -A -Z | grep your_process"

As for you not being able to access that file from a service, I suspect
that has nothing to do with SELinux. Standard UNIX permissions limit access
to this file to the system user. See
https://android.googlesource.com/platform/system/core/+/1d0ee36de7af27ee43e5075b99e9427130a1f0f1/rootdir/init.rc#642
lines 642 and 646.

-- Nick

On Tue, Oct 30, 2018 at 7:29 AM Darren Greene <greenedarr...@gmail.com>
wrote:

> Hi,
>
> I am running Android "P" on my development board and getting a "permission
> denied" error. This is only seen when SELinux is in enforcing mode; if I
> switch to permissive things work fine.
>
> libsuspend: error opening /sys/power/state: Permission denied
> libsuspend: autosuspend_init failed
>
> I also get a similar error "Java.io.FileNotFoundException:
> /sys/power/state (Permission denied)" when I try to access /sys/power/state
> from a service. There are no avc denial messages seen in dmesg but
> permissive mode working indicates some access permissions are missing.
>
> Any thoughts on how to go about debugging this or possible reasons for
> this error ?
>
> -Darren
>
> --
> You received this message because you are subscribed to the Google Groups
> "Android Security Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-security-discuss+unsubscr...@googlegroups.com.
> Visit this group at
> https://groups.google.com/group/android-security-discuss.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Nick Kralevich | n...@google.com

-- 
You received this message because you are subscribed to the Google Groups 
"Android Security Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-security-discuss+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-security-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to