lkml.org 
[lkml]   [2019]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 2/2] livepatch: Clear relocation targets on a module removal
On Thu, Sep 05, 2019 at 08:08:32AM -0500, Josh Poimboeuf wrote:
> On Thu, Sep 05, 2019 at 01:09:55PM +0200, Petr Mladek wrote:
> > > I don't have a number, but it's very common to patch a function which
> > > uses jump labels or alternatives.
> >
> > Really? My impression is that both alternatives and jump_labels
> > are used in hot paths. I would expect them mostly in core code
> > that is always loaded.
> >
> > Alternatives are often used in assembly that we are not able
> > to livepatch anyway.
> >
> > Or are they spread widely via some macros or inlined functions?
>
> Jump labels are used everywhere. Looking at vmlinux.o in my kernel:
>
> Relocation section [19621] '.rela__jump_table' for section [19620] '__jump_table' at offset 0x197873c8 contains 11913 entries:
>
> Each jump label entry has 3 entries, so 11913/3 = 3971 jump labels.
>
> $ readelf -s vmlinux.o |grep FUNC |wc -l
> 46902
>
> 3971/46902 = ~8.5%
>
> ~8.5% of functions use jump labels.

Obviously some functions may use more than one jump label so this isn't
exactly bulletproof math. But it gives a rough idea of how widespread
they are.

>
> > > > + How often new problematic features appear?
> > >
> > > I'm not exactly sure what you mean, but it seems that anytime we add a
> > > new feature, we have to try to wrap our heads around how it interacts
> > > with the weirdness of late module patching.
> >
> > I agree that we need to think about it and it makes complications.
> > Anyway, I think that these are never the biggest problems.
> >
> > I would be more concerned about arch-specific features that might need
> > special handling in the livepatch code. Everyone talks only about
> > alternatives and jump_labels that were added long time ago.
>
> Jump labels have been around for many years, but we somehow missed
> implementing klp.arch for them. As I said this resulted in panics.
>
> There may be other similar cases lurking, both in x86 and other arches.
> It's not a comforting thought!
>
> And each case requires special klp code in addition to the real code.
>
> --
> Josh

--
Josh

\
 
 \ /
  Last update: 2019-09-05 15:15    [W:0.110 / U:2.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site