diff --git a/kpatch-kmod/base.c b/kpatch-kmod/base.c index cac3344..57f9ee5 100644 --- a/kpatch-kmod/base.c +++ b/kpatch-kmod/base.c @@ -1,3 +1,28 @@ +/* + * kpatch-kmod/base.c + * + * Copyright (C) 2014 Seth Jennings + * Copyright (C) 2013 Josh Poimboeuf + * + * Contains the code for the core kpatch module. This module reads + * information from the hotfix modules, find new patched functions, + * and register those functions in the ftrace handlers the redirects + * the old function call to the new function code. + * + * Each hotfix can contain one or more patched functions. This information + * is contained in the .patches section of the hotfix module. For each + * function patched by the module we must: + * - Call stop_machine + * - Ensure that no execution thread is currently in the function to be + * patched (or has the function in the call stack) + * - Add the new function address to the kpatch_funcs table + * + * After that, each call to the old function calls into kpatch_trampoline() + * which searches for a patched version of the function in the kpatch_funcs + * table. If a patched version is found, the return instruction pointer is + * overwritten to return to the new function. + */ + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include diff --git a/kpatch-kmod/kpatch.h b/kpatch-kmod/kpatch.h index 1d95be3..68cb88e 100644 --- a/kpatch-kmod/kpatch.h +++ b/kpatch-kmod/kpatch.h @@ -1,3 +1,12 @@ +/* + * kpatch.h + * + * Copyright (C) 2014 Seth Jennings + * Copyright (C) 2013 Josh Poimboeuf + * + * Contains the API for the core kpatch module used by the hotfix modules + */ + #ifndef _KPATCH_H_ #define _KPATCH_H_