kmod: let kernel apply TAINT_LIVEPATCH

Upstream commit 2992ef29ae01 ("livepatch/module: make TAINT_LIVEPATCH
module-specific") v4.9+ modified the kernel to add the TAINT_LIVEPATCH
flag on module load.  To support this feature, add the "livepatch"
module info in the {k,live}patch modules and drop the add_taint() in the
core module.
This commit is contained in:
Joe Lawrence 2017-01-11 11:15:03 -05:00
parent 23bc1bc93d
commit e7937196b7
3 changed files with 15 additions and 0 deletions

View File

@ -1008,9 +1008,22 @@ int kpatch_register(struct kpatch_module *kpmod, bool replace)
func->op = KPATCH_OP_NONE;
} while_for_each_linked_func();
/* HAS_MODULE_TAINT - upstream 2992ef29ae01 "livepatch/module: make TAINT_LIVEPATCH module-specific" */
#ifdef RHEL_RELEASE_CODE
# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 4)
# define HAS_MODULE_TAINT
# endif
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
# define HAS_MODULE_TAINT
#endif
#ifdef TAINT_LIVEPATCH
# ifdef HAS_MODULE_TAINT
/* kernel will add TAINT_LIVEPATCH on module load. */
# else
pr_notice_once("tainting kernel with TAINT_LIVEPATCH\n");
add_taint(TAINT_LIVEPATCH, LOCKDEP_STILL_OK);
# endif
#else
pr_notice_once("tainting kernel with TAINT_USER\n");
add_taint(TAINT_USER, LOCKDEP_STILL_OK);

View File

@ -420,3 +420,4 @@ static void __exit patch_exit(void)
module_init(patch_init);
module_exit(patch_exit);
MODULE_LICENSE("GPL");
MODULE_INFO(livepatch, "Y");

View File

@ -315,3 +315,4 @@ static void __exit patch_exit(void)
module_init(patch_init);
module_exit(patch_exit);
MODULE_LICENSE("GPL");
MODULE_INFO(livepatch, "Y");