Skip to content

add livepatch API support#477

Merged
jpoimboe merged 4 commits intodynup:masterfrom
sjenning:compat2
Jan 22, 2015
Merged

add livepatch API support#477
jpoimboe merged 4 commits intodynup:masterfrom
sjenning:compat2

Conversation

@sjenning
Copy link
Contributor

Adds a new patch module scaffold for use when building against a kernel
with CONFIG_LIVE_PATCHING=y.

Fixes issue #476

Signed-off-by: Seth Jennings [email protected]

Adds a new patch module scaffold for use when building against a kernel
with CONFIG_LIVE_PATCHING=y.

Signed-off-by: Seth Jennings <[email protected]>
@jpoimboe
Copy link
Member

YES!

@jpoimboe
Copy link
Member

This is awesome (see animated gif ;-)

The scaffolding is ok for now. Hopefully we can eventually figure out a way to build the klp_patch struct at build time instead of run time, so that the patch template can be nice and lean. We might need to add more intelligence to the linking step somehow.

I'll add some code comments inline.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the scaffolding, there are three different structure "languages" being used: kpatch-build, scaffolding, and klp. It kind of threw me for a loop when trying to read this code. It would be easier to follow if the same variable, struct, and function naming conventions were used consistently throughout the entire file. Something like:

  • for kpatch-build: kpatch/kobject/kreloc/kfunc
  • for temporary scaffolding: tpatch/tobject/treloc/tfunc (or spatch/sobject/sreloc/sfunc)
  • for klp: lpatch/lobject/lreloc/tfunc

And also maybe a comment describing the fact that there are three languages and the different naming conventions.

@jpoimboe
Copy link
Member

end comments

Signed-off-by: Seth Jennings <[email protected]>
@sjenning
Copy link
Contributor Author

Regarding making the klp_patch structure at build time, I think that would be quite an undertaking. You'd need a separate program to read in the all the kpatch sections from all of the changed objects, create the section that contains the klp_patch structure, and exclude the (now temporary) kpatch section from the final linking. I'm pretty confident that it would be more code than this scaffold.

@jpoimboe
Copy link
Member

I agree it would be more code than this, but I don't think it would be too bad. It could come along after ld has done its work. That way it would only have to read output.o instead of all the objects.

It would have the benefit of vastly simplifying the patch template code, and build time complexity is much better than run time complexity IMO.

@jpoimboe
Copy link
Member

Or it might even be possible to implement it in the linker script... that would be ideal.

@jpoimboe
Copy link
Member

Looks good. One more comment: The global patch should be lpatch, and doesn't need to be global.

I still need to do some testing with it.

@jpoimboe
Copy link
Member

We also need to update the kpatch script to work with both (can use a separate GH issue to track that)

@sjenning
Copy link
Contributor Author

new "add naming" commit renames patch to lpatch. it does need to be global though for unregister in patch_exit()

jpoimboe added a commit that referenced this pull request Jan 22, 2015
@jpoimboe jpoimboe merged commit ac7ddc5 into dynup:master Jan 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants