public inbox for prelink@sourceware.org
 help / color / mirror / Atom feed
* Fix prelink bug with small data on PowerPC
@ 2009-01-15 20:35 Joseph S. Myers
  2009-02-16 15:25 ` Ping " Joseph S. Myers
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph S. Myers @ 2009-01-15 20:35 UTC (permalink / raw)
  To: prelink

This patch fixes a prelinker bug that appears on PowerPC with small
data.

I do not have a reduced testcase for this bug, only a large
filesystem.  The failure involves uninitialized memory reads so
reducing tests is likely to be difficult.

A binary that exemplifies the problem has exactly two copy
relocations:

10017bec R_PPC_COPY        stderr
10017bf0 R_PPC_COPY        optarg

which relate to words in successive sections:

 23 .sbss         00000004  10017bec  10017bec  00007bec  2**2
                  ALLOC
 24 .bss          00000130  10017bf0  10017bf0  00007bec  2**3
                  ALLOC

The logic for handling multiple BSS sections looks for the first copy
relocation, in a sorted list, that is outside the first section.
Because this logic uses > instead of >=, it fails to detect a
relocation pointing immediately after the end of the first section.
In this case, there are no copy relocations pointing later in the
second section, so the loop ends with i == 2 rather than with a break
and then the code starts looking at the uninitialized
cr.rela[i].r_offset value.  The fix simply makes the code use >=.

Please commit if OK.

2009-01-15  Joseph Myers  <joseph@codesourcery.com>

	* src/conflict.c (prelink_build_conflicts): Use >= not > to
	determine whether a relocation points outside the first bss
	section.

Index: src/conflict.c
===================================================================
--- src/conflict.c	(revision 164)
+++ src/conflict.c	(working copy)
@@ -651,7 +651,7 @@
 	{
 	  for (i = 1; i < cr.count; ++i)
 	    if (cr.rela[i].r_offset
-		> dso->shdr[bss1].sh_addr + dso->shdr[bss1].sh_size)
+		>= dso->shdr[bss1].sh_addr + dso->shdr[bss1].sh_size)
 	      break;
 	  if (cr.rela[i].r_offset < dso->shdr[bss2].sh_addr)
 	    {

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Ping Re: Fix prelink bug with small data on PowerPC
  2009-01-15 20:35 Fix prelink bug with small data on PowerPC Joseph S. Myers
@ 2009-02-16 15:25 ` Joseph S. Myers
  2009-03-02 15:21   ` Ping^2 " Joseph S. Myers
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph S. Myers @ 2009-02-16 15:25 UTC (permalink / raw)
  To: prelink

Ping.  This patch <http://sourceware.org/ml/prelink/2009-q1/msg00001.html> 
is pending review.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Ping^2 Re: Fix prelink bug with small data on PowerPC
  2009-02-16 15:25 ` Ping " Joseph S. Myers
@ 2009-03-02 15:21   ` Joseph S. Myers
  2009-04-14 14:44     ` Ping^3 " Joseph S. Myers
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph S. Myers @ 2009-03-02 15:21 UTC (permalink / raw)
  To: prelink

Ping^2.  This patch 
<http://sourceware.org/ml/prelink/2009-q1/msg00001.html> is still pending 
review.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Ping^3 Re: Fix prelink bug with small data on PowerPC
  2009-03-02 15:21   ` Ping^2 " Joseph S. Myers
@ 2009-04-14 14:44     ` Joseph S. Myers
  2009-06-01 14:04       ` Ping^4 " Joseph S. Myers
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph S. Myers @ 2009-04-14 14:44 UTC (permalink / raw)
  To: prelink

Ping^3.  This patch 
<http://sourceware.org/ml/prelink/2009-q1/msg00001.html> is still pending 
review.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Ping^4 Re: Fix prelink bug with small data on PowerPC
  2009-04-14 14:44     ` Ping^3 " Joseph S. Myers
@ 2009-06-01 14:04       ` Joseph S. Myers
  2009-10-12 14:05         ` Ping^5 " Joseph S. Myers
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph S. Myers @ 2009-06-01 14:04 UTC (permalink / raw)
  To: prelink

Ping^4.  This patch 
<http://sourceware.org/ml/prelink/2009-q1/msg00001.html> is still pending 
review.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Ping^5 Re: Fix prelink bug with small data on PowerPC
  2009-06-01 14:04       ` Ping^4 " Joseph S. Myers
@ 2009-10-12 14:05         ` Joseph S. Myers
  2009-10-19 19:07           ` Jakub Jelinek
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph S. Myers @ 2009-10-12 14:05 UTC (permalink / raw)
  To: prelink

Ping^5.  This patch 
<http://sourceware.org/ml/prelink/2009-q1/msg00001.html> is still pending 
review.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Ping^5 Re: Fix prelink bug with small data on PowerPC
  2009-10-12 14:05         ` Ping^5 " Joseph S. Myers
@ 2009-10-19 19:07           ` Jakub Jelinek
  0 siblings, 0 replies; 7+ messages in thread
From: Jakub Jelinek @ 2009-10-19 19:07 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: prelink

On Mon, Oct 12, 2009 at 02:05:13PM +0000, Joseph S. Myers wrote:
> Ping^5.  This patch 
> <http://sourceware.org/ml/prelink/2009-q1/msg00001.html> is still pending 
> review.

Committed, sorry for the delay.  libelf.m4 change as well.

	Jakub

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-10-19 19:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-15 20:35 Fix prelink bug with small data on PowerPC Joseph S. Myers
2009-02-16 15:25 ` Ping " Joseph S. Myers
2009-03-02 15:21   ` Ping^2 " Joseph S. Myers
2009-04-14 14:44     ` Ping^3 " Joseph S. Myers
2009-06-01 14:04       ` Ping^4 " Joseph S. Myers
2009-10-12 14:05         ` Ping^5 " Joseph S. Myers
2009-10-19 19:07           ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).