Bug 199251 - rpm -q --verify SDL does not work and leaves temporary files in /usr/lib
rpm -q --verify SDL does not work and leaves temporary files in /usr/lib
Product: Fedora
Classification: Fedora
Component: prelink (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2006-07-18 09:09 EDT by Thomas Vander Stichele
Modified: 2008-05-06 12:08 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-05-06 12:08:31 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 Thomas Vander Stichele 2006-07-18 09:09:35 EDT
Description of problem:

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

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

How reproducible:

Steps to Reproduce:
1. make sure selinux is turned on
2. rpm -q --verify SDL
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
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"
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 09:23:41 EDT
This is no SDL problem, assigning to prelink.
Comment 2 Thomas Vander Stichele 2006-09-02 06:45:33 EDT
ping ? I'd really like to know what's wrong and how I can fix it.
Comment 3 Tobias Oed 2006-11-30 09:41:12 EST
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           

Comment 4 Jakub Jelinek 2006-12-01 13:33:52 EST
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 13:40:13 EST
I'm OK with avoiding the mprotect call in ld.so.
Comment 6 Daniel Walsh 2006-12-01 14:16:06 EST
>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 
create temporary file?
Comment 7 Jakub Jelinek 2006-12-01 14:38:46 EST
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
Comment 8 Daniel Walsh 2006-12-01 14:46:04 EST
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-03 23:20:20 EDT
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.

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:

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 12:08:29 EDT
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.