Bug 1045773

Summary: incorrect selinux label on /run/pkcsslotd.socket
Product: [Fedora] Fedora Reporter: Michael S. <misc>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dwalsh, misc
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-06 22:00:40 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:

Description Michael S. 2013-12-21 22:23:02 UTC
When starting pkcsslotd ( in opencryptoki-3.0-6.fc20.x86_64 ), it create a socket in /run :

$ ls -lZ /run/pkcsslotd.socket            
srwxrwx---. root pkcs11 system_u:object_r:pkcsslotd_var_run_t:s0 /run/pkcsslotd.socket

However, when running restorecon :
$ sudo restorecon -Rv /run/pkcsslotd.*    
/sbin/restorecon reset /run/pkcsslotd.socket context system_u:object_r:pkcsslotd_var_run_t:s0->system_u:object_r:var_run_t:s0

$ ls -lZ /run/pkcsslotd.socket        
srwxrwx---. root pkcs11 system_u:object_r:var_run_t:s0   /run/pkcsslotd.socket

I think it shouldn't be reset like this, as someone trying to fix some problem would just create more issues.

Comment 1 Daniel Walsh 2014-01-02 23:12:14 UTC
grep /run/pkcsslotd /etc/selinux/targeted/contexts/files/file_contexts
/var/run/pkcsslotd.*	system_u:object_r:pkcs_slotd_var_run_t:s0

Comment 2 Michael S. 2014-01-03 11:01:38 UTC
Would the file context also match if the file is /run rather than /var/run, ( I mean, at creation time ) ?

as I do have the same result than you, but I can still reproduce the problem of having the socket wrongly labelled when pkcsslotd is started.

Comment 3 Daniel Walsh 2014-01-03 17:49:20 UTC
Yes /run == /var/run, there is a file equivalence.

matchpathcon /run/pkcsslotd.socket

Comment 4 Michael S. 2014-01-03 21:17:43 UTC
$ matchpathcon /run/pkcsslotd.socket    
/run/pkcsslotd.socket	system_u:object_r:var_run_t:s0

Comment 5 Miroslav Grepl 2014-01-06 11:01:00 UTC
If you execute

# yum reinstall selinux-policy-targeted

does it  blow up?

Comment 6 Michael S. 2014-01-06 20:47:17 UTC
That indeed fix the issue so I guess I can close it ?