linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] scripts/recordmcount.pl: support data in text section on powerpc
@ 2016-01-12 12:14 Michael Ellerman
  2016-01-12 12:14 ` [PATCH 2/2] powerpc/module: Handle R_PPC64_ENTRY relocations Michael Ellerman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michael Ellerman @ 2016-01-12 12:14 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Anton Blanchard, amodra, ulrich.weigand, rostedt

From: Ulrich Weigand <ulrich.weigand@de.ibm.com>

If a text section starts out with a data blob before the first
function start label, disassembly parsing doing in recordmcount.pl
gets confused on powerpc, leading to creation of corrupted module
objects.

This was not a problem so far since the compiler would never create
such text sections.  However, this has changed with a recent change
in GCC 6 to support distances of > 2GB between a function and its
assoicated TOC in the ELFv2 ABI, exposing this problem.

There is already code in recordmcount.pl to handle such data blobs
on the sparc64 platform.  This patch uses the same method to handle
those on powerpc as well.

Cc: stable@vger.kernel.org
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 scripts/recordmcount.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Steve can we get an ack for this one, to go via powerpc? cheers

diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 826470d7f000..96e2486a6fc4 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -263,7 +263,8 @@ if ($arch eq "x86_64") {
 
 } elsif ($arch eq "powerpc") {
     $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)";
-    $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?.*?)>:";
+    # See comment in the sparc64 section for why we use '\w'.
+    $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?\\w*?)>:";
     $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$";
 
     if ($bits == 64) {
-- 
2.5.0

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

end of thread, other threads:[~2016-01-13 13:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-12 12:14 [PATCH 1/2] scripts/recordmcount.pl: support data in text section on powerpc Michael Ellerman
2016-01-12 12:14 ` [PATCH 2/2] powerpc/module: Handle R_PPC64_ENTRY relocations Michael Ellerman
2016-01-13 13:09   ` [2/2] " Michael Ellerman
2016-01-12 15:42 ` [PATCH 1/2] scripts/recordmcount.pl: support data in text section on powerpc Steven Rostedt
2016-01-12 22:43   ` Michael Ellerman
2016-01-13 13:09 ` [1/2] " Michael Ellerman

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 NNTP newsgroup(s).