Re: [PATCH 1/7] livepatch: Apply vmlinux-specific KLP relocations early

From: Josh Poimboeuf
Date: Wed Apr 15 2020 - 12:30:29 EST


On Wed, Apr 15, 2020 at 04:34:26PM +0200, Miroslav Benes wrote:
> Just a nit below
>
> > diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h
> > index e894e74905f3..d9e9b76f6054 100644
> > --- a/include/linux/livepatch.h
> > +++ b/include/linux/livepatch.h
> > @@ -234,14 +234,30 @@ void klp_shadow_free_all(unsigned long id, klp_shadow_dtor_t dtor);
> > struct klp_state *klp_get_state(struct klp_patch *patch, unsigned long id);
> > struct klp_state *klp_get_prev_state(unsigned long id);
> >
> > +int klp_write_relocations(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
> > + const char *shstrtab, const char *strtab,
> > + unsigned int symindex, struct module *pmod,
> > + const char *objname);
> > +
> > #else /* !CONFIG_LIVEPATCH */
> >
> > +struct klp_object;
> > +
>
> Is the forward declaration necessary here?

Apparently not, that was leftover from a previous iteration...

> > static inline int klp_module_coming(struct module *mod) { return 0; }
> > static inline void klp_module_going(struct module *mod) {}
> > static inline bool klp_patch_pending(struct task_struct *task) { return false; }
> > static inline void klp_update_patch_state(struct task_struct *task) {}
> > static inline void klp_copy_process(struct task_struct *child) {}
> >
> > +static inline
> > +int klp_write_relocations(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
> > + const char *shstrtab, const char *strtab,
> > + unsigned int symindex, struct module *pmod,
> > + const char *objname)
> > +{
> > + return 0;
> > +}
> > +
> > #endif /* CONFIG_LIVEPATCH */
>
> Miroslav
>

--
Josh