aboutsummaryrefslogtreecommitdiff
path: root/include/linux/livepatch.h
AgeCommit message (Collapse)AuthorFilesLines
2015-05-19livepatch: introduce patch/func-walking helpersJiri Slaby1-0/+6
klp_for_each_object and klp_for_each_func are now used all over the code. One need not think what is the proper condition to check in the for loop now. Signed-off-by: Jiri Slaby <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
2015-05-19livepatch: make kobject in klp_object statically allocatedMiroslav Benes1-1/+1
Make kobj variable (of type struct kobject) statically allocated in klp_object structure. It will allow us to move in the func-object-patch hierarchy through kobject links. The only reason to have it dynamic was to not have empty release callback in the code. However we have empty callbacks for function and patch in the code now, so it is no longer valid and the advantage of static allocation is clear. Signed-off-by: Miroslav Benes <[email protected]> Signed-off-by: Jiri Slaby <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
2015-02-18livepatch: remove extern specifier from header filesMiroslav Benes1-4/+4
Storage-class specifier 'extern' is redundant in front of the function declaration. According to the C specification it has the same meaning as if not present at all. So remove it. Signed-off-by: Miroslav Benes <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Reviewed-by: Masami Hiramatsu <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
2015-02-04livepatch: rename config to CONFIG_LIVEPATCHJosh Poimboeuf1-2/+2
Rename CONFIG_LIVE_PATCHING to CONFIG_LIVEPATCH to make the naming of the config and the code more consistent. Signed-off-by: Josh Poimboeuf <[email protected]> Reviewed-by: Jingoo Han <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
2015-01-20livepatch: support for repatching a functionJosh Poimboeuf1-2/+2
Add support for patching a function multiple times. If multiple patches affect a function, the function in the most recently enabled patch "wins". This enables a cumulative patch upgrade path, where each patch is a superset of previous patches. This requires restructuring the data a little bit. With the current design, where each klp_func struct has its own ftrace_ops, we'd have to unregister the old ops and then register the new ops, because FTRACE_OPS_FL_IPMODIFY prevents us from having two ops registered for the same function at the same time. That would leave a regression window where the function isn't patched at all (not good for a patch upgrade path). This patch replaces the per-klp_func ftrace_ops with a global klp_ops list, with one ftrace_ops per original function. A single ftrace_ops is shared between all klp_funcs which have the same old_addr. This allows the switch between function versions to happen instantaneously by updating the klp_ops struct's func_stack list. The winner is the klp_func at the top of the func_stack (front of the list). [ [email protected]: turn WARN_ON() into WARN_ON_ONCE() in ftrace handler to avoid storm in pathological cases ] Signed-off-by: Josh Poimboeuf <[email protected]> Reviewed-by: Jiri Slaby <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
2014-12-22livepatch: kernel: add support for live patchingSeth Jennings1-0/+133
This commit introduces code for the live patching core. It implements an ftrace-based mechanism and kernel interface for doing live patching of kernel and kernel module functions. It represents the greatest common functionality set between kpatch and kgraft and can accept patches built using either method. This first version does not implement any consistency mechanism that ensures that old and new code do not run together. In practice, ~90% of CVEs are safe to apply in this way, since they simply add a conditional check. However, any function change that can not execute safely with the old version of the function can _not_ be safely applied in this version. [ [email protected]: due to the number of contributions that got folded into this original patch from Seth Jennings, add SUSE's copyright as well, as discussed via e-mail ] Signed-off-by: Seth Jennings <[email protected]> Signed-off-by: Josh Poimboeuf <[email protected]> Reviewed-by: Miroslav Benes <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Reviewed-by: Masami Hiramatsu <[email protected]> Signed-off-by: Miroslav Benes <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>