Conversation
|
Added a new commit to update the comments to hopefully make them clearer. |
kmod/core/core.c
Outdated
There was a problem hiding this comment.
this seems like the perfect place for RCU with reads (gets) being frequent and updates being infrequent (create/destroy). can we use RCU instead of the lock?
|
I'm not able to build with this patch on this branch; Tried this on EL7, as well as a freshly updated FC20 image. Any ideas? I threw a |
3fd07fa to
bf7456c
Compare
|
Rebased the commit based on review comments:
|
|
Added a commit which converts the locking to RCU. |
5b93d91 to
3007e94
Compare
|
Rebased the RCU commit to have proper locking (based on our IRC discussion) |
This adds support for shadow variables, which allow you to add new "shadow" fields to existing data structures. To allow patches to call the shadow functions in the core module, I had to add a funky hack to use --warn-unresolved-symbols when linking, which allows the patched vmlinux to link with the missing symbols. I also added greps to the log file to ensure that only unresolved symbols to kpatch_shadow_* are allowed. We can remove this hack once the core module gets moved into the kernel tree. Fixes dynup#314.
3007e94 to
4dee892
Compare
|
Rebased and squashed with more RCU fixes as discussed on IRC, as well as moving the shadow code out into its own .c file. |
add support for shadow variables
This adds support for shadow variables, which allow you to add new
"shadow" fields to existing data structures.
NOTICE: To use this feature, you have to tell kpatch-build exactly which
object files are affected by using the -t option. For example, if the
patch modifies fs/proc/array.c, kernel/exit.c, and kernel/fork.c:
This limitation is caused by the fact that the kpatch core module
(kpatch.ko) is a module, so the link step of the patched kernel fails
when it can't link to the kpatch_shadow_* functions. If the core module
gets statically compiled into the kernel, this limitation goes away.
Fixes #314.
It works with the following test patch:
With the following arguments to kpatch-build:
With this patch loaded, any new tasks get a new "newpid" field which can be seen in
/proc/<pid>/status.