From: Christophe LEROY <christophe.leroy@c-s.fr>
To: Andreas Schwab <schwab@linux-m68k.org>,
Michael Neuling <mikey@neuling.org>
Cc: "Michal Suchánek" <msuchanek@suse.de>,
linuxppc-dev@lists.ozlabs.org,
"Haren Myneni" <haren@linux.vnet.ibm.com>,
"Nicholas Piggin" <npiggin@gmail.com>
Subject: Re: [PATCH] powerpc: use PTRRELOC during early init
Date: Wed, 3 Oct 2018 08:22:08 +0200 [thread overview]
Message-ID: <acfeead1-90f9-d13c-41f2-e4bdd38e3702@c-s.fr> (raw)
In-Reply-To: <87wor09dww.fsf_-_@igel.home>
Hi Andreas,
Le 03/10/2018 à 00:33, Andreas Schwab a écrit :
> 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)) {
That's not the best solution. In the past we already did our best to
separate early use of patch_instruction() , that's how
raw_patch_instruction() was born, see
https://patchwork.ozlabs.org/patch/840974/
Here, it idea is similar, this test should not apply to
raw_patch_instruction()
Did you try my proposed fix https://patchwork.ozlabs.org/patch/977195/ ?
Christophe
> pr_debug("Skipping init section patching addr: 0x%px\n", exec_addr);
> return 0;
> }
>
next prev parent reply other threads:[~2018-10-03 6:43 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 ` [PATCH] powerpc: use PTRRELOC during early init Andreas Schwab
2018-10-03 6:22 ` Christophe LEROY [this message]
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=acfeead1-90f9-d13c-41f2-e4bdd38e3702@c-s.fr \
--to=christophe.leroy@c-s.fr \
--cc=haren@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=msuchanek@suse.de \
--cc=npiggin@gmail.com \
--cc=schwab@linux-m68k.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).