Bug 199251 - rpm -q --verify SDL does not work and leaves temporary files in /usr/lib
Summary: rpm -q --verify SDL does not work and leaves temporary files in /usr/lib
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: prelink
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard: bzcl34nup
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-07-18 13:09 UTC by Thomas Vander Stichele
Modified: 2008-05-06 16:08 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-05-06 16:08:31 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Thomas Vander Stichele 2006-07-18 13:09:35 UTC
Description of problem:

rpm -q --verify SDL has problems and leaves stray files

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


How reproducible:
always

Steps to Reproduce:
1. make sure selinux is turned on
2. rpm -q --verify SDL
3. 
  
Actual results:
[root@manager lib]# rpm -q --verify SDL
prelink: /usr/lib/libSDL-1.2.so.0.7.2.#prelink#.vjRgbc Could not trace symbol
resolving
S.?......   /usr/lib/libSDL-1.2.so.0.7.2

dmesg shows:
Jul 18 15:20:02 manager kernel: audit(1153228802.652:980): avc:  denied  {
execheap } for  pid=9876 comm="ld-linux.so.2"
scontext=root:system_r:rpm_t:s0-s0:c0.c255
tcontext=root:system_r:rpm_t:s0-s0:c0.c255 tclass=process

the temporary file stays in /usr/lib, cluttering up the directory for no good reason


Expected results:
everything should work fine

Additional info:
Not sure if this is a bug in SDL (text relocations ?), selinux policy, prelink,
rpm, somewhere else.  Similar problems with GL packages.

Comment 1 Thomas Woerner 2006-07-18 13:23:41 UTC
This is no SDL problem, assigning to prelink.

Comment 2 Thomas Vander Stichele 2006-09-02 10:45:33 UTC
ping ? I'd really like to know what's wrong and how I can fix it.

Comment 3 Tobias Oed 2006-11-30 14:41:12 UTC
I'm seeing the same thing with every lib that has selinux context textrel_shlib_t

-rwxr-xr-x  root root system_u:object_r:textrel_shlib_t libSDL-1.2.so.0.7.3

the temp file on the other hand has

-rwx------  root root user_u:object_r:lib_t           
libSDL-1.2.so.0.7.3.#prelink#.fYwkkC

Tobias

Comment 4 Jakub Jelinek 2006-12-01 18:33:52 UTC
I've (hopefully) fixed the bug where prelink was leaving the temporary file
behind in case of failure:
svn diff -r150:151 svn://sources.redhat.com/svn/prelink/trunk/

Now the question is what to do with textrel_shlib_t's.

One possibility is to change glibc, with LD_TRACE_PRELINKING=1 we never execute
any code (except ld.so's own code), so there is no need to mprotect text sections
back - nothing cares about it.
So perhaps we could change dl-reloc.c to:

  /* Undo the segment protection changes.  */
+ if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK, 0) == 0)
  while (__builtin_expect (textrels != NULL, 0))
    {
      if (__mprotect (textrels->start, textrels->len, textrels->prot) < 0)
        {
          errstring = N_("cannot restore segment prot after reloc");
          goto call_error;
        }

      textrels = textrels->next;
    }

Another alternative would be that prelink's verify code would look at
SELinux type of the file and if it is textrel_shlib_t, set SELinux context of the
temporary file.  But hardcoding any particular type is very ugly and furthermore
I'm afraid there can be multiple such types.

Comment 5 Ulrich Drepper 2006-12-01 18:40:13 UTC
I'm OK with avoiding the mprotect call in ld.so.

Comment 6 Daniel Walsh 2006-12-01 19:16:06 UTC
>Another alternative would be that prelink's verify code would look at
>SELinux type of the file and if it is textrel_shlib_t, set SELinux context of the
>temporary file.  But hardcoding any particular type is very ugly and furthermore
>I'm afraid there can be multiple such types.

You could 
getfilecon()
setfscreatecon()
create temporary file?


Comment 7 Jakub Jelinek 2006-12-01 19:38:46 UTC
True, but is it really desirable to copy over SELinux context from the
original file to the temporary?  If somebody runs the temp file in the window
between prelink --verify creates it and its deletion, it could have raised
capabilities.

Comment 8 Daniel Walsh 2006-12-01 19:46:04 UTC
No I would prefer solution 1 also, but if we need solution two, then I would
prefer to copy the file context rather then hard code textrel_shlib_t

Comment 9 Bug Zapper 2008-04-04 03:20:20 UTC
Fedora apologizes that these issues have not been resolved yet. We're
sorry it's taken so long for your bug to be properly triaged and acted
on. We appreciate the time you took to report this issue and want to
make sure no important bugs slip through the cracks.

If you're currently running a version of Fedora Core between 1 and 6,
please note that Fedora no longer maintains these releases. We strongly
encourage you to upgrade to a current Fedora release. In order to
refocus our efforts as a project we are flagging all of the open bugs
for releases which are no longer maintained and closing them.
http://fedoraproject.org/wiki/LifeCycle/EOL

If this bug is still open against Fedora Core 1 through 6, thirty days
from now, it will be closed 'WONTFIX'. If you can reporduce this bug in
the latest Fedora version, please change to the respective version. If
you are unable to do this, please add a comment to this bug requesting
the change.

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we are following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

And if you'd like to join the bug triage team to help make things
better, check out http://fedoraproject.org/wiki/BugZappers

Comment 10 Bug Zapper 2008-05-06 16:08:29 UTC
This bug is open for a Fedora version that is no longer maintained and
will not be fixed by Fedora. Therefore we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen thus bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.


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