Some distributions need to maintain and fix KABI compatibility so that drivers do not need to be recompiled during kernel upgrades. Fixing KABI compatibility is a dangerous and hacking job. Developers need to know clearly what they are doing and the risks they may face. KABI fix actions are closely related to the processor architecture. Fixes may not be appropriate for all architectures. Improper fix may cause kernel panic or unexpected error.
Only for expert users, and select N by default.
Xie XiuQi (2): kabi: restrict the KABI fix to a specific architecture and dist kabi: enable KABI_COMPAT series by default on x86_64 & ARM64
arch/arm64/configs/openeuler_defconfig | 5 +-- arch/x86/configs/openeuler_defconfig | 5 +-- include/linux/kabi.h | 2 +- init/Kconfig | 49 +++++++++++++++++--------- 4 files changed, 40 insertions(+), 21 deletions(-)
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB9FKU
--------------------------------
Some distributions need to maintain and fix KABI compatibility so that drivers do not need to be recompiled during kernel upgrades. Fixing KABI compatibility is a dangerous and hacking job. Developers need to know clearly what they are doing and the risks they may face. KABI fix actions are closely related to the processor architecture. Fixes may not be appropriate for all architectures. Improper fix may cause kernel panic or unexpected error.
Only for expert users, and select N by default.
Signed-off-by: Xie XiuQi xiexiuqi@huawei.com --- include/linux/kabi.h | 2 +- init/Kconfig | 49 +++++++++++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/include/linux/kabi.h b/include/linux/kabi.h index e0f4521632835..9e48d9601867b 100644 --- a/include/linux/kabi.h +++ b/include/linux/kabi.h @@ -332,7 +332,7 @@ * the end of the enum. Before using this macro, make sure this is actually * safe to do. */ -#ifdef __GENKSYMS__ +#if defined(__GENKSYMS__) && IS_ENABLED(CONFIG_KABI_COMPAT)
# define KABI_CONST # define KABI_ADD_MODIFIER(_new) diff --git a/init/Kconfig b/init/Kconfig index 1840935e919cf..a62a9722bcde5 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only + config CC_VERSION_TEXT string default "$(CC_VERSION_TEXT)" @@ -1912,6 +1913,38 @@ config KALLSYMS_BASE_RELATIVE
# end of the "standard kernel features (expert users)" menu
+config KABI_COMPAT + bool "Enable kabi compatible fix" + depends on X86_64 || ARM64 + default n + help + Support KABI compatibility fix. Some distributions need to maintain + and fix KABI compatibility so that drivers do not need to be recompiled + during kernel upgrades. Fixing KABI compatibility is a dangerous and + hacking job. Developers need to know clearly what they are doing and + the risks they may face. Related KABI fix actions are closely related + to the processor architecture. Fixes may not be appropriate for all + architectures. Improper use may cause system panic. + + If unsure, say N. + +config KABI_RESERVE + bool "Enable KABI PADDING RESERVE" + default y + depends on KABI_COMPAT + help + This option enables KABI padding reserve. + For some embedded system, KABI padding reserve may be not necessary. + Disable it on demand. + +config KABI_SIZE_ALIGN_CHECKS + bool "Enables more stringent kabi checks in the macros" + default y + depends on KABI_RESERVE + help + This option enables more stringent kabi checks. Those must be disable + in case of a debug-build because they allow to change struct sizes. + # syscall, maps, verifier
config ARCH_HAS_MEMBARRIER_CALLBACKS @@ -2095,22 +2128,6 @@ config BINDGEN_VERSION_TEXT config TRACEPOINTS bool
-config KABI_RESERVE - bool "Enable KABI PADDING RESERVE" - default y - help - This option enables KABI padding reserve. - For some embedded system, KABI padding reserve may be not necessary. - Disable it on demand. - -config KABI_SIZE_ALIGN_CHECKS - bool "Enables more stringent kabi checks in the macros" - default y - depends on KABI_RESERVE - help - This option enables more stringent kabi checks. Those must be disable - in case of a debug-build because they allow to change struct sizes. - source "kernel/Kconfig.kexec"
endmenu # General setup
Kconfig最好独立到单独的Kconfig里面;放到原始的里面没啥意义
Kconfig.kabi 类似?
On 2024/12/13 11:51, Xie XiuQi wrote:
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB9FKU
Some distributions need to maintain and fix KABI compatibility so that drivers do not need to be recompiled during kernel upgrades. Fixing KABI compatibility is a dangerous and hacking job. Developers need to know clearly what they are doing and the risks they may face. KABI fix actions are closely related to the processor architecture. Fixes may not be appropriate for all architectures. Improper fix may cause kernel panic or unexpected error.
Only for expert users, and select N by default.
Signed-off-by: Xie XiuQi xiexiuqi@huawei.com
include/linux/kabi.h | 2 +- init/Kconfig | 49 +++++++++++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/include/linux/kabi.h b/include/linux/kabi.h index e0f4521632835..9e48d9601867b 100644 --- a/include/linux/kabi.h +++ b/include/linux/kabi.h @@ -332,7 +332,7 @@
- the end of the enum. Before using this macro, make sure this is actually
- safe to do.
*/ -#ifdef __GENKSYMS__ +#if defined(__GENKSYMS__) && IS_ENABLED(CONFIG_KABI_COMPAT)
# define KABI_CONST # define KABI_ADD_MODIFIER(_new) diff --git a/init/Kconfig b/init/Kconfig index 1840935e919cf..a62a9722bcde5 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only
- config CC_VERSION_TEXT string default "$(CC_VERSION_TEXT)"
@@ -1912,6 +1913,38 @@ config KALLSYMS_BASE_RELATIVE
# end of the "standard kernel features (expert users)" menu
+config KABI_COMPAT
- bool "Enable kabi compatible fix"
- depends on X86_64 || ARM64
- default n
- help
Support KABI compatibility fix. Some distributions need to maintain
and fix KABI compatibility so that drivers do not need to be recompiled
during kernel upgrades. Fixing KABI compatibility is a dangerous and
hacking job. Developers need to know clearly what they are doing and
the risks they may face. Related KABI fix actions are closely related
to the processor architecture. Fixes may not be appropriate for all
architectures. Improper use may cause system panic.
If unsure, say N.
+config KABI_RESERVE
- bool "Enable KABI PADDING RESERVE"
- default y
- depends on KABI_COMPAT
- help
This option enables KABI padding reserve.
For some embedded system, KABI padding reserve may be not necessary.
Disable it on demand.
+config KABI_SIZE_ALIGN_CHECKS
bool "Enables more stringent kabi checks in the macros"
default y
depends on KABI_RESERVE
help
This option enables more stringent kabi checks. Those must be disable
in case of a debug-build because they allow to change struct sizes.
# syscall, maps, verifier
config ARCH_HAS_MEMBARRIER_CALLBACKS
@@ -2095,22 +2128,6 @@ config BINDGEN_VERSION_TEXT config TRACEPOINTS bool
-config KABI_RESERVE
- bool "Enable KABI PADDING RESERVE"
- default y
- help
This option enables KABI padding reserve.
For some embedded system, KABI padding reserve may be not necessary.
Disable it on demand.
-config KABI_SIZE_ALIGN_CHECKS
bool "Enables more stringent kabi checks in the macros"
default y
depends on KABI_RESERVE
help
This option enables more stringent kabi checks. Those must be disable
in case of a debug-build because they allow to change struct sizes.
source "kernel/Kconfig.kexec"
endmenu # General setup
On 2024/12/13 12:51, Kefeng Wang wrote:
Kconfig最好独立到单独的Kconfig里面;放到原始的里面没啥意义
Kconfig.kabi 类似?
可以
On 2024/12/13 11:51, Xie XiuQi wrote:
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB9FKU
Some distributions need to maintain and fix KABI compatibility so that drivers do not need to be recompiled during kernel upgrades. Fixing KABI compatibility is a dangerous and hacking job. Developers need to know clearly what they are doing and the risks they may face. KABI fix actions are closely related to the processor architecture. Fixes may not be appropriate for all architectures. Improper fix may cause kernel panic or unexpected error.
Only for expert users, and select N by default.
Signed-off-by: Xie XiuQi xiexiuqi@huawei.com
include/linux/kabi.h | 2 +- init/Kconfig | 49 +++++++++++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 17 deletions(-)
diff --git a/include/linux/kabi.h b/include/linux/kabi.h index e0f4521632835..9e48d9601867b 100644 --- a/include/linux/kabi.h +++ b/include/linux/kabi.h @@ -332,7 +332,7 @@ * the end of the enum. Before using this macro, make sure this is actually * safe to do. */ -#ifdef __GENKSYMS__ +#if defined(__GENKSYMS__) && IS_ENABLED(CONFIG_KABI_COMPAT) # define KABI_CONST # define KABI_ADD_MODIFIER(_new) diff --git a/init/Kconfig b/init/Kconfig index 1840935e919cf..a62a9722bcde5 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only
config CC_VERSION_TEXT string default "$(CC_VERSION_TEXT)" @@ -1912,6 +1913,38 @@ config KALLSYMS_BASE_RELATIVE # end of the "standard kernel features (expert users)" menu +config KABI_COMPAT + bool "Enable kabi compatible fix" + depends on X86_64 || ARM64 + default n + help + Support KABI compatibility fix. Some distributions need to maintain + and fix KABI compatibility so that drivers do not need to be recompiled + during kernel upgrades. Fixing KABI compatibility is a dangerous and + hacking job. Developers need to know clearly what they are doing and + the risks they may face. Related KABI fix actions are closely related + to the processor architecture. Fixes may not be appropriate for all + architectures. Improper use may cause system panic.
+ If unsure, say N.
+config KABI_RESERVE + bool "Enable KABI PADDING RESERVE" + default y + depends on KABI_COMPAT + help + This option enables KABI padding reserve. + For some embedded system, KABI padding reserve may be not necessary. + Disable it on demand.
+config KABI_SIZE_ALIGN_CHECKS + bool "Enables more stringent kabi checks in the macros" + default y + depends on KABI_RESERVE + help + This option enables more stringent kabi checks. Those must be disable + in case of a debug-build because they allow to change struct sizes.
# syscall, maps, verifier config ARCH_HAS_MEMBARRIER_CALLBACKS @@ -2095,22 +2128,6 @@ config BINDGEN_VERSION_TEXT config TRACEPOINTS bool -config KABI_RESERVE - bool "Enable KABI PADDING RESERVE" - default y - help - This option enables KABI padding reserve. - For some embedded system, KABI padding reserve may be not necessary. - Disable it on demand.
-config KABI_SIZE_ALIGN_CHECKS - bool "Enables more stringent kabi checks in the macros" - default y - depends on KABI_RESERVE - help - This option enables more stringent kabi checks. Those must be disable - in case of a debug-build because they allow to change struct sizes.
source "kernel/Kconfig.kexec" endmenu # General setup
.
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB9FKU
--------------------------------
openEuler LTS need to maintain and fix KABI compatibility. Enable KABI_COMPAT series by default on x86_64 & ARM64.
Signed-off-by: Xie XiuQi xiexiuqi@huawei.com --- arch/arm64/configs/openeuler_defconfig | 5 +++-- arch/x86/configs/openeuler_defconfig | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index 45d9443367e1..5d4f61fdd748 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -250,6 +250,9 @@ CONFIG_SHMEM=y CONFIG_AIO=y CONFIG_IO_URING=y CONFIG_ADVISE_SYSCALLS=y +CONFIG_KABI_COMPAT=y +CONFIG_KABI_RESERVE=y +CONFIG_KABI_SIZE_ALIGN_CHECKS=y CONFIG_MEMBARRIER=y CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_SELFTEST is not set @@ -275,8 +278,6 @@ CONFIG_DEBUG_PERF_USE_VMALLOC=y CONFIG_SYSTEM_DATA_VERIFICATION=y CONFIG_PROFILING=y CONFIG_TRACEPOINTS=y -CONFIG_KABI_RESERVE=y -CONFIG_KABI_SIZE_ALIGN_CHECKS=y
# # Kexec and crash features diff --git a/arch/x86/configs/openeuler_defconfig b/arch/x86/configs/openeuler_defconfig index c3b68f17d746..722348229a67 100644 --- a/arch/x86/configs/openeuler_defconfig +++ b/arch/x86/configs/openeuler_defconfig @@ -270,6 +270,9 @@ CONFIG_SHMEM=y CONFIG_AIO=y CONFIG_IO_URING=y CONFIG_ADVISE_SYSCALLS=y +CONFIG_KABI_COMPAT=y +CONFIG_KABI_RESERVE=y +CONFIG_KABI_SIZE_ALIGN_CHECKS=y CONFIG_MEMBARRIER=y CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_SELFTEST is not set @@ -293,8 +296,6 @@ CONFIG_PERF_EVENTS=y CONFIG_SYSTEM_DATA_VERIFICATION=y CONFIG_PROFILING=y CONFIG_TRACEPOINTS=y -CONFIG_KABI_RESERVE=y -CONFIG_KABI_SIZE_ALIGN_CHECKS=y
# # Kexec and crash features