[PATCH 1/6] powerpc/code-patching: Implement generic text patching function

Benjamin Gray bgray at linux.ibm.com
Tue Sep 20 11:49:52 AEST 2022


On Mon, 2022-09-19 at 06:38 +0000, Christophe Leroy wrote:
> Le 16/09/2022 à 08:23, Benjamin Gray a écrit :
> > [...]
> > +       /* Make sure we aren't patching a freed init section */
> > +       if (static_branch_likely(&init_mem_is_free) &&
> > init_section_contains(dest, 4))
> > +               return 0;
> > +
> >         if (!static_branch_likely(&poking_init_done))
> > -               return raw_patch_instruction(addr, instr);
> > +               return __patch_text(dest, src, size, is_exec,
> > dest);
> >   
> 
> Test ordering looks odd. How can init_mem_is_free be true and 
> poking_init_done be false ?
> > 
That's just the flattened result of the original STRICT_KERNEL_RWX case
(as I hadn't tested building with it disabled).

With the build fixed for v2, the structure is similar to the original
the second check is not performed if CONFIG_STRICT_KERNEL_RWX is
disabled.
> 


More information about the Linuxppc-dev mailing list