2024-12-18 15:57:24 +01:00
|
|
|
/*
|
|
|
|
* 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: */
|
2025-07-30 18:11:59 +02:00
|
|
|
#include "bsc1234854/livepatch_bsc1234854.h"
|
|
|
|
#include "bsc1234885/livepatch_bsc1234885.h"
|
|
|
|
#include "bsc1234892/livepatch_bsc1234892.h"
|
|
|
|
#include "bsc1235005/livepatch_bsc1235005.h"
|
2025-04-29 13:16:54 +02:00
|
|
|
#include "bsc1235008/livepatch_bsc1235008.h"
|
2025-06-23 17:25:28 +02:00
|
|
|
#include "bsc1235062/livepatch_bsc1235062.h"
|
|
|
|
#include "bsc1235129/livepatch_bsc1235129.h"
|
2025-04-15 13:15:46 +02:00
|
|
|
#include "bsc1235218/livepatch_bsc1235218.h"
|
2025-06-23 17:25:28 +02:00
|
|
|
#include "bsc1235231/livepatch_bsc1235231.h"
|
2025-08-25 13:07:26 +02:00
|
|
|
#include "bsc1235250/livepatch_bsc1235250.h"
|
2025-04-29 13:16:54 +02:00
|
|
|
#include "bsc1235431/livepatch_bsc1235431.h"
|
2025-07-30 18:11:59 +02:00
|
|
|
#include "bsc1235769/livepatch_bsc1235769.h"
|
2025-04-15 13:15:46 +02:00
|
|
|
#include "bsc1235916/livepatch_bsc1235916.h"
|
2025-07-30 18:11:59 +02:00
|
|
|
#include "bsc1235921/livepatch_bsc1235921.h"
|
2025-06-10 13:15:40 +02:00
|
|
|
#include "bsc1236701/livepatch_bsc1236701.h"
|
2025-07-30 18:11:59 +02:00
|
|
|
#include "bsc1238912/livepatch_bsc1238912.h"
|
2025-06-10 13:15:40 +02:00
|
|
|
#include "bsc1239077/livepatch_bsc1239077.h"
|
|
|
|
#include "bsc1239096/livepatch_bsc1239096.h"
|
2025-07-30 18:11:59 +02:00
|
|
|
#include "bsc1241579/livepatch_bsc1241579.h"
|
|
|
|
#include "bsc1243648/livepatch_bsc1243648.h"
|
2025-08-25 13:07:26 +02:00
|
|
|
#include "bsc1245793/livepatch_bsc1245793.h"
|
|
|
|
#include "bsc1245797/livepatch_bsc1245797.h"
|
|
|
|
#include "bsc1245804/livepatch_bsc1245804.h"
|
2024-12-18 15:57:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2025-07-30 18:11:59 +02:00
|
|
|
{ .old_name = __stringify(bfq_limit_depth), .new_func = klpp_bfq_limit_depth, },
|
2025-04-15 13:15:46 +02:00
|
|
|
{ .old_name = __stringify(inet6_create), .new_func = klpp_inet6_create, },
|
2025-06-23 17:25:28 +02:00
|
|
|
{ .old_name = __stringify(inet_create), .new_func = klpp_inet_create, },
|
2025-08-25 13:07:26 +02:00
|
|
|
{ .old_name = __stringify(sock_map_remove_links), .new_func = klpp_sock_map_remove_links, },
|
|
|
|
{ .old_name = __stringify(sock_map_delete_elem), .new_func = klpp_sock_map_delete_elem, },
|
2025-04-15 13:15:46 +02:00
|
|
|
{ .old_name = __stringify(mptcp_established_options), .new_func = klpp_mptcp_established_options, },
|
2025-07-30 18:11:59 +02:00
|
|
|
{ .old_name = __stringify(mac_partition), .new_func = klpp_mac_partition, },
|
2025-08-25 13:07:26 +02:00
|
|
|
{ .old_name = __stringify(pfifo_tail_enqueue), .new_func = klpp_pfifo_tail_enqueue, },
|
|
|
|
{ .old_name = __stringify(find_equal_scalars), .new_func = klpp_find_equal_scalars, },
|
2024-12-18 15:57:24 +01:00
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
2025-06-10 13:15:40 +02:00
|
|
|
#if IS_ENABLED(CONFIG_BT)
|
|
|
|
{
|
|
|
|
.name = "bluetooth",
|
|
|
|
.funcs = (struct klp_func[]) {
|
2025-06-23 17:25:28 +02:00
|
|
|
{ .old_name = __stringify(l2cap_sock_create), .new_func = klpp_l2cap_sock_create, },
|
|
|
|
{ .old_name = __stringify(l2cap_sock_new_connection_cb), .new_func = klpp_l2cap_sock_new_connection_cb, },
|
2025-06-10 13:15:40 +02:00
|
|
|
{ .old_name = __stringify(mgmt_remove_adv_monitor_complete), .new_func = klpp_mgmt_remove_adv_monitor_complete, },
|
|
|
|
{ .old_name = __stringify(mgmt_remove_adv_monitor_sync), .new_func = klpp_mgmt_remove_adv_monitor_sync, },
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
#endif
|
2025-06-23 17:25:28 +02:00
|
|
|
{
|
|
|
|
.name = "btrfs",
|
|
|
|
.funcs = (struct klp_func[]) {
|
|
|
|
{ .old_name = __stringify(btrfs_encoded_read_endio), .new_func = klpp_btrfs_encoded_read_endio, },
|
2025-07-30 18:11:59 +02:00
|
|
|
{ .old_name = __stringify(btrfs_create_pending_block_groups), .new_func = klpp_btrfs_create_pending_block_groups, },
|
2025-06-23 17:25:28 +02:00
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
2025-04-29 13:16:54 +02:00
|
|
|
#if IS_ENABLED(CONFIG_BT)
|
|
|
|
{
|
|
|
|
.name = "net/bluetooth/bluetooth",
|
|
|
|
.funcs = (struct klp_func[]) {
|
|
|
|
{ .old_name = __stringify(hci_conn_del_sysfs), .new_func = klpp_hci_conn_del_sysfs, },
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
#endif
|
2025-07-30 18:11:59 +02:00
|
|
|
{
|
|
|
|
.name = "nfsd",
|
|
|
|
.funcs = (struct klp_func[]) {
|
|
|
|
{ .old_name = __stringify(decode_cb_compound4res), .new_func = klpp_decode_cb_compound4res, },
|
|
|
|
{ .old_name = __stringify(e_show), .new_func = klpp_e_show, },
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "nfsv4",
|
|
|
|
.funcs = (struct klp_func[]) {
|
|
|
|
{ .old_name = __stringify(nfs4_open_release), .new_func = klpp_nfs4_open_release, },
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
2025-06-10 13:15:40 +02:00
|
|
|
{
|
|
|
|
.name = "pktgen",
|
|
|
|
.funcs = (struct klp_func[]) {
|
|
|
|
{ .old_name = __stringify(pktgen_if_write), .new_func = klpp_pktgen_if_write, },
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
2025-08-25 13:07:26 +02:00
|
|
|
{
|
|
|
|
.name = "sch_hfsc",
|
|
|
|
.funcs = (struct klp_func[]) {
|
|
|
|
{ .old_name = __stringify(hfsc_change_class), .new_func = klpp_hfsc_change_class, },
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
2025-06-10 13:15:40 +02:00
|
|
|
{
|
|
|
|
.name = "sch_sfq",
|
|
|
|
.funcs = (struct klp_func[]) {
|
|
|
|
{ .old_name = __stringify(sfq_init), .new_func = klpp_sfq_init, },
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
2025-07-30 18:11:59 +02:00
|
|
|
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
|
|
|
|
{
|
|
|
|
.name = "snd_seq_oss",
|
|
|
|
.funcs = (struct klp_func[]) {
|
|
|
|
{ .old_name = __stringify(snd_seq_oss_synth_sysex), .new_func = klpp_snd_seq_oss_synth_sysex, },
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_TDX_GUEST_DRIVER)
|
|
|
|
{
|
|
|
|
.name = "tdx_guest",
|
|
|
|
.funcs = (struct klp_func[]) {
|
|
|
|
{ .old_name = __stringify(tdx_guest_init), .new_func = klpp_tdx_guest_init, },
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
.name = "vfio_pci_core",
|
|
|
|
.funcs = (struct klp_func[]) {
|
|
|
|
{ .old_name = __stringify(vfio_pci_config_rw), .new_func = klpp_vfio_pci_config_rw, },
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
2025-04-29 13:16:54 +02:00
|
|
|
#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_LED)
|
|
|
|
{
|
|
|
|
.name = "xt_LED",
|
|
|
|
.funcs = (struct klp_func[]) {
|
|
|
|
{ .old_name = __stringify(led_tg_check), .new_func = klpp_led_tg_check, },
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
#endif
|
2024-12-18 15:57:24 +01:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
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: */
|
2025-07-30 18:11:59 +02:00
|
|
|
retval = livepatch_bsc1234854_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1234854;
|
|
|
|
|
|
|
|
retval = livepatch_bsc1234885_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1234885;
|
|
|
|
|
|
|
|
retval = livepatch_bsc1234892_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1234892;
|
|
|
|
|
|
|
|
retval = livepatch_bsc1235005_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1235005;
|
|
|
|
|
2025-04-29 13:16:54 +02:00
|
|
|
retval = livepatch_bsc1235008_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1235008;
|
|
|
|
|
2025-06-23 17:25:28 +02:00
|
|
|
retval = livepatch_bsc1235062_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1235062;
|
|
|
|
|
|
|
|
retval = livepatch_bsc1235129_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1235129;
|
|
|
|
|
2025-04-15 13:15:46 +02:00
|
|
|
retval = livepatch_bsc1235218_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1235218;
|
2024-12-18 15:57:24 +01:00
|
|
|
|
2025-06-23 17:25:28 +02:00
|
|
|
retval = livepatch_bsc1235231_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1235231;
|
|
|
|
|
2025-08-25 13:07:26 +02:00
|
|
|
retval = livepatch_bsc1235250_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1235250;
|
|
|
|
|
2025-04-29 13:16:54 +02:00
|
|
|
retval = livepatch_bsc1235431_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1235431;
|
|
|
|
|
2025-07-30 18:11:59 +02:00
|
|
|
retval = livepatch_bsc1235769_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1235769;
|
|
|
|
|
2025-04-15 13:15:46 +02:00
|
|
|
retval = livepatch_bsc1235916_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1235916;
|
2024-12-18 15:57:24 +01:00
|
|
|
|
2025-07-30 18:11:59 +02:00
|
|
|
retval = livepatch_bsc1235921_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1235921;
|
|
|
|
|
2025-06-10 13:15:40 +02:00
|
|
|
retval = livepatch_bsc1236701_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1236701;
|
|
|
|
|
2025-07-30 18:11:59 +02:00
|
|
|
retval = livepatch_bsc1238912_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1238912;
|
|
|
|
|
2025-06-10 13:15:40 +02:00
|
|
|
retval = livepatch_bsc1239077_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1239077;
|
|
|
|
|
|
|
|
retval = livepatch_bsc1239096_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1239096;
|
|
|
|
|
2025-07-30 18:11:59 +02:00
|
|
|
retval = livepatch_bsc1241579_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1241579;
|
|
|
|
|
|
|
|
retval = livepatch_bsc1243648_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1243648;
|
|
|
|
|
2025-08-25 13:07:26 +02:00
|
|
|
retval = livepatch_bsc1245793_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1245793;
|
|
|
|
|
|
|
|
retval = livepatch_bsc1245797_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1245797;
|
|
|
|
|
|
|
|
retval = livepatch_bsc1245804_init();
|
|
|
|
if (retval)
|
|
|
|
goto err_bsc1245804;
|
|
|
|
|
2024-12-18 15:57:24 +01:00
|
|
|
retval = klp_enable_patch(&patch);
|
|
|
|
if (!retval)
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
/* Auto expanded KLP_PATCHES_INIT_ERR_HANDLERS: */
|
2025-08-25 13:07:26 +02:00
|
|
|
livepatch_bsc1245804_cleanup();
|
|
|
|
err_bsc1245804:
|
|
|
|
livepatch_bsc1245797_cleanup();
|
|
|
|
err_bsc1245797:
|
|
|
|
livepatch_bsc1245793_cleanup();
|
|
|
|
err_bsc1245793:
|
2025-07-30 18:11:59 +02:00
|
|
|
livepatch_bsc1243648_cleanup();
|
|
|
|
err_bsc1243648:
|
|
|
|
livepatch_bsc1241579_cleanup();
|
|
|
|
err_bsc1241579:
|
2025-06-10 13:15:40 +02:00
|
|
|
livepatch_bsc1239096_cleanup();
|
|
|
|
err_bsc1239096:
|
|
|
|
livepatch_bsc1239077_cleanup();
|
|
|
|
err_bsc1239077:
|
2025-07-30 18:11:59 +02:00
|
|
|
livepatch_bsc1238912_cleanup();
|
|
|
|
err_bsc1238912:
|
2025-06-10 13:15:40 +02:00
|
|
|
livepatch_bsc1236701_cleanup();
|
|
|
|
err_bsc1236701:
|
2025-07-30 18:11:59 +02:00
|
|
|
livepatch_bsc1235921_cleanup();
|
|
|
|
err_bsc1235921:
|
2025-04-15 13:15:46 +02:00
|
|
|
livepatch_bsc1235916_cleanup();
|
|
|
|
err_bsc1235916:
|
2025-07-30 18:11:59 +02:00
|
|
|
livepatch_bsc1235769_cleanup();
|
|
|
|
err_bsc1235769:
|
2025-04-29 13:16:54 +02:00
|
|
|
livepatch_bsc1235431_cleanup();
|
|
|
|
err_bsc1235431:
|
2025-08-25 13:07:26 +02:00
|
|
|
livepatch_bsc1235250_cleanup();
|
|
|
|
err_bsc1235250:
|
2025-06-23 17:25:28 +02:00
|
|
|
livepatch_bsc1235231_cleanup();
|
|
|
|
err_bsc1235231:
|
2025-04-15 13:15:46 +02:00
|
|
|
livepatch_bsc1235218_cleanup();
|
|
|
|
err_bsc1235218:
|
2025-06-23 17:25:28 +02:00
|
|
|
livepatch_bsc1235129_cleanup();
|
|
|
|
err_bsc1235129:
|
|
|
|
livepatch_bsc1235062_cleanup();
|
|
|
|
err_bsc1235062:
|
2025-04-29 13:16:54 +02:00
|
|
|
livepatch_bsc1235008_cleanup();
|
|
|
|
err_bsc1235008:
|
2025-07-30 18:11:59 +02:00
|
|
|
livepatch_bsc1235005_cleanup();
|
|
|
|
err_bsc1235005:
|
|
|
|
livepatch_bsc1234892_cleanup();
|
|
|
|
err_bsc1234892:
|
|
|
|
livepatch_bsc1234885_cleanup();
|
|
|
|
err_bsc1234885:
|
|
|
|
livepatch_bsc1234854_cleanup();
|
|
|
|
err_bsc1234854:
|
2024-12-18 15:57:24 +01:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit klp_patch_cleanup(void)
|
|
|
|
{
|
|
|
|
pr_info("livepatch: removed\n");
|
|
|
|
|
|
|
|
/* Auto expanded KLP_PATCHES_CLEANUP_CALLS: */
|
2025-07-30 18:11:59 +02:00
|
|
|
livepatch_bsc1234854_cleanup();
|
|
|
|
livepatch_bsc1234885_cleanup();
|
|
|
|
livepatch_bsc1234892_cleanup();
|
|
|
|
livepatch_bsc1235005_cleanup();
|
2025-04-29 13:16:54 +02:00
|
|
|
livepatch_bsc1235008_cleanup();
|
2025-06-23 17:25:28 +02:00
|
|
|
livepatch_bsc1235062_cleanup();
|
|
|
|
livepatch_bsc1235129_cleanup();
|
2025-04-15 13:15:46 +02:00
|
|
|
livepatch_bsc1235218_cleanup();
|
2025-06-23 17:25:28 +02:00
|
|
|
livepatch_bsc1235231_cleanup();
|
2025-08-25 13:07:26 +02:00
|
|
|
livepatch_bsc1235250_cleanup();
|
2025-04-29 13:16:54 +02:00
|
|
|
livepatch_bsc1235431_cleanup();
|
2025-07-30 18:11:59 +02:00
|
|
|
livepatch_bsc1235769_cleanup();
|
2025-04-15 13:15:46 +02:00
|
|
|
livepatch_bsc1235916_cleanup();
|
2025-07-30 18:11:59 +02:00
|
|
|
livepatch_bsc1235921_cleanup();
|
2025-06-10 13:15:40 +02:00
|
|
|
livepatch_bsc1236701_cleanup();
|
2025-07-30 18:11:59 +02:00
|
|
|
livepatch_bsc1238912_cleanup();
|
2025-06-10 13:15:40 +02:00
|
|
|
livepatch_bsc1239077_cleanup();
|
|
|
|
livepatch_bsc1239096_cleanup();
|
2025-07-30 18:11:59 +02:00
|
|
|
livepatch_bsc1241579_cleanup();
|
|
|
|
livepatch_bsc1243648_cleanup();
|
2025-08-25 13:07:26 +02:00
|
|
|
livepatch_bsc1245793_cleanup();
|
|
|
|
livepatch_bsc1245797_cleanup();
|
|
|
|
livepatch_bsc1245804_cleanup();
|
2024-12-18 15:57:24 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(klp_patch_init);
|
|
|
|
module_exit(klp_patch_cleanup);
|
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_INFO(livepatch, "Y");
|
2025-08-25 13:07:26 +02:00
|
|
|
MODULE_INFO(klpgitrev, "ea97be5d3bf0b44634a14ddf1d0461736c1cdc97");
|