Re: [PATCH] powerpc: Avoid code patching freed init sections

2018-09-10 Thread Paul Mackerras
On Mon, Sep 10, 2018 at 08:05:38PM +1000, Michael Neuling wrote: > > > > + /* Make sure we aren't patching a freed init section */ > > > + if (in_init_section(patch_addr) && init_freed()) > > > + return 0; > > > + > > > > Do we even need the init_freed() check? > > Maybe not. If

Re: [PATCH] powerpc: Avoid code patching freed init sections

2018-09-10 Thread Michal Suchánek
On Mon, 10 Sep 2018 12:16:35 +0200 Christophe LEROY wrote: > Le 10/09/2018 à 12:05, Michael Neuling a écrit : > > > >>> + /* Make sure we aren't patching a freed init section */ > >>> + if (in_init_section(patch_addr) && init_freed()) > >>> + return 0; > >>> + > >> > >> Do we even

Re: [PATCH] powerpc: Avoid code patching freed init sections

2018-09-10 Thread Christophe LEROY
Le 10/09/2018 à 12:05, Michael Neuling a écrit : + /* Make sure we aren't patching a freed init section */ + if (in_init_section(patch_addr) && init_freed()) + return 0; + Do we even need the init_freed() check? Maybe not. If userspace isn't up, then maybe

Re: [PATCH] powerpc: Avoid code patching freed init sections

2018-09-10 Thread Michael Neuling
> > + /* Make sure we aren't patching a freed init section */ > > + if (in_init_section(patch_addr) && init_freed()) > > + return 0; > > + > > Do we even need the init_freed() check? Maybe not. If userspace isn't up, then maybe it's ok to skip. > What user input can we process

Re: [PATCH] powerpc: Avoid code patching freed init sections

2018-09-10 Thread Michael Neuling
> > For stable I've marked this as v4.13+ since that's when we refactored > > code-patching.c but it could go back even further than that. In > > reality though, I think we can only hit this since the first > > spectre/meltdown changes. > > Which means it affects all maintained stable trees

Re: [PATCH] powerpc: Avoid code patching freed init sections

2018-09-10 Thread Michal Suchánek
On Mon, 10 Sep 2018 15:44:05 +1000 Michael Neuling wrote: > This stops us from doing code patching in init sections after they've > been freed. > > In this chain: > kvm_guest_init() -> > kvm_use_magic_page() -> > fault_in_pages_readable() -> >__get_user() -> >

Re: [PATCH] powerpc: Avoid code patching freed init sections

2018-09-10 Thread Michal Suchánek
On Mon, 10 Sep 2018 15:44:05 +1000 Michael Neuling wrote: > This stops us from doing code patching in init sections after they've > been freed. > > In this chain: > kvm_guest_init() -> > kvm_use_magic_page() -> > fault_in_pages_readable() -> >__get_user() -> >