All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Michael Neuling <mikey@neuling.org>
Cc: "Michal Suchánek" <msuchanek@suse.de>,
	linuxppc-dev@lists.ozlabs.org,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Haren Myneni" <haren@linux.vnet.ibm.com>
Subject: [PATCH] powerpc: use PTRRELOC during early init
Date: Wed, 03 Oct 2018 00:33:51 +0200	[thread overview]
Message-ID: <87wor09dww.fsf_-_@igel.home> (raw)
In-Reply-To: <871s98av6p.fsf__4781.35763337395$1538516654$gmane$org@igel.home> (Andreas Schwab's message of "Tue, 02 Oct 2018 23:35:26 +0200")

This fixes a crash on powerpc32 when using global data during early init
without relocating its address.

Fixes: 51c3c62b58 (powerpc: Avoid code patching freed init sections)
Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
---
 arch/powerpc/lib/code-patching.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index 6ae2777c22..6192fdae36 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -29,7 +29,7 @@ static int __patch_instruction(unsigned int *exec_addr, unsigned int instr,
 	int err;
 
 	/* Make sure we aren't patching a freed init section */
-	if (init_mem_is_free && init_section_contains(exec_addr, 4)) {
+	if (*PTRRELOC(&init_mem_is_free) && init_section_contains(exec_addr, 4)) {
 		pr_debug("Skipping init section patching addr: 0x%px\n", exec_addr);
 		return 0;
 	}
-- 
2.19.0

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

  parent reply	other threads:[~2018-10-02 22:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180914011411.3184-1-mikey__14553.8904158913$1536887645$gmane$org@neuling.org>
2018-10-02 21:35 ` [PATCH v4] powerpc: Avoid code patching freed init sections Andreas Schwab
2018-10-03  1:57   ` Michael Neuling
2018-10-03  3:20   ` Michael Ellerman
2018-10-03  5:42     ` Christophe LEROY
     [not found] ` <871s98av6p.fsf__4781.35763337395$1538516654$gmane$org@igel.home>
2018-10-02 22:33   ` Andreas Schwab [this message]
2018-10-03  6:22     ` [PATCH] powerpc: use PTRRELOC during early init Christophe LEROY
2018-10-03 11:18       ` Andreas Schwab

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=87wor09dww.fsf_-_@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=haren@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=msuchanek@suse.de \
    --cc=npiggin@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.