Bug 1660798

Summary: NFSv4.2: security label of mount point shows as "unlabeled_t" for ~30 seconds after mounting
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: kernelAssignee: Scott Mayhew <smayhew>
kernel sub component: NFS QA Contact: Zhi Li <yieli>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: bcodding, dwysocha, omosnace, pasik, sdsmall, smayhew, swhiteho, xzhou, yieli, yoyang
Version: ---Keywords: Patch, Reproducer
Target Milestone: rc   
Target Release: 8.3   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-4.18.0-221.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1625955 Environment:
Last Closed: 2020-11-04 00:51:49 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:
Attachments:
Description Flags
RHEL-specific patch none

Description Renaud Métrich 2018-12-19 09:33:58 UTC
+++ This bug was initially created as a clone of Bug #1625955 +++

Description of problem:

This BZ may be related to BZ 1624848 (https://bugzilla.redhat.com/show_bug.cgi?id=1624848) but I'm not sure.

When mounting a directory using v4.2 and exported with security labels AND when the exported directory is just below "/", the security label seen on the client shows as "unlabeled_t" for about 30 seconds.
After that delay, the label appears right.

Recording a tcpdump, it looks like the issue is on the client side.


Version-Release number of selected component (if applicable):

nfs-utils-2.3.3-7.el8.x86_64


How reproducible:

Always


Steps to Reproduce:

1. Configure NFS server (vm-nfs8-server) to export some directory under /

  # mkdir -p /export

  # ls -Zd /export
  drwxr-xr-x. root root system_u:object_r:usr_t:s0       /export

  # cat /etc/exports
  /export *(rw,no_root_squash,no_wdelay,sync,security_label)

  # systemctl restart nfs-server

2. On the NFS client, mount the exported directory

  # yum -y install nfs-utils attr

  # mount -o vers=4.2 vm-nfs8-server:/export /mnt

3. Verify security labels quickly after mounting

  # date; getfattr --absolute-names -n security.selinux /mnt
  Wed Dec 19 10:27:33 CET 2018
  # file: /mnt
  security.selinux="system_u:object_r:unlabeled_t:s0"

4. Wait for 30 seconds or maybe a bit more and check again

  # date; getfattr --absolute-names -n security.selinux /mnt
  Wed Dec 19 10:29:03 CET 2018
  # file: /mnt
  security.selinux="system_u:object_r:usr_t:s0"

Comment 1 Zhi Li 2019-01-23 03:02:08 UTC
*** Bug 1652463 has been marked as a duplicate of this bug. ***

Comment 2 Ondrej Mosnacek 2020-02-26 15:25:13 UTC
There is nothing confidential in this BZ nor its description - opening it to the public.

Comment 3 Ondrej Mosnacek 2020-02-26 15:32:55 UTC
Also, this should be assigned to kernel, not nfs-utils...

Comment 4 Steve Whitehouse 2020-03-09 15:57:04 UTC
Again, some triage required

Comment 5 Stephen Smalley 2020-03-09 16:00:21 UTC
Upstream fix posted here: https://lore.kernel.org/selinux/20200303225837.1557210-1-smayhew@redhat.com/

Comment 7 Scott Mayhew 2020-03-13 19:57:29 UTC
This will either need to go on top of the mount api changes (bug 1801202) or we'll need a RHEL-specific patch.  For z-stream, we'll definitely need a RHEL-specific patch.

Comment 8 Scott Mayhew 2020-03-13 20:13:10 UTC
Created attachment 1669982 [details]
RHEL-specific patch

This patch is actually against upstream v5.5, but applies cleanly against RHEL 8.2.  If we wanted to use this patch, then there will be a few conflicts to fix when backporting the mount api changes.

Comment 9 Zhi Li 2020-03-16 05:05:15 UTC
(In reply to Scott Mayhew from comment #8)
> Created attachment 1669982 [details]
> RHEL-specific patch
> 
> This patch is actually against upstream v5.5, but applies cleanly against
> RHEL 8.2.  If we wanted to use this patch, then there will be a few
> conflicts to fix when backporting the mount api changes.

My understanding is that you tend to fix this issue based on the mount API changes (bug 1801202).

Comment 11 Frantisek Hrbata 2020-06-26 05:52:30 UTC
Patch(es) available on kernel-4.18.0-221.el8

Comment 17 Zhi Li 2020-06-28 05:53:04 UTC
Moving to VERIFIED according to comment#16.

Comment 20 errata-xmlrpc 2020-11-04 00:51:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: kernel security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:4431