From e596012956bbf5c34d1d1d2d6029e6c420fa8d9e Mon Sep 17 00:00:00 2001 From: Jiping Ma Date: Tue, 25 Jun 2024 07:58:00 +0000 Subject: [PATCH] mlnx-ofa_kernel:Fix the obsolete module init Update module init call to use kernel provided macros, such that they gain correct IBT attributes. We encouter the following error during load the module mlx_compat when IBT(Indirect Branch Tracking) feature is enabled for CPU and CONFIG_X86_KERNEL_IBT is enable by the kernel config file. "Missing ENDBR: __init_backport+0x0/0xff0 [mlx_compat]" CONFIG_X86_KERNEL_IBT is enable by default after https://git.yoctoproject.org/linux-yocto/commit/?id=4fd5f70ce14d ("x86/Kconfig: Enable kernel IBT by default") was introduced in kernel v6.4. Verification: * An ISO image can be built with this commit applied to a repo project of StarlingX's kernel 6.6.7 branch. * The ISO image can be installed to a R760 server without "Missing ENDBR: __init_backport+0x0/0xff0 [mlx_compat]" in dmesg log. The issue can be repduced in the lab without the fix. Story: 2011056 Task: 50422 Change-Id: I02af6b0cd26c1d02e58f77388f67619a48e06de6 Reported-by: Guilherme Batista Leite Signed-off-by: Jiping Ma --- .../0003-Fix-the-obsolete-module-init.patch | 44 +++++++++++++++++++ .../mlnx-ofa_kernel/debian/patches/series | 1 + 2 files changed, 45 insertions(+) create mode 100644 kernel-modules/mlnx-ofa_kernel/debian/patches/0003-Fix-the-obsolete-module-init.patch diff --git a/kernel-modules/mlnx-ofa_kernel/debian/patches/0003-Fix-the-obsolete-module-init.patch b/kernel-modules/mlnx-ofa_kernel/debian/patches/0003-Fix-the-obsolete-module-init.patch new file mode 100644 index 00000000..09c69d49 --- /dev/null +++ b/kernel-modules/mlnx-ofa_kernel/debian/patches/0003-Fix-the-obsolete-module-init.patch @@ -0,0 +1,44 @@ +From 04b9a5dd72f61d9664882b61c8864dd5faa8415b Mon Sep 17 00:00:00 2001 +From: Jiping Ma +Date: Tue, 25 Jun 2024 02:58:29 +0000 +Subject: [PATCH] Fix the obsolete module init + +Update module init call to use kernel provided macros, such +that they gain correct IBT attributes. + +We encouter the following error during load the module mlx_compat. +"Missing ENDBR: __init_backport+0x0/0xff0 [mlx_compat]" + +Reported-by: Guilherme Batista Leite +Signed-off-by: Jiping Ma +--- + include/linux/compat-2.6.h | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/include/linux/compat-2.6.h b/include/linux/compat-2.6.h +index 5446d9a..8df7ce9 100644 +--- a/include/linux/compat-2.6.h ++++ b/include/linux/compat-2.6.h +@@ -49,14 +49,15 @@ void mlx_backport_dependency_symbol(void); + #endif + + #undef module_init +-#define module_init(initfn) \ ++#define module_init(initfn) \ + static int __init __init_backport(void) \ + { \ +- mlx_backport_dependency_symbol(); \ ++ mlx_backport_dependency_symbol(); \ + return initfn(); \ + } \ +- int init_module(void) __copy(initfn) __attribute__((alias("__init_backport"))); +- ++ int init_module(void) __copy(initfn) \ ++ __attribute__((alias("__init_backport"))); \ ++ ___ADDRESSABLE(init_module, __initdata); + + /* + * Each compat file represents compatibility code for new kernel +-- +2.43.0 + diff --git a/kernel-modules/mlnx-ofa_kernel/debian/patches/series b/kernel-modules/mlnx-ofa_kernel/debian/patches/series index aa840de7..80b07d74 100644 --- a/kernel-modules/mlnx-ofa_kernel/debian/patches/series +++ b/kernel-modules/mlnx-ofa_kernel/debian/patches/series @@ -1,2 +1,3 @@ 0001-Enable-mlx5-onboard-udev-name.patch 0002-mlnx-ofa_kernel-fix-bnxt_re-build-error.patch +0003-Fix-the-obsolete-module-init.patch