[PATCH] powerpc: Avoid code patching freed init sections

Michal Suchánek msuchanek at suse.de
Mon Sep 10 20:44:08 AEST 2018


On Mon, 10 Sep 2018 12:16:35 +0200
Christophe LEROY <christophe.leroy at c-s.fr> 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 need the init_freed() check?  
> > 
> > Maybe not.  If userspace isn't up, then maybe it's ok to skip.  
> 
> Euh ... Do you mean you'll skip all patches into init functions ?
> But code patching is not only for meltdown/spectrum workarounds, some
> of the patchings might be needed for the init functions themselves.

Some stuff like cpu feature tests have an early variant that does not
need patching but maybe not everything has.

and some stuff like lwsync might be also expanded from some macros or
inlines and may be needed in the init code. It might be questionable to
rely on it getting patched, though. Hard to tell without seeing what is
actually patched where.

Thanks

Michal


More information about the Linuxppc-dev mailing list