/* * livepatch_main.c - kernel live patch main infrastructure * * Copyright (c) 2014 SUSE * Author: Miroslav Benes * * 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 . */ #include #include #include #include "uname_patch/livepatch_uname.h" /* Auto expanded KLP_PATCHES_INCLUDES: */ #include "bsc1255052/livepatch_bsc1255052.h" #include "bsc1255053/livepatch_bsc1255053.h" #include "bsc1255378/livepatch_bsc1255378.h" #include "bsc1255402/livepatch_bsc1255402.h" #include "bsc1255895/livepatch_bsc1255895.h" #include "bsc1256624/livepatch_bsc1256624.h" #include "bsc1256644/livepatch_bsc1256644.h" #include "bsc1256780/livepatch_bsc1256780.h" #include "bsc1257238/livepatch_bsc1257238.h" #include "bsc1258051/livepatch_bsc1258051.h" #include "bsc1258183/livepatch_bsc1258183.h" #include "bsc1258784/livepatch_bsc1258784.h" #include "bsc1259859/livepatch_bsc1259859.h" static struct klp_object objs[] = { /* Auto expanded KLP_PATCHES_OBJS: */ { .name = NULL, .funcs = (struct klp_func[]) { { .old_name = __stringify(KLP_SYSCALL_SYM(newuname)), .new_func = KLP_SYSCALL_SYM(klp_newuname), }, #ifdef KLP_ARCH_HAS_SYSCALL_COMPAT_STUBS { .old_name = __stringify(KLP_SYSCALL_COMPAT_STUB_SYM(newuname)), .new_func = KLP_SYSCALL_COMPAT_STUB_SYM(klp_newuname), }, #endif { .old_name = __stringify(unix_add_edges), .new_func = klpp_unix_add_edges, }, { .old_name = __stringify(__unix_gc), .new_func = klpp___unix_gc, }, { .old_name = __stringify(mptcp_schedule_work), .new_func = klpp_mptcp_schedule_work, }, { .old_name = __stringify(calipso_skbuff_setattr), .new_func = klpp_calipso_skbuff_setattr, .old_sympos = 1, }, { .old_name = __stringify(aa_unpack), .new_func = klpp_aa_unpack, }, { .old_name = __stringify(unpack_pdb), .new_func = klpp_unpack_pdb, }, { .old_name = __stringify(__aa_profile_list_release), .new_func = klpp___aa_profile_list_release, }, { .old_name = __stringify(aa_remove_profiles), .new_func = klpp_aa_remove_profiles, }, { .old_name = __stringify(aa_replace_profiles), .new_func = klpp_aa_replace_profiles, }, { .old_name = __stringify(__aa_create_ns), .new_func = klpp___aa_create_ns, }, { .old_name = __stringify(aa_dfa_match), .new_func = klpp_aa_dfa_match, }, { .old_name = __stringify(aa_dfa_match_len), .new_func = klpp_aa_dfa_match_len, }, { .old_name = __stringify(aa_dfa_unpack), .new_func = klpp_aa_dfa_unpack, }, { .old_name = __stringify(ns_mkdir_op), .new_func = klpp_ns_mkdir_op, }, { .old_name = __stringify(ns_rmdir_op), .new_func = klpp_ns_rmdir_op, }, { .old_name = __stringify(profile_load), .new_func = klpp_profile_load, }, { .old_name = __stringify(profile_remove), .new_func = klpp_profile_remove, }, { .old_name = __stringify(profile_replace), .new_func = klpp_profile_replace, }, { } } }, { .name = "auth_rpcgss", .funcs = (struct klp_func[]) { { .old_name = __stringify(svcauth_gss_proxy_init), .new_func = klpp_svcauth_gss_proxy_init, }, { } } }, { .name = "bridge", .funcs = (struct klp_func[]) { { .old_name = __stringify(br_forward), .new_func = klpp_br_forward, }, { .old_name = __stringify(maybe_deliver), .new_func = klpp_maybe_deliver, }, { .old_name = __stringify(br_multicast_flood), .new_func = klpp_br_multicast_flood, }, { .old_name = __stringify(br_handle_frame_finish), .new_func = klpp_br_handle_frame_finish, }, { .old_name = __stringify(br_handle_frame), .new_func = klpp_br_handle_frame, }, { } } }, #if (!IS_ENABLED(CONFIG_S390)) || (IS_ENABLED(CONFIG_S390)) { .name = "ip_vs", .funcs = (struct klp_func[]) { #if !IS_ENABLED(CONFIG_S390) { .old_name = __stringify(__ip_vs_get_out_rt), .new_func = klpp___ip_vs_get_out_rt, }, #endif #if IS_ENABLED(CONFIG_S390) { .old_name = __stringify(ip_vs_bypass_xmit), .new_func = klpp_ip_vs_bypass_xmit, }, { .old_name = __stringify(ip_vs_dr_xmit), .new_func = klpp_ip_vs_dr_xmit, }, { .old_name = __stringify(ip_vs_icmp_xmit), .new_func = klpp_ip_vs_icmp_xmit, }, { .old_name = __stringify(ip_vs_nat_xmit), .new_func = klpp_ip_vs_nat_xmit, }, { .old_name = __stringify(ip_vs_tunnel_xmit), .new_func = klpp_ip_vs_tunnel_xmit, }, #endif { } } }, #endif { .name = "libceph", .funcs = (struct klp_func[]) { { .old_name = __stringify(ceph_x_handle_reply), .new_func = klpp_ceph_x_handle_reply, }, { .old_name = __stringify(__ceph_open_session), .new_func = klpp___ceph_open_session, }, { .old_name = __stringify(monmap_show), .new_func = klpp_monmap_show, }, { .old_name = __stringify(osdmap_show), .new_func = klpp_osdmap_show, }, { } } }, { .name = "macvlan", .funcs = (struct klp_func[]) { { .old_name = __stringify(macvlan_common_newlink), .new_func = klpp_macvlan_common_newlink, }, { } } }, { .name = "nf_tables", .funcs = (struct klp_func[]) { { .old_name = __stringify(nft_map_activate), .new_func = klpp_nft_map_activate, }, { } } }, { .name = "sch_qfq", .funcs = (struct klp_func[]) { { .old_name = __stringify(qfq_change_class), .new_func = klpp_qfq_change_class, }, { } } }, { .name = "sch_teql", .funcs = (struct klp_func[]) { { .old_name = __stringify(teql_qdisc_init), .new_func = klpp_teql_qdisc_init, }, { } } }, { } }; 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"); /* Auto expanded KLP_PATCHES_INIT_CALLS: */ retval = livepatch_bsc1255052_init(); if (retval) goto err_bsc1255052; retval = livepatch_bsc1255053_init(); if (retval) goto err_bsc1255053; retval = livepatch_bsc1255378_init(); if (retval) goto err_bsc1255378; retval = livepatch_bsc1255402_init(); if (retval) goto err_bsc1255402; retval = livepatch_bsc1255895_init(); if (retval) goto err_bsc1255895; retval = livepatch_bsc1256624_init(); if (retval) goto err_bsc1256624; retval = livepatch_bsc1256644_init(); if (retval) goto err_bsc1256644; retval = livepatch_bsc1256780_init(); if (retval) goto err_bsc1256780; retval = livepatch_bsc1257238_init(); if (retval) goto err_bsc1257238; retval = livepatch_bsc1258051_init(); if (retval) goto err_bsc1258051; retval = livepatch_bsc1258183_init(); if (retval) goto err_bsc1258183; retval = livepatch_bsc1258784_init(); if (retval) goto err_bsc1258784; retval = livepatch_bsc1259859_init(); if (retval) goto err_bsc1259859; retval = klp_enable_patch(&patch); if (!retval) return retval; /* Auto expanded KLP_PATCHES_INIT_ERR_HANDLERS: */ livepatch_bsc1259859_cleanup(); err_bsc1259859: livepatch_bsc1258784_cleanup(); err_bsc1258784: livepatch_bsc1258183_cleanup(); err_bsc1258183: livepatch_bsc1258051_cleanup(); err_bsc1258051: livepatch_bsc1257238_cleanup(); err_bsc1257238: livepatch_bsc1256780_cleanup(); err_bsc1256780: livepatch_bsc1256644_cleanup(); err_bsc1256644: livepatch_bsc1256624_cleanup(); err_bsc1256624: livepatch_bsc1255895_cleanup(); err_bsc1255895: livepatch_bsc1255402_cleanup(); err_bsc1255402: livepatch_bsc1255378_cleanup(); err_bsc1255378: livepatch_bsc1255053_cleanup(); err_bsc1255053: livepatch_bsc1255052_cleanup(); err_bsc1255052: return retval; } static void __exit klp_patch_cleanup(void) { pr_info("livepatch: removed\n"); /* Auto expanded KLP_PATCHES_CLEANUP_CALLS: */ livepatch_bsc1255052_cleanup(); livepatch_bsc1255053_cleanup(); livepatch_bsc1255378_cleanup(); livepatch_bsc1255402_cleanup(); livepatch_bsc1255895_cleanup(); livepatch_bsc1256624_cleanup(); livepatch_bsc1256644_cleanup(); livepatch_bsc1256780_cleanup(); livepatch_bsc1257238_cleanup(); livepatch_bsc1258051_cleanup(); livepatch_bsc1258183_cleanup(); livepatch_bsc1258784_cleanup(); livepatch_bsc1259859_cleanup(); } module_init(klp_patch_init); module_exit(klp_patch_cleanup); MODULE_LICENSE("GPL"); MODULE_INFO(livepatch, "Y"); MODULE_INFO(klpgitrev, "aeb848d5996baf5c06074c10f21d74e6d84b00b6");