Bug 2063994

Summary: SELinux is preventing waydroid from 'getattr' accesses on the chr_file /dev/binderfs/anbox-binder.
Product: [Fedora] Fedora Reporter: Mikhail <mikhail.v.gavrilov>
Component: waydroidAssignee: Alessandro Astone <ales.astone>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 37CC: ales.astone, dwalsh, grepl.miroslav, lvrabec, mmalik, omosnace, pkoncity, vmojzis, zpytela
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:6a46155555310df44dc85fc683851ca85b4e0c46de916ba1584185efec1df6c9;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mikhail 2022-03-14 20:37:04 UTC
Description of problem:
SELinux is preventing waydroid from 'getattr' accesses on the chr_file /dev/binderfs/anbox-binder.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that waydroid should be allowed getattr access on the anbox-binder chr_file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'waydroid' --raw | audit2allow -M my-waydroid
# semodule -X 300 -i my-waydroid.pp

Additional Information:
Source Context                system_u:system_r:init_t:s0
Target Context                system_u:object_r:binderfs_t:s0
Target Objects                /dev/binderfs/anbox-binder [ chr_file ]
Source                        waydroid
Source Path                   waydroid
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-36.4-3.fc37.noarch
Local Policy RPM              selinux-policy-targeted-36.4-3.fc37.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 5.17.0-
                              0.rc7.20220311git79b00034e9dc.120.fc37.x86_64 #1
                              SMP PREEMPT Fri Mar 11 19:41:52 UTC 2022 x86_64
                              x86_64
Alert Count                   3
First Seen                    2022-03-14 21:53:30 +05
Last Seen                     2022-03-14 23:59:52 +05
Local ID                      2fd96aef-db23-4bd6-819d-383c6aae39bf

Raw Audit Messages
type=AVC msg=audit(1647284392.6:1484): avc:  denied  { getattr } for  pid=347262 comm="waydroid" path="/dev/binderfs/anbox-binder" dev="binder" ino=7 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:binderfs_t:s0 tclass=chr_file permissive=1


Hash: waydroid,init_t,binderfs_t,chr_file,getattr

Version-Release number of selected component:
selinux-policy-targeted-36.4-3.fc37.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.17.1
hashmarkername: setroubleshoot
kernel:         5.17.0-0.rc7.20220311git79b00034e9dc.120.fc37.x86_64
type:           libreport

Comment 1 Zdenek Pytela 2022-03-15 07:50:19 UTC
Hi Mikhail,

I cannot find waydroid in Fedora. Where did you get it?

Comment 3 Zdenek Pytela 2022-03-15 10:33:52 UTC
I see, so it requires confining the service and adding policy for it.

Comment 4 Ben Cotton 2022-08-09 13:36:48 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.

Comment 5 Alessandro Astone 2023-01-03 11:12:20 UTC
We're starting to ship waydroid in fedora repos. It includes a waydroid-selinux package.
Under normal operation this issue will not happen, however there is still a path that triggers this audit but doesn't affect functionality.
That path is invoking a `sudo waydroid init` command without having previously started `waydroid-container.service` that would have triggered `dev-binderfs.mount` and properly exposed the binder devices.
`sudo waydroid init` is not the preferred mode of operation as by the official waydroid docs, and we're tracking auto-starting `waydroid-container.service` here: https://bugzilla.redhat.com/show_bug.cgi?id=2157810