From 69ec73efd37cf1e28684747fd4e20598b366b8a4 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 15 Nov 2020 15:35:41 +1100 Subject: [PATCH] [hook] disable TCO for the hooked function --- dkms.conf | 2 +- src/hook.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dkms.conf b/dkms.conf index adcf465..296b59f 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="vendor-reset" -PACKAGE_VERSION="0.0.16" +PACKAGE_VERSION="0.0.17" BUILT_MODULE_NAME[0]="${PACKAGE_NAME}" MAKE[0]="make KDIR=${kernel_source_dir}" CLEAN="make KDIR=${kernel_source_dir} clean" diff --git a/src/hook.c b/src/hook.c index 7f31b48..57d5af7 100644 --- a/src/hook.c +++ b/src/hook.c @@ -29,6 +29,8 @@ module_param(install_hook, bool, 0); static bool hook_installed = false; static int (*orig_pci_dev_specific_reset)(struct pci_dev *dev, int probe); +/* TCO breaks the hook, we must disable it for this function */ +__attribute__((optimize("-fno-optimize-sibling-calls"))) static int hooked_pci_dev_specific_reset(struct pci_dev *dev, int probe) { int ret;