Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2218076

Summary: [RHEL 9] avc: denied { write } for pid=26248 comm="nfsdcld" name="/" dev="tmpfs"
Product: Red Hat Enterprise Linux 9 Reporter: Zhi Li <yieli>
Component: selinux-policyAssignee: Nikola Knazekova <nknazeko>
Status: CLOSED MIGRATED QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.3CC: lvrabec, mmalik, xzhou, zpytela
Target Milestone: rcKeywords: MigratedToJIRA, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-23 08:28:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2209174    

Description Zhi Li 2023-06-28 04:55:02 UTC
Description of problem:

SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      33
selinux-policy-38.1.14-1.el9.noarch
----
time->Tue Jun 13 02:33:24 2023
type=PROCTITLE msg=audit(1686638004.918:474): proctitle="/usr/sbin/nfsdcld"
type=SYSCALL msg=audit(1686638004.918:474): arch=c000003e syscall=83 success=no exit=-13 a0=55eaea2314db a1=1c0 a2=0 a3=0 items=0 ppid=1 pid=26248 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="nfsdcld" exe="/usr/sbin/nfsdcld" subj=system_u:system_r:rpcd_t:s0 key=(null)
type=AVC msg=audit(1686638004.918:474): avc:  denied  { write } for  pid=26248 comm="nfsdcld" name="/" dev="tmpfs" ino=1 scontext=system_u:system_r:rpcd_t:s0 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=dir permissive=0

Version-Release number of selected component (if applicable):
nfs-utils-2.5.4-18.el9.x86_64
selinux-policy-38.1.14-1.el9.noarch


How reproducible:
always


Actual results:
AVC denied

Expected results:
No AVC denied for defined operations

Additional info:
beaker job:
https://beaker.engineering.redhat.com/jobs/7968106

Comment 1 Zdenek Pytela 2023-07-14 12:59:03 UTC
Hello,

Do you know what are the conditions or configuration change needed to trigger this denial?
Apart from the denial, is there any problem with the service reported?

Can you gather all denials in permissive mode and with full auditing enabled?

0) Run
  # setenforce 0
1) Open the /etc/audit/rules.d/audit.rules file in an editor.
2) Remove the following line if it exists:
-a task,never
3) Add the following line to the end of the file:
-w /etc/shadow -p w
4) Restart the audit daemon:
  # service auditd restart
5) Re-run your scenario.
6) Collect AVC denials:
  # ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts today

Comment 3 Zdenek Pytela 2023-08-15 09:19:54 UTC
I cannot reproduce the issue. When the nfsdcld service starts, it creates the directory without any issue:

rhel93# ls -lZa /var/lib/nfs
total 4
drwxr-xr-x.  5 root    root    system_u:object_r:var_lib_nfs_t:s0   80 Aug 15 05:11 .
drwxr-xr-x. 32 root    root    system_u:object_r:var_lib_t:s0     4096 Aug 15 05:11 ..
-rw-r--r--.  1 root    root    system_u:object_r:var_lib_nfs_t:s0    0 Aug  7 20:31 etab
-rw-r--r--.  1 root    root    system_u:object_r:var_lib_nfs_t:s0    0 Aug  7 20:31 rmtab
dr-xr-xr-x. 11 root    root    system_u:object_r:rpc_pipefs_t:s0     0 Aug 15 05:11 rpc_pipefs
drwx------.  4 rpcuser rpcuser system_u:object_r:var_lib_nfs_t:s0   30 Aug 15 05:11 statd
drwxr-xr-x.  2 root    root    system_u:object_r:var_lib_nfs_t:s0    6 Aug  7 20:31 v4recovery
rhel93# systemctl start nfsdcld
rhel93# ls -lZa /var/lib/nfs
total 4
drwxr-xr-x.  6 root    root    system_u:object_r:var_lib_nfs_t:s0   95 Aug 15 05:12 .
drwxr-xr-x. 32 root    root    system_u:object_r:var_lib_t:s0     4096 Aug 15 05:11 ..
-rw-r--r--.  1 root    root    system_u:object_r:var_lib_nfs_t:s0    0 Aug  7 20:31 etab
drwx------.  2 root    root    system_u:object_r:var_lib_nfs_t:s0   25 Aug 15 05:12 nfsdcld
-rw-r--r--.  1 root    root    system_u:object_r:var_lib_nfs_t:s0    0 Aug  7 20:31 rmtab
dr-xr-xr-x. 11 root    root    system_u:object_r:rpc_pipefs_t:s0     0 Aug 15 05:11 rpc_pipefs
drwx------.  4 rpcuser rpcuser system_u:object_r:var_lib_nfs_t:s0   30 Aug 15 05:11 statd
drwxr-xr-x.  2 root    root    system_u:object_r:var_lib_nfs_t:s0    6 Aug  7 20:31 v4recovery
rhel93# ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts boot
<no matches>

Can you share some configuration details which may have effect? For instance, on a default installation, no tmpfs is involved.
Does it require some particular packages version?

rpm -q nfs-utils
cat /proc/mounts
ls -lZa /var/lib/nfs /var/lib/nfs/nfsdcld/
systemctl cat nfsdcld

Comment 4 Zhi Li 2023-08-17 03:08:01 UTC
(In reply to Zdenek Pytela from comment #3)
> I cannot reproduce the issue. When the nfsdcld service starts, it creates
> the directory without any issue:

FYI: The complete process is included in this case: 
https://gitlab.cee.redhat.com/kernel-qe/kernel/-/tree/master/filesystems/nfs/stress/lustre-racer

Comment 5 RHEL Program Management 2023-08-21 17:54:49 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 6 Nikola Knazekova 2023-08-23 08:28:11 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues.