Re: [PATCH 2/2] kernel: add support for live patching

From: Josh Poimboeuf
Date: Thu Nov 06 2014 - 11:32:49 EST


On Thu, Nov 06, 2014 at 10:20:49AM -0600, Seth Jennings wrote:
> On Thu, Nov 06, 2014 at 04:11:37PM +0100, Jiri Kosina wrote:
> > On Thu, 6 Nov 2014, Seth Jennings wrote:
> > > +/****************************************
> > > + * dynamic relocations (load-time linker)
> > > + ****************************************/
> > > +
> > > +/*
> > > + * external symbols are located outside the parent object (where the parent
> > > + * object is either vmlinux or the kmod being patched).
> > > + */
> >
> > I have no ideas what dynrela is, and quickly reading the source doesn't
> > really help too much.
> >
> > Could you please provide some explanation / pointer to some documentation,
> > explaining what exactly it is, and why should it be part of the common
> > infrastructure?
>
> Yes, I should explain it.
>
> This is something that is currently only used in the kpatch approach.
> It allows the patching core to do dynamic relocations on the new
> function code, similar to what the kernel module linker does, but this
> works for non-exported symbols as well.
>
> This is so the patch module doesn't have to do a kallsyms lookup on
> every non-exported symbol that the new functions use.
>
> The fields of the dynrela structure are those of a normal ELF rela
> entry, except for the "external" field, which conveys information about
> where the core module should go looking for the symbol referenced in the
> dynrela entry.

BTW, use of the dynrelas is optional, but highly recommended. The
kGraft approach of manually doing a kallsyms lookup for each
non-exported symbol is inherently dangerous because of duplicate
symbols.

--
Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/