kernel/kernel-modules/mlnx-ofa_kernel/debian/patches/0003-Fix-the-obsolete-module-init.patch
Jiping Ma b6f8503866 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 <guilhermebatista.leite@windriver.com>
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
(cherry picked from commit e596012956bbf5c34d1d1d2d6029e6c420fa8d9e)
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
2024-07-19 01:33:48 +00:00

45 lines
1.7 KiB
Diff

From 04b9a5dd72f61d9664882b61c8864dd5faa8415b Mon Sep 17 00:00:00 2001
From: Jiping Ma <jiping.ma2@windriver.com>
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 <guilhermebatista.leite@windriver.com>
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
---
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