* Re: [PATCH v4] powerpc: Avoid code patching freed init sections [not found] <20180914011411.3184-1-mikey__14553.8904158913$1536887645$gmane$org@neuling.org> @ 2018-10-02 21:35 ` Andreas Schwab 2018-10-03 1:57 ` Michael Neuling 2018-10-03 3:20 ` Michael Ellerman [not found] ` <871s98av6p.fsf__4781.35763337395$1538516654$gmane$org@igel.home> 1 sibling, 2 replies; 7+ messages in thread From: Andreas Schwab @ 2018-10-02 21:35 UTC (permalink / raw) To: Michael Neuling Cc: Michal Suchánek, linuxppc-dev, Haren Myneni, Nicholas Piggin On Sep 14 2018, Michael Neuling <mikey@neuling.org> wrote: > This stops us from doing code patching in init sections after they've > been freed. This breaks booting on PowerBook6,7, crashing very early. Andreas. -- 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." ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4] powerpc: Avoid code patching freed init sections 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 1 sibling, 0 replies; 7+ messages in thread From: Michael Neuling @ 2018-10-03 1:57 UTC (permalink / raw) To: Andreas Schwab, Christophe Leroy Cc: Michal Suchánek, linuxppc-dev, Haren Myneni, Nicholas Piggin On Tue, 2018-10-02 at 23:35 +0200, Andreas Schwab wrote: > On Sep 14 2018, Michael Neuling <mikey@neuling.org> wrote: > > > This stops us from doing code patching in init sections after they've > > been freed. > > This breaks booting on PowerBook6,7, crashing very early. Sorry, Can you try? http://patchwork.ozlabs.org/patch/977195/ Mikey ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4] powerpc: Avoid code patching freed init sections 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 1 sibling, 1 reply; 7+ messages in thread From: Michael Ellerman @ 2018-10-03 3:20 UTC (permalink / raw) To: Andreas Schwab, Michael Neuling Cc: Michal Suchánek, linuxppc-dev, Haren Myneni, Nicholas Piggin Andreas Schwab <schwab@linux-m68k.org> writes: > On Sep 14 2018, Michael Neuling <mikey@neuling.org> wrote: > >> This stops us from doing code patching in init sections after they've >> been freed. > > This breaks booting on PowerBook6,7, crashing very early. Crud, sorry. My CI setup tests with the mac99 qemu model, but that boots happily, not sure why. cheers ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4] powerpc: Avoid code patching freed init sections 2018-10-03 3:20 ` Michael Ellerman @ 2018-10-03 5:42 ` Christophe LEROY 0 siblings, 0 replies; 7+ messages in thread From: Christophe LEROY @ 2018-10-03 5:42 UTC (permalink / raw) To: Michael Ellerman, Andreas Schwab, Michael Neuling Cc: Michal Suchánek, linuxppc-dev, Nicholas Piggin, Haren Myneni Le 03/10/2018 à 05:20, Michael Ellerman a écrit : > Andreas Schwab <schwab@linux-m68k.org> writes: > >> On Sep 14 2018, Michael Neuling <mikey@neuling.org> wrote: >> >>> This stops us from doing code patching in init sections after they've >>> been freed. >> >> This breaks booting on PowerBook6,7, crashing very early. > > Crud, sorry. > > My CI setup tests with the mac99 qemu model, but that boots happily, not > sure why. Maybe mac99 doesn't use relocation ? The issue is that during early boot, 'init_mem_is_free' is not yet at its definitif address. I sent a fix for it : https://patchwork.ozlabs.org/patch/977195/ Christophe ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <871s98av6p.fsf__4781.35763337395$1538516654$gmane$org@igel.home>]
* [PATCH] powerpc: use PTRRELOC during early init [not found] ` <871s98av6p.fsf__4781.35763337395$1538516654$gmane$org@igel.home> @ 2018-10-02 22:33 ` Andreas Schwab 2018-10-03 6:22 ` Christophe LEROY 0 siblings, 1 reply; 7+ messages in thread From: Andreas Schwab @ 2018-10-02 22:33 UTC (permalink / raw) To: Michael Neuling Cc: Michal Suchánek, linuxppc-dev, Nicholas Piggin, Haren Myneni 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." ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: use PTRRELOC during early init 2018-10-02 22:33 ` [PATCH] powerpc: use PTRRELOC during early init Andreas Schwab @ 2018-10-03 6:22 ` Christophe LEROY 2018-10-03 11:18 ` Andreas Schwab 0 siblings, 1 reply; 7+ messages in thread From: Christophe LEROY @ 2018-10-03 6:22 UTC (permalink / raw) To: Andreas Schwab, Michael Neuling Cc: Michal Suchánek, linuxppc-dev, Haren Myneni, Nicholas Piggin 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; > } > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: use PTRRELOC during early init 2018-10-03 6:22 ` Christophe LEROY @ 2018-10-03 11:18 ` Andreas Schwab 0 siblings, 0 replies; 7+ messages in thread From: Andreas Schwab @ 2018-10-03 11:18 UTC (permalink / raw) To: Christophe LEROY Cc: Michael Neuling, Michal Suchánek, linuxppc-dev, Haren Myneni, Nicholas Piggin On Okt 03 2018, Christophe LEROY <christophe.leroy@c-s.fr> wrote: > Did you try my proposed fix https://patchwork.ozlabs.org/patch/977195/ ? That works as well. Andreas. -- 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." ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-10-03 11:21 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [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 2018-10-03 11:18 ` Andreas Schwab
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).