From 5cd8a256d9e87cf8c89b3bfc284bce1839d58778 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 15 Aug 2022 13:09:19 +0200 Subject: [PATCH] 5.4-stable patches added patches: tpm-eventlog-fix-section-mismatch-for-debug_section_mismatch.patch --- queue-5.4/series | 1 + ...-mismatch-for-debug_section_mismatch.patch | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 queue-5.4/tpm-eventlog-fix-section-mismatch-for-debug_section_mismatch.patch diff --git a/queue-5.4/series b/queue-5.4/series index 3a0cd3719fe..08d17f39971 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -256,3 +256,4 @@ scsi-qla2xxx-fix-erroneous-mailbox-timeout-after-pci-error-injection.patch x86-olpc-fix-logical-not-is-only-applied-to-the-left-hand-side.patch spmi-trace-fix-stack-out-of-bound-access-in-spmi-tracing-functions.patch kexec-keys-s390-make-use-of-built-in-and-secondary-keyring-for-signature-verification.patch +tpm-eventlog-fix-section-mismatch-for-debug_section_mismatch.patch diff --git a/queue-5.4/tpm-eventlog-fix-section-mismatch-for-debug_section_mismatch.patch b/queue-5.4/tpm-eventlog-fix-section-mismatch-for-debug_section_mismatch.patch new file mode 100644 index 00000000000..31b186f7799 --- /dev/null +++ b/queue-5.4/tpm-eventlog-fix-section-mismatch-for-debug_section_mismatch.patch @@ -0,0 +1,42 @@ +From bed4593645366ad7362a3aa7bc0d100d8d8236a8 Mon Sep 17 00:00:00 2001 +From: Huacai Chen +Date: Mon, 11 Jul 2022 09:17:38 +0800 +Subject: tpm: eventlog: Fix section mismatch for DEBUG_SECTION_MISMATCH + +From: Huacai Chen + +commit bed4593645366ad7362a3aa7bc0d100d8d8236a8 upstream. + +If DEBUG_SECTION_MISMATCH enabled, __calc_tpm2_event_size() will not be +inlined, this cause section mismatch like this: + +WARNING: modpost: vmlinux.o(.text.unlikely+0xe30c): Section mismatch in reference from the variable L0 to the function .init.text:early_ioremap() +The function L0() references +the function __init early_memremap(). +This is often because L0 lacks a __init +annotation or the annotation of early_ioremap is wrong. + +Fix it by using __always_inline instead of inline for the called-once +function __calc_tpm2_event_size(). + +Fixes: 44038bc514a2 ("tpm: Abstract crypto agile event size calculations") +Cc: stable@vger.kernel.org # v5.3 +Reported-by: WANG Xuerui +Signed-off-by: Huacai Chen +Signed-off-by: Jarkko Sakkinen +Signed-off-by: Greg Kroah-Hartman +--- + include/linux/tpm_eventlog.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/linux/tpm_eventlog.h ++++ b/include/linux/tpm_eventlog.h +@@ -157,7 +157,7 @@ struct tcg_algorithm_info { + * Return: size of the event on success, 0 on failure + */ + +-static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, ++static __always_inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, + struct tcg_pcr_event *event_header, + bool do_mapping) + { -- 2.47.3