Bug 72705 - Segfault from prelink
Summary: Segfault from prelink
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: prelink (Show other bugs)
(Show other bugs)
Version: 8.0
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-08-26 19:26 UTC by Owen Taylor
Modified: 2007-04-18 16:46 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-08-29 20:31:42 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
gnome-terminal binary reproducing the problem (313.90 KB, application/octet-stream)
2002-08-26 19:44 UTC, Owen Taylor
no flags Details

Description Owen Taylor 2002-08-26 19:26:07 UTC
If you run 

 /usr/sbin/prelink -u 

On the attached binary, prelink segfaults almost immediately.
It's before it reads any other files, so I suspect it
will be reproducable.

I'm not sure if the binary is corrupt or not; if it is
corrupt, that's another prelink bug, but I can't give
a reproduction sequence, I'm afraid. It was something

 prelink -a -v
 prelink -a -u -v
 prelink /usr/bin/gnome-terminal
 [ upgrade openssl, which is indirectly pulled in by gnome-terminal ]
 prelink -a -u

With gnome-terminal and libraries mostly from the 
Milan tree.

Comment 1 Owen Taylor 2002-08-26 19:44:55 UTC
Created attachment 73164 [details]
gnome-terminal binary reproducing the problem

Comment 2 Jakub Jelinek 2002-08-27 07:18:13 UTC
The binary is in fact broken, sh_link member of .gnu.liblist Shdr has
completely bogus value. Not segfaulting on it will be trivial, will try to
look where it might come from too.

Comment 3 Jakub Jelinek 2002-08-27 14:59:13 UTC
--- exec.c~     2002-08-27 16:35:51.000000000 +0200
+++ exec.c      2002-08-27 16:35:51.000000000 +0200
@@ -793,7 +793,7 @@ prelink_exec (struct prelink_info *info)
       Elf_Data *data;

-       = new_dynstr ? new[new_dynstr] : move->old_to_new[dynstrndx];
+       = new_dynstr != -1 ? new[new_dynstr] : move->old_to_new[dynstrndx];
       data = elf_getdata (dso->scn[i], NULL);
       data->d_type = ELF_T_WORD;
       data->d_size = (ndeps - 1) * sizeof (Elf32_Lib);

seems like the candidate why sh_link was garbage (new[-1]).
I've added checks so that prelink -u wouldn't segfault on bogus sh_link or
sh_info fields too.
Will be soon in prelink-0.2.0-8.

Comment 4 Bill Nottingham 2003-08-29 20:31:42 UTC
Assuming fixed in current versions.

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