public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/455] New: ARM profiling fault
@ 2004-10-17  0:39 andy dot andystewart at gmail dot com
  2005-10-10 14:56 ` [Bug libc/455] " drow at sources dot redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: andy dot andystewart at gmail dot com @ 2004-10-17  0:39 UTC (permalink / raw)
  To: glibc-bugs

A segmentation fault occurs when using the -pg profiling options of gcc for ARM targets.  

The problem is due to how a buffer is allocated for profiling samples.  One allocation is made for 
multiple buffers, and the second buffer is not aligned on a 4 byte boundary.  When _mcount is 
subsequently called, an invalid index is read from the unaligned buffer, and _mcount attempts to store 
the profiling data at an invalid address.

Please include the following patches to gmon/gmon.c, elf/dl-profile.c, and elf/sprof.c in the glibc 
component:

--- glibc-2.3.2/gmon/gmon.c	2004-09-25 10:16:24.000000000 -0700
+++ mod_gmon.c	                2004-09-25 10:09:40.000000000 -0700
@@ -113,7 +113,7 @@
   p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
   p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
   p->textsize = p->highpc - p->lowpc;
-  p->kcountsize = p->textsize / HISTFRACTION;
+  p->kcountsize = ((p->textsize / HISTFRACTION) + 3) & ~3;
   p->hashfraction = HASHFRACTION;
   p->log_hashfraction = -1;
   /* The following test must be kept in sync with the corresponding


--- glibc-2.3.2/elf/dl-profile.c	2004-09-25 11:35:11.000000000 -0700
+++ mod-dl-profile.c	                2004-09-25 11:39:40.000000000 -0700
@@ -238,7 +238,7 @@
     }
   else
     log_hashfraction = -1;
-  tossize = textsize / HASHFRACTION;
+  tossize = ((textsize / HASHFRACTION) + 3) & ~3;
   fromlimit = textsize * ARCDENSITY / 100;
   if (fromlimit < MINARCS)
     fromlimit = MINARCS;


--- glibc-2.3.2/elf/sprof.c	2004-09-25 11:52:41.000000000 -0700
+++ mod-sprof.c	                2004-09-25 11:39:06.000000000 -0700
@@ -452,7 +452,7 @@
     printf ("hashfraction = %d\ndivider = %Zu\n",
 	    result->hashfraction,
 	    result->hashfraction * sizeof (struct here_fromstruct));
-  result->tossize = textsize / HASHFRACTION;
+  result->tossize = ((textsize / HASHFRACTION) + 3) & ~3;
   result->fromlimit = textsize * ARCDENSITY / 100;
   if (result->fromlimit < MINARCS)
     result->fromlimit = MINARCS;

-- 
           Summary: ARM profiling fault
           Product: glibc
           Version: 2.3.2
            Status: NEW
          Severity: critical
          Priority: P1
         Component: libc
        AssignedTo: gotom at debian dot or dot jp
        ReportedBy: andy dot andystewart at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: Red Hat i386 Linux
  GCC host triplet: ARM Linux
GCC target triplet: ARM Linux


http://sources.redhat.com/bugzilla/show_bug.cgi?id=455

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/455] ARM profiling fault
  2004-10-17  0:39 [Bug libc/455] New: ARM profiling fault andy dot andystewart at gmail dot com
@ 2005-10-10 14:56 ` drow at sources dot redhat dot com
  2005-10-15 19:43 ` [Bug ports/455] " drepper at redhat dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: drow at sources dot redhat dot com @ 2005-10-10 14:56 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drow at sources dot redhat dot com  2005-10-10 14:56 -------
The gmon.c change is no longer necessary in CVS, but I'm not sure about the
changes to the two ELF profilers; they probably still are.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=455

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug ports/455] ARM profiling fault
  2004-10-17  0:39 [Bug libc/455] New: ARM profiling fault andy dot andystewart at gmail dot com
  2005-10-10 14:56 ` [Bug libc/455] " drow at sources dot redhat dot com
@ 2005-10-15 19:43 ` drepper at redhat dot com
  2005-10-16  8:12 ` roland at gnu dot org
  2006-10-31 15:02 ` drow at sources dot redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: drepper at redhat dot com @ 2005-10-15 19:43 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libc                        |ports


http://sourceware.org/bugzilla/show_bug.cgi?id=455

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug ports/455] ARM profiling fault
  2004-10-17  0:39 [Bug libc/455] New: ARM profiling fault andy dot andystewart at gmail dot com
  2005-10-10 14:56 ` [Bug libc/455] " drow at sources dot redhat dot com
  2005-10-15 19:43 ` [Bug ports/455] " drepper at redhat dot com
@ 2005-10-16  8:12 ` roland at gnu dot org
  2006-10-31 15:02 ` drow at sources dot redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: roland at gnu dot org @ 2005-10-16  8:12 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|gotom at debian dot or dot  |drow at false dot org
                   |jp                          |
             Status|NEW                         |ASSIGNED


http://sourceware.org/bugzilla/show_bug.cgi?id=455

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug ports/455] ARM profiling fault
  2004-10-17  0:39 [Bug libc/455] New: ARM profiling fault andy dot andystewart at gmail dot com
                   ` (2 preceding siblings ...)
  2005-10-16  8:12 ` roland at gnu dot org
@ 2006-10-31 15:02 ` drow at sources dot redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: drow at sources dot redhat dot com @ 2006-10-31 15:02 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drow at sources dot redhat dot com  2006-10-31 15:02 -------
I was wrong.  The ELF profiler uses __attribute__((packed)) so this problem does
not occur.  Combined with Randolph's fix for gmon, there's nothing left of this bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=455

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

end of thread, other threads:[~2006-10-31 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-17  0:39 [Bug libc/455] New: ARM profiling fault andy dot andystewart at gmail dot com
2005-10-10 14:56 ` [Bug libc/455] " drow at sources dot redhat dot com
2005-10-15 19:43 ` [Bug ports/455] " drepper at redhat dot com
2005-10-16  8:12 ` roland at gnu dot org
2006-10-31 15:02 ` drow at sources dot redhat dot com

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).