Bug 509544 - /usr/share/hplip/prnt/plugins/lj-x86_64.so needs to be lib_t instead of usr_t
/usr/share/hplip/prnt/plugins/lj-x86_64.so needs to be lib_t instead of usr_t
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted (Show other bugs)
x86_64 Linux
low Severity high
: ---
: ---
Assigned To: Miroslav Grepl
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2009-07-03 08:21 EDT by hristo ivanov
Modified: 2010-04-27 11:29 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-04-27 11:29:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description hristo ivanov 2009-07-03 08:21:00 EDT
Description of problem:
Printing with the hplip drivers, which are installed by hp-setup, is not working because of wrong selinux policy.

AVC denial message:
avc:  denied  { execute } for  pid=4367 comm="hpijs" path="/usr/share/hplip/prnt/plugins/lj-x86_64.so" dev=sda1 ino=998995 scontext=system_u:system_r:hplip_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:usr_t:s0 tclass=file

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

How reproducible:

Steps to Reproduce:
1. install hp linux printing driver (I have a LaserJet P1005) by issuing hp-setup.
2. configure/restart cups (the configuration is done automatically by hp-setup).
3. print a test page.
Actual results:
Test page sits in the cups print queue indefinitely with status waiting.

Expected results:
Page should be printed (status=processing and actual printing being done.)

Additional info:
drgift on #fedora-selinux proposed the following solution, which worked:

semanage fcontext -a -t lib_t /usr/share/hplip/prnt/plugins/lj-x86_64.so

This fixed the error, the printing is okay.
Comment 1 hristo ivanov 2009-07-03 10:01:05 EDT
more avc messages generated after the printer had been turned off and then back on:

time->Fri Jul  3 16:41:43 2009
type=SYSCALL msg=audit(1246628503.809:141): arch=c000003e syscall=59 success=yes exit=0 a0=7fff5d5f49b0 a1=7fff5d5f41a0 a2=7fff5d5f5710 a3=7fff5d5f3de0 items=0 ppid=12823 pid=12834 auid=500 uid=0 gid=7 euid=0 suid=0 fsuid=0 egid=7 sgid=7 fsgid=7 tty=(none) ses=1 comm="cups-pdf" exe="/usr/lib/cups/backend/cups-pdf" subj=unconfined_u:system_r:cups_pdf_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1246628503.809:141): avc:  denied  { read write } for  pid=12834 comm="cups-pdf" path="anon_inode:[eventpoll]" dev=anon_inodefs ino=91 scontext=unconfined_u:system_r:cups_pdf_t:s0-s0:c0.c1023 tcontext=system_u:object_r:anon_inodefs_t:s0 tclass=file
time->Fri Jul  3 16:41:43 2009
type=SYSCALL msg=audit(1246628503.859:142): arch=c000003e syscall=2 success=no exit=-13 a0=7ffffdd28750 a1=0 a2=7ffffdd2875c a3=fffffff8 items=0 ppid=12823 pid=12846 auid=500 uid=0 gid=7 euid=0 suid=0 fsuid=0 egid=7 sgid=7 fsgid=7 tty=(none) ses=1 comm="python" exe="/usr/bin/python" subj=unconfined_u:system_r:hplip_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1246628503.859:142): avc:  denied  { read } for  pid=12846 comm="python" name="mls" dev=selinuxfs ino=12 scontext=unconfined_u:system_r:hplip_t:s0-s0:c0.c1023 tcontext=system_u:object_r:security_t:s0 tclass=file

fix was the following command (thanks to drgift @ #fedora-selinux for that):
ausearch -m avc -ts recent | grep cups_pdf_t | audit2allow -RM mycups; semodule -i mycups.pp
Comment 2 Daniel Walsh 2009-07-05 22:13:16 EDT

Label is lib_t, you just needed to run restorecon on it.
Comment 3 Daniel Walsh 2009-07-05 22:15:21 EDT

looks like cups.te needs

Comment 4 hristo ivanov 2009-07-06 01:18:47 EDT
It is lib_t, but strangely why, when no such file exists (at the first run of hplip installer, and each and every time I delete and then add again the printer), the file is created as usr_t, but not lib_t. Is this normal behavior?

Moreover, cupsd_pdf_t, as mentioned above, was essential to the working of the printer.
Comment 5 Daniel Walsh 2009-07-06 14:10:31 EDT
All files adopt the context of the parent directory if the installer is not SELinux aware (rpm).

matchpathcon /usr/share/hplip/prnt/plugins
/usr/share/hplip/prnt/plugins	system_u:object_r:usr_t:s0

So if the installer just places a file in this directory it will be labeled usr_t, if the only files in this directory are shared libraries, we should probaly fix the labeling of the directory to be lib_t.
Comment 6 hristo ivanov 2009-07-07 01:25:42 EDT
+1 for changing the directory's type to lib_t. More, the installer places a link to lj-x86_64.so, called lj.so in the same folder, which is of usr_t, and I had to change its type to lib_t also. I don't know currently of any other files being placed in that folder.
Comment 7 Miroslav Grepl 2009-07-07 04:34:05 EDT
Fixed in selinux-policy-3.6.12-64.fc11
Comment 8 Bug Zapper 2010-04-27 11:27:16 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 

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