linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sergei.shtylyov@cogentembedded.com (Sergei Shtylyov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] recordmcount: fix endianness handling bug for nop_mcount
Date: Fri, 30 Oct 2015 17:35:17 +0300	[thread overview]
Message-ID: <56338025.3060602@cogentembedded.com> (raw)
In-Reply-To: <1446193864-24593-2-git-send-email-huawei.libin@huawei.com>

Hello.

On 10/30/2015 11:31 AM, Li Bin wrote:

> 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 | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
> index 49b582a..dda9dba 100644
> --- a/scripts/recordmcount.h
> +++ b/scripts/recordmcount.h
> @@ -376,8 +376,9 @@ static void nop_mcount(Elf_Shdr const *const relhdr,
>   			mcountsym = get_mcountsym(sym0, relp, str0);
>
>   		if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
> -			if (make_nop)
> -				ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
> +			if (make_nop) {
> +				ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset));
> +			}

    {} not needed here.

MBR, Sergei

  parent reply	other threads:[~2015-10-30 14:35 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 [this message]
2015-10-31  2:07     ` libin
2015-11-02 19:33       ` Steven Rostedt
2015-11-03  0:58         ` [PATCH] " libin
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=56338025.3060602@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.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).