Re: [PATCH v4 06/10] x86/alternative: use temporary mm for text poking

From: Peter Zijlstra
Date: Sun Nov 11 2018 - 19:36:51 EST


On Mon, Nov 12, 2018 at 12:52:20AM +0100, Peter Zijlstra wrote:
> On Sun, Nov 11, 2018 at 08:53:07PM +0000, Nadav Amit wrote:
>
> > >> + /*
> > >> + * The lock is not really needed, but this allows to avoid open-coding.
> > >> + */
> > >> + ptep = get_locked_pte(poking_mm, poking_addr, &ptl);
> > >> +
> > >> + /*
> > >> + * If we failed to allocate a PTE, fail. This should *never* happen,
> > >> + * since we preallocate the PTE.
> > >> + */
> > >> + if (WARN_ON_ONCE(!ptep))
> > >> + goto out;
> > >
> > > Since we hard rely on init getting that right; can't we simply get rid
> > > of this?

> > If it is about the way the source code looks - I guess it doesnât sore my
> > eyes as hard as some other stuff, and I cannot do much about it (other than
> > removing it as you asked).

FWIW per the same argument we should be checking if poking_mm is !NULL.
We also don't do that.