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 1280280 - restorecon sets an incorrect label on /var/run/tgtd.ipc_abstract_namespace.0.lock file
Summary: restorecon sets an incorrect label on /var/run/tgtd.ipc_abstract_namespace.0....
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.2
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-11 12:00 UTC by Milos Malik
Modified: 2016-11-04 02:24 UTC (History)
6 users (show)

Fixed In Version: selinux-policy-3.13.1-69.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 02:24:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2283 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2016-11-03 13:36:25 UTC

Description Milos Malik 2015-11-11 12:00:36 UTC
Description of problem:

Version-Release number of selected component (if applicable):
scsi-target-utils-1.0.46-3.el7.x86_64
selinux-policy-3.13.1-60.el7.noarch
selinux-policy-devel-3.13.1-60.el7.noarch
selinux-policy-doc-3.13.1-60.el7.noarch
selinux-policy-minimum-3.13.1-60.el7.noarch
selinux-policy-mls-3.13.1-60.el7.noarch
selinux-policy-sandbox-3.13.1-60.el7.noarch
selinux-policy-targeted-3.13.1-60.el7.noarch

How reproducible:
always

Steps to Reproduce:
# service tgtd status
Redirecting to /bin/systemctl status  tgtd.service
● tgtd.service - tgtd iSCSI target daemon
   Loaded: loaded (/usr/lib/systemd/system/tgtd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

Nov 11 12:47:18 rhel72.localdomain systemd[1]: Unit tgtd.service entered fai....
Nov 11 12:47:18 rhel72.localdomain systemd[1]: tgtd.service failed.
Nov 11 12:54:03 rhel72.localdomain systemd[1]: Starting tgtd iSCSI target da....
Nov 11 12:54:03 rhel72.localdomain tgtd[4962]: tgtd: iser_ib_init(3355) Fail...?
Nov 11 12:54:03 rhel72.localdomain tgtd[4962]: tgtd: work_timer_start(146) u...r
Nov 11 12:54:03 rhel72.localdomain tgtd[4962]: tgtd: bs_init_signalfd(271) c...e
Nov 11 12:54:03 rhel72.localdomain tgtd[4962]: tgtd: bs_init(390) use signal...n
Nov 11 12:54:08 rhel72.localdomain systemd[1]: Started tgtd iSCSI target daemon.
Nov 11 12:54:17 rhel72.localdomain systemd[1]: Stopping tgtd iSCSI target da....
Nov 11 12:54:18 rhel72.localdomain systemd[1]: Stopped tgtd iSCSI target daemon.
Hint: Some lines were ellipsized, use -l to show in full.
# ls -Z /run/tgtd.*
srwxr-xr-x. root root system_u:object_r:tgtd_var_run_t:s0 /run/tgtd.ipc_abstract_namespace.0
-rw-r--r--. root root system_u:object_r:tgtd_var_run_t:s0 /run/tgtd.ipc_abstract_namespace.0.lock
# restorecon -v /run/tgtd.*
restorecon reset /run/tgtd.ipc_abstract_namespace.0.lock context system_u:object_r:tgtd_var_run_t:s0->system_u:object_r:var_run_t:s0
# service tgtd start
Redirecting to /bin/systemctl start  tgtd.service
Job for tgtd.service failed because the control process exited with error code. See "systemctl status tgtd.service" and "journalctl -xe" for details.
#

Actual results (enforcing mode):
----
type=PATH msg=audit(11/11/2015 12:55:02.609:279) : item=1 name=/var/run/tgtd.ipc_abstract_namespace.0.lock inode=70602 dev=00:12 mode=file,644 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:var_run_t:s0 objtype=NORMAL 
type=PATH msg=audit(11/11/2015 12:55:02.609:279) : item=0 name=/var/run/ inode=6661 dev=00:12 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:var_run_t:s0 objtype=PARENT 
type=CWD msg=audit(11/11/2015 12:55:02.609:279) :  cwd=/ 
type=SYSCALL msg=audit(11/11/2015 12:55:02.609:279) : arch=x86_64 syscall=open success=no exit=-13(Permission denied) a0=0x6576a0 a1=O_WRONLY|O_CREAT a2=0644 a3=0x7ffcc559bec0 items=2 ppid=1 pid=5352 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=tgtd exe=/usr/sbin/tgtd subj=system_u:system_r:tgtd_t:s0 key=(null) 
type=AVC msg=audit(11/11/2015 12:55:02.609:279) : avc:  denied  { write } for  pid=5352 comm=tgtd name=tgtd.ipc_abstract_namespace.0.lock dev="tmpfs" ino=70602 scontext=system_u:system_r:tgtd_t:s0 tcontext=system_u:object_r:var_run_t:s0 tclass=file 
----

Expected results:
 * no SELinux denails
 * correct file context pattern

Comment 2 Milos Malik 2015-11-18 08:21:38 UTC
The tgtd process creates the lock file with correct context

# sesearch -s tgtd_t -t var_run_t -T
Found 2 semantic te rules:
   type_transition tgtd_t var_run_t : file tgtd_var_run_t; 
   type_transition tgtd_t var_run_t : sock_file tgtd_var_run_t; 

#

but the file pattern matches only sockets

# semanage fcontext -l | grep /run/tgt
/var/run/tgtd.*                                    socket             system_u:object_r:tgtd_var_run_t:s0 
# 

which means that restorecon resets the label to var_run_t:

# ls -Z /run/tgtd.ipc_abstract_namespace.0*
srwxr-xr-x. root root system_u:object_r:tgtd_var_run_t:s0 /run/tgtd.ipc_abstract_namespace.0
-rw-r--r--. root root system_u:object_r:tgtd_var_run_t:s0 /run/tgtd.ipc_abstract_namespace.0.lock
# restorecon -v /run/tgtd.ipc_abstract_namespace.0*
restorecon reset /run/tgtd.ipc_abstract_namespace.0.lock context system_u:object_r:tgtd_var_run_t:s0->system_u:object_r:var_run_t:s0
#

Comment 8 errata-xmlrpc 2016-11-04 02:24:31 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, 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://rhn.redhat.com/errata/RHBA-2016-2283.html


Note You need to log in before you can comment on or make changes to this bug.