linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: huawei.libin@huawei.com (libin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] recordmcount: fix endianness handling bug for nop_mcount
Date: Tue, 3 Nov 2015 08:58:47 +0800	[thread overview]
Message-ID: <563806C7.7070606@huawei.com> (raw)
In-Reply-To: <20151102143324.071eee7e@gandalf.local.home>

In nop_mcount, shdr->sh_offset and welp->r_offset should handle
endianness properly, otherwise it will trigger Segmentation fault
if the recordmcount main and file.o have different endianness.

Cc: <stable@vger.kernel.org> # 3.0+
Signed-off-by: Li Bin <huawei.libin@huawei.com>
---
 scripts/recordmcount.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 49b582a..b9897e2 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -377,7 +377,7 @@ static void nop_mcount(Elf_Shdr const *const relhdr,

 		if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
 			if (make_nop)
-				ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
+				ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset));
 			if (warn_on_notrace_sect && !once) {
 				printf("Section %s has mcount callers being ignored\n",
 				       txtname);
-- 
1.7.1

  reply	other threads:[~2015-11-03  0:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30  8:31 [PATCH 0/3] recordmcount: bugfix and amend Li Bin
2015-10-30  8:31 ` [PATCH 1/3] recordmcount: fix endianness handling bug for nop_mcount Li Bin
2015-10-30  8:45   ` libin
2015-10-30 14:35   ` Sergei Shtylyov
2015-10-31  2:07     ` libin
2015-11-02 19:33       ` Steven Rostedt
2015-11-03  0:58         ` libin [this message]
2015-10-30  8:31 ` [PATCH 2/3] recordmcount: x86: assign a meaningful value to rel_type_nop Li Bin
2015-10-30  8:31 ` [PATCH 3/3] recordmcount: arm64: replace the ignored mcount call into nop Li Bin
2015-10-30  8:44   ` libin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=563806C7.7070606@huawei.com \
    --to=huawei.libin@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).