Bug 581959 - postinstall script needs 'restorecon /var/lib/misc/prelink.force'
Summary: postinstall script needs 'restorecon /var/lib/misc/prelink.force'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: prelink
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-04-13 17:26 UTC by Tom London
Modified: 2010-04-23 14:59 UTC (History)
3 users (show)

Fixed In Version: prelink-0.4.3-2.fc13
Clone Of:
Environment:
Last Closed: 2010-04-22 22:52:03 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Tom London 2010-04-13 17:26:35 UTC
Description of problem:
The post install script for prelink show:

[root@tlondon ~]# rpm -q -scripts prelink
postinstall scriptlet (using /bin/sh):
touch /var/lib/misc/prelink.force
[root@tlondon ~]# 

This creates the file /var/lib/misc/prelink.force with the wrong SELinux label: it gets created with var_lib_t instead of prelink_var_lib_t.

This causes prelink cron script to throw AVCs:

node=tlondon.innopath.com  type=AVC msg=audit(1271169652.784:29091):
avc:  denied  { getattr } for  pid=6638 comm="prelink"
path="/var/lib/misc/prelink.force" dev=dm-0 ino=5243615
scontext=system_u:system_r:prelink_cron_system_t:s0-s0:c0.c1023
tcontext=unconfined_u:object_r:var_lib_t:s0 tclass=file

node=tlondon.innopath.com type=SYSCALL
msg=audit(1271169652.784:29091): arch=c000003e syscall=4 success=no
exit=-13 a0=206bab0 a1=7fffd7d1bd80 a2=7fffd7d1bd80 a3=8 items=0
ppid=3331 pid=6638 auid=0 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0
sgid=0 fsgid=0 tty=(none) ses=2 comm="prelink" exe="/bin/bash"
subj=system_u:system_r:prelink_cron_system_t:s0-s0:c0.c1023 key=(null)

Adding 'restorecon /var/lib/misc/prelink.force' would correct this.

Version-Release number of selected component (if applicable):
prelink-0.4.2-7.fc14.x86_64

How reproducible:
Every install....

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Daniel Walsh 2010-04-13 17:35:38 UTC
Either add

 [ -x /sbin/restorecon ] && /sbin/restorecon /var/lib/misc/prelink.force

Or make prelink.force part of the rpm payload.

Should fix the label.

Comment 2 Jakub Jelinek 2010-04-13 17:56:20 UTC
Ugly.  Is this needed also for f13 or just f14?  No idea when the policy changed, certainly prelink has been doing this for years.

Comment 3 Daniel Walsh 2010-04-13 18:05:35 UTC
Fedora 12 added policy to try to handle these labels (Also RHEL6).  So yes, but can't you just put it in payload and be done with it.

Comment 4 Jakub Jelinek 2010-04-13 18:11:57 UTC
The file is short-lived - usually survives at most a day.
Yeah, probably putting it into the payload and adding %config(missingok) and whatever else is needed to avoid rpm -V failures could work too.

Comment 5 Jakub Jelinek 2010-04-13 18:47:20 UTC
Actually, now I remember from glibc that there were many issues with that and I ended up keeping empty /usr/lib/locale/locale-archive.tmpl instead of removing it, because missingok implies %config and the ugly rpmsave etc. suffixes.

Comment 6 Daniel Walsh 2010-04-13 18:53:34 UTC
Bill do you have any good ideas on this one.

Comment 7 Jakub Jelinek 2010-04-13 19:34:43 UTC
prelink-0.4.3-2.fc{12,13,14} has that restorecon in %post.

Comment 8 Tom London 2010-04-13 20:05:28 UTC
Tested; it works.

[root@tlondon ~]# ls -l  /var/lib/misc
total 8
-rw-r--r--. 1 root root 29 Apr  7 07:24 prelink.full
-rw-r--r--. 1 root root 29 Apr 13 07:40 prelink.quick
[root@tlondon Download]# rpm -Uvh prelink*
Preparing...                ########################################### [100%]
   1:prelink                ########################################### [ 50%]
   2:prelink-debuginfo      ########################################### [100%]
[root@tlondon Download]# ls -lZ /var/lib/misc
-rw-r--r--. root root system_u:object_r:prelink_var_lib_t:s0 prelink.force
-rw-r--r--. root root system_u:object_r:prelink_var_lib_t:s0 prelink.full
-rw-r--r--. root root system_u:object_r:prelink_var_lib_t:s0 prelink.quick
[root@tlondon Download]#

Comment 9 Bill Nottingham 2010-04-13 20:53:37 UTC
If the file is always empty, %config(missingok) should be fine, as the payload file will only ever change in timestamp, I think. I'd test it, of course.

Comment 10 Fedora Update System 2010-04-14 08:34:40 UTC
prelink-0.4.3-2.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/prelink-0.4.3-2.fc13

Comment 11 Fedora Update System 2010-04-15 03:17:32 UTC
prelink-0.4.3-2.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update prelink'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/prelink-0.4.3-2.fc13

Comment 12 Fedora Update System 2010-04-22 22:51:49 UTC
prelink-0.4.3-2.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Jakub Jelinek 2010-04-23 10:50:48 UTC
I've tried
%verify(not md5 size mtime) %config(missingok,noreplace) /var/lib/misc/prelink.force
with a zero-sized file in the payload, but that doesn't really work - when it is removed, upgrade of the package to a newer version doesn't create the file at all.
The same for
%verify(not md5 size mtime) %config(missingok) /var/lib/misc/prelink.force

The restorecon in %post doesn't work well either though - see #584319.

Comment 14 Daniel Walsh 2010-04-23 13:15:42 UTC
Could we finally move these to a prelink specific directory?

/var/lib/prelink

Then I could label the directory properly allow the cron script and prelink to manipulate and we don't have to worry about the file.  These files have always been a pain in the butt for SELinux since they exist in a directory not controled by the prelink package.

Comment 15 Jakub Jelinek 2010-04-23 13:53:02 UTC
That works for me, those 3 files are only mentioned in prelink.spec and /etc/cron.daily/prelink, nowhere else.

Comment 18 Jakub Jelinek 2010-04-23 14:59:15 UTC
prelink-0.4.3-3.{fc13,fc14,el6} built.  Guess a bodhi request for f13 should be filed for both selinux-policy and prelink together.


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