File livepatch_main.c of Package kernel-livepatch-SLE15_Update_6.11926
/*
* livepatch_main.c - kernel live patch main infrastructure
*
* Copyright (c) 2014 SUSE
* Author: Miroslav Benes <mbenes@suse.cz>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/livepatch.h>
#include <linux/module.h>
#include <linux/types.h>
#include "uname_patch/livepatch_uname.h"
/* Auto expanded KLP_PATCHES_INCLUDES: */
#include "bsc1112544/livepatch_bsc1112544.h"
#include "bsc1119947/livepatch_bsc1119947.h"
#include "bsc1124729/livepatch_bsc1124729.h"
#include "bsc1124734/livepatch_bsc1124734.h"
#include "bsc1126284/livepatch_bsc1126284.h"
#include "bsc1128378/livepatch_bsc1128378.h"
#include "bsc1133191/livepatch_bsc1133191.h"
#include "bsc1135280/livepatch_bsc1135280.h"
#include "bsc1136446/livepatch_bsc1136446.h"
#include "bsc1137597/livepatch_bsc1137597.h"
static struct klp_object objs[] = {
/* Auto expanded KLP_PATCHES_OBJS: */
{
.name = NULL,
.funcs = (struct klp_func[]) {
{ .old_name = "SyS_newuname", .new_func = klp_sys_newuname, },
{ .old_name = "expand_downwards", .new_func = klp_expand_downwards, },
{ .old_name = "follow_page_mask", .new_func = klp_follow_page_mask, },
{ .old_name = "__get_user_pages", .new_func = klp__get_user_pages, },
#if IS_ENABLED(CONFIG_PPC64)
{ .old_name = "__get_user_pages_fast", .new_func = klp__get_user_pages_fast, },
#endif
#if IS_ENABLED(CONFIG_X86_64)
{ .old_name = "gup_pte_range", .new_func = klp_gup_pte_range, },
{ .old_name = "gup_huge_pmd", .new_func = klp_gup_huge_pmd, },
{ .old_name = "gup_huge_pud", .new_func = klp_gup_huge_pud, },
#endif
{ .old_name = "SyS_splice", .new_func = SyS_klp_splice, },
{ .old_name = "SyS_tee", .new_func = SyS_klp_tee, },
{ .old_name = "tcp_sacktag_walk", .new_func = klp_tcp_sacktag_walk, },
{ .old_name = "tcp_fragment", .new_func = klp_tcp_fragment, },
{ .old_name = "__tcp_retransmit_skb", .new_func = klp__tcp_retransmit_skb, },
{ }
}
},
{
.name = "af_alg",
.funcs = (struct klp_func[]) {
{ .old_name = "af_alg_release", .new_func = klp_af_alg_release, },
{ }
}
},
{
.name = "auth_rpcgss",
.funcs = (struct klp_func[]) {
{ .old_name = "svcauth_gss_accept", .new_func = klp_svcauth_gss_accept, },
{ .old_name = "svcauth_gss_release", .new_func = klp_svcauth_gss_release, },
{ }
}
},
{
.name = "fuse",
.funcs = (struct klp_func[]) {
{ .old_name = "fuse_dev_splice_write", .new_func = klp_fuse_dev_splice_write, },
{ }
}
},
{
.name = "kvm",
.funcs = (struct klp_func[]) {
{ .old_name = "kvm_vm_ioctl", .new_func = klp_kvm_vm_ioctl, },
{ }
}
},
#if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT)
{
.name = "kvmgt",
.funcs = (struct klp_func[]) {
{ .old_name = "intel_vgpu_mmap", .new_func = klp_intel_vgpu_mmap, },
{ }
}
},
#endif
#if IS_ENABLED(CONFIG_KVM_INTEL)
{
.name = "kvm_intel",
.funcs = (struct klp_func[]) {
{ .old_name = "free_nested", .new_func = klp_free_nested, },
{ }
}
},
#endif
{
.name = "mwifiex",
.funcs = (struct klp_func[]) {
{ .old_name = "mwifiex_set_mgmt_ies", .new_func = klp_mwifiex_set_mgmt_ies, },
{ .old_name = "mwifiex_update_bss_desc_with_ie", .new_func = klp_mwifiex_update_bss_desc_with_ie, },
{ }
}
},
{
.name = "nfsv4",
.funcs = (struct klp_func[]) {
{ .old_name = "nfs4_callback_compound", .new_func = klp_nfs4_callback_compound, },
{ }
}
},
{
.name = "sunrpc",
.funcs = (struct klp_func[]) {
{ .old_name = "bc_svc_process", .new_func = klp_bc_svc_process, },
{ }
}
},
#if IS_ENABLED(CONFIG_XEN_BLKDEV_FRONTEND)
{
.name = "xen_blkfront",
.funcs = (struct klp_func[]) {
{ .old_name = "blkfront_delay_work", .new_func = klp_blkfront_delay_work, },
{ }
}
},
#endif
{ }
};
static struct klp_patch patch = {
.mod = THIS_MODULE,
.objs = objs,
.replace = true,
};
static int __init klp_patch_init(void)
{
int retval;
pr_info("livepatch: initializing\n");
retval = klp_patch_uname_init();
if (retval)
return retval;
/* Auto expanded KLP_PATCHES_INIT_CALLS: */
retval = livepatch_bsc1112544_init();
if (retval)
goto err_bsc1112544;
retval = livepatch_bsc1119947_init();
if (retval)
goto err_bsc1119947;
retval = livepatch_bsc1124729_init();
if (retval)
goto err_bsc1124729;
retval = livepatch_bsc1124734_init();
if (retval)
goto err_bsc1124734;
retval = livepatch_bsc1126284_init();
if (retval)
goto err_bsc1126284;
retval = livepatch_bsc1128378_init();
if (retval)
goto err_bsc1128378;
retval = livepatch_bsc1133191_init();
if (retval)
goto err_bsc1133191;
retval = livepatch_bsc1135280_init();
if (retval)
goto err_bsc1135280;
retval = livepatch_bsc1136446_init();
if (retval)
goto err_bsc1136446;
retval = livepatch_bsc1137597_init();
if (retval)
goto err_bsc1137597;
#ifndef KLP_NOREG_API
retval = klp_register_patch(&patch);
if (retval)
goto err_patches_cleanup;
#endif
retval = klp_enable_patch(&patch);
if (!retval)
return retval;
#ifndef KLP_NOREG_API
WARN_ON(klp_unregister_patch(&patch));
#endif
err_patches_cleanup:
/* Auto expanded KLP_PATCHES_INIT_ERR_HANDLERS: */
livepatch_bsc1137597_cleanup();
err_bsc1137597:
livepatch_bsc1136446_cleanup();
err_bsc1136446:
livepatch_bsc1135280_cleanup();
err_bsc1135280:
livepatch_bsc1133191_cleanup();
err_bsc1133191:
livepatch_bsc1128378_cleanup();
err_bsc1128378:
livepatch_bsc1126284_cleanup();
err_bsc1126284:
livepatch_bsc1124734_cleanup();
err_bsc1124734:
livepatch_bsc1124729_cleanup();
err_bsc1124729:
livepatch_bsc1119947_cleanup();
err_bsc1119947:
livepatch_bsc1112544_cleanup();
err_bsc1112544:
return retval;
}
static void __exit klp_patch_cleanup(void)
{
pr_info("livepatch: removed\n");
/* Auto expanded KLP_PATCHES_CLEANUP_CALLS: */
livepatch_bsc1112544_cleanup();
livepatch_bsc1119947_cleanup();
livepatch_bsc1124729_cleanup();
livepatch_bsc1124734_cleanup();
livepatch_bsc1126284_cleanup();
livepatch_bsc1128378_cleanup();
livepatch_bsc1133191_cleanup();
livepatch_bsc1135280_cleanup();
livepatch_bsc1136446_cleanup();
livepatch_bsc1137597_cleanup();
#ifndef KLP_NOREG_API
WARN_ON(klp_unregister_patch(&patch));
#endif
}
module_init(klp_patch_init);
module_exit(klp_patch_cleanup);
MODULE_LICENSE("GPL");
MODULE_INFO(livepatch, "Y");