* [PATCH] tpm: eventlog: Fix section mismatch for DEBUG_SECTION_MISMATCH
@ 2022-07-02 8:09 Huacai Chen
2022-07-11 0:08 ` Jarkko Sakkinen
0 siblings, 1 reply; 3+ messages in thread
From: Huacai Chen @ 2022-07-02 8:09 UTC (permalink / raw)
To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe
Cc: linux-integrity, Huacai Chen, Jiaxun Yang, Huacai Chen, WANG Xuerui
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().
Reported-by: WANG Xuerui <git@xen0n.name>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
include/linux/tpm_eventlog.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h
index 739ba9a03ec1..20c0ff54b7a0 100644
--- 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.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tpm: eventlog: Fix section mismatch for DEBUG_SECTION_MISMATCH
2022-07-02 8:09 [PATCH] tpm: eventlog: Fix section mismatch for DEBUG_SECTION_MISMATCH Huacai Chen
@ 2022-07-11 0:08 ` Jarkko Sakkinen
2022-07-11 1:13 ` Huacai Chen
0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Sakkinen @ 2022-07-11 0:08 UTC (permalink / raw)
To: Huacai Chen
Cc: Peter Huewe, Jason Gunthorpe, linux-integrity, Huacai Chen,
Jiaxun Yang, WANG Xuerui
On Sat, Jul 02, 2022 at 04:09:34PM +0800, Huacai Chen wrote:
> 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().
>
> Reported-by: WANG Xuerui <git@xen0n.name>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
> include/linux/tpm_eventlog.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h
> index 739ba9a03ec1..20c0ff54b7a0 100644
> --- 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.27.0
>
Please add
Fixes: 44038bc514a2 ("tpm: Abstract crypto agile event size calculations")
BR, Jarkko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tpm: eventlog: Fix section mismatch for DEBUG_SECTION_MISMATCH
2022-07-11 0:08 ` Jarkko Sakkinen
@ 2022-07-11 1:13 ` Huacai Chen
0 siblings, 0 replies; 3+ messages in thread
From: Huacai Chen @ 2022-07-11 1:13 UTC (permalink / raw)
To: Jarkko Sakkinen
Cc: Huacai Chen, Peter Huewe, Jason Gunthorpe, linux-integrity,
Jiaxun Yang, WANG Xuerui
Hi, Jakko,
On Mon, Jul 11, 2022 at 8:09 AM Jarkko Sakkinen <jarkko@kernel.org> wrote:
>
> On Sat, Jul 02, 2022 at 04:09:34PM +0800, Huacai Chen wrote:
> > 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().
> >
> > Reported-by: WANG Xuerui <git@xen0n.name>
> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> > ---
> > include/linux/tpm_eventlog.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h
> > index 739ba9a03ec1..20c0ff54b7a0 100644
> > --- 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.27.0
> >
>
> Please add
>
> Fixes: 44038bc514a2 ("tpm: Abstract crypto agile event size calculations")
OK, thanks.
Huacai
>
> BR, Jarkko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-11 1:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-02 8:09 [PATCH] tpm: eventlog: Fix section mismatch for DEBUG_SECTION_MISMATCH Huacai Chen
2022-07-11 0:08 ` Jarkko Sakkinen
2022-07-11 1:13 ` Huacai Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.