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

From: Paul Mackerras <[email-masked]>
Date: Tue, 11 Sep 2018 08:38:06 +1000

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 userspace isn't up, then maybe it's ok to skip.

Isn't this same function used for patching asm feature sections?  It's
not OK to skip patching them in init code.

> > What user input can we process in init-only code?
> 
> See the stack trace in the commit message. It's a weird case for KVM guests in
> KVM PR mode. 

The fault_in_pages_readable (formerly __get_user) there isn't actually
reading userspace, it's just a way of doing a load with a convenient
way to handle it if it traps.

Paul.