* [PATCH 5.15] of: kexec: Mark ima_{free,stable}_kexec_buffer() as __init
@ 2023-09-05 20:36 Nathan Chancellor
2023-09-06 20:28 ` Rob Herring
0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2023-09-05 20:36 UTC (permalink / raw)
To: gregkh, sashal
Cc: stable, robh+dt, frowand.list, zohar, dmitry.kasatkin, devicetree,
linux-integrity, linux-security-module, Nathan Chancellor
This commit has no direct upstream equivalent.
After commit d48016d74836 ("mm,ima,kexec,of: use memblock_free_late from
ima_free_kexec_buffer") in 5.15, there is a modpost warning for certain
configurations:
WARNING: modpost: vmlinux.o(.text+0xb14064): Section mismatch in reference from the function ima_free_kexec_buffer() to the function .init.text:__memblock_free_late()
The function ima_free_kexec_buffer() references
the function __init __memblock_free_late().
This is often because ima_free_kexec_buffer lacks a __init
annotation or the annotation of __memblock_free_late is wrong.
In mainline, there is no issue because ima_free_kexec_buffer() is marked
as __init, which was done as part of commit b69a2afd5afc ("x86/kexec:
Carry forward IMA measurement log on kexec") in 6.0, which is not
suitable for stable.
Mark ima_free_kexec_buffer() and its single caller
ima_load_kexec_buffer() as __init in 5.15, as ima_load_kexec_buffer() is
only called from ima_init(), which is __init, clearing up the warning.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/of/kexec.c | 2 +-
include/linux/of.h | 2 +-
security/integrity/ima/ima.h | 2 +-
security/integrity/ima/ima_kexec.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
index 3a07cc58e7d7..d10fd54415c2 100644
--- a/drivers/of/kexec.c
+++ b/drivers/of/kexec.c
@@ -165,7 +165,7 @@ int ima_get_kexec_buffer(void **addr, size_t *size)
/**
* ima_free_kexec_buffer - free memory used by the IMA buffer
*/
-int ima_free_kexec_buffer(void)
+int __init ima_free_kexec_buffer(void)
{
int ret;
unsigned long addr;
diff --git a/include/linux/of.h b/include/linux/of.h
index 140671cb746a..6f15e8b0f9d1 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -574,7 +574,7 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
unsigned long initrd_len,
const char *cmdline, size_t extra_fdt_size);
int ima_get_kexec_buffer(void **addr, size_t *size);
-int ima_free_kexec_buffer(void);
+int __init ima_free_kexec_buffer(void);
#else /* CONFIG_OF */
static inline void of_core_init(void)
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h
index be965a8715e4..0afe413dda68 100644
--- a/security/integrity/ima/ima.h
+++ b/security/integrity/ima/ima.h
@@ -122,7 +122,7 @@ struct ima_kexec_hdr {
extern const int read_idmap[];
#ifdef CONFIG_HAVE_IMA_KEXEC
-void ima_load_kexec_buffer(void);
+void __init ima_load_kexec_buffer(void);
#else
static inline void ima_load_kexec_buffer(void) {}
#endif /* CONFIG_HAVE_IMA_KEXEC */
diff --git a/security/integrity/ima/ima_kexec.c b/security/integrity/ima/ima_kexec.c
index f799cc278a9a..f3b10851bbbf 100644
--- a/security/integrity/ima/ima_kexec.c
+++ b/security/integrity/ima/ima_kexec.c
@@ -137,7 +137,7 @@ void ima_add_kexec_buffer(struct kimage *image)
/*
* Restore the measurement list from the previous kernel.
*/
-void ima_load_kexec_buffer(void)
+void __init ima_load_kexec_buffer(void)
{
void *kexec_buffer = NULL;
size_t kexec_buffer_size = 0;
---
base-commit: 8f790700c974345ab78054e109beddd84539f319
change-id: 20230905-5-15-of-kexec-modpost-warning-6a6b48f30ebf
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 5.15] of: kexec: Mark ima_{free,stable}_kexec_buffer() as __init
2023-09-05 20:36 [PATCH 5.15] of: kexec: Mark ima_{free,stable}_kexec_buffer() as __init Nathan Chancellor
@ 2023-09-06 20:28 ` Rob Herring
2023-09-07 11:30 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2023-09-06 20:28 UTC (permalink / raw)
To: Nathan Chancellor
Cc: stable, linux-security-module, devicetree, frowand.list, robh+dt,
sashal, dmitry.kasatkin, gregkh, linux-integrity, zohar
On Tue, 05 Sep 2023 13:36:11 -0700, Nathan Chancellor wrote:
> This commit has no direct upstream equivalent.
>
> After commit d48016d74836 ("mm,ima,kexec,of: use memblock_free_late from
> ima_free_kexec_buffer") in 5.15, there is a modpost warning for certain
> configurations:
>
> WARNING: modpost: vmlinux.o(.text+0xb14064): Section mismatch in reference from the function ima_free_kexec_buffer() to the function .init.text:__memblock_free_late()
> The function ima_free_kexec_buffer() references
> the function __init __memblock_free_late().
> This is often because ima_free_kexec_buffer lacks a __init
> annotation or the annotation of __memblock_free_late is wrong.
>
> In mainline, there is no issue because ima_free_kexec_buffer() is marked
> as __init, which was done as part of commit b69a2afd5afc ("x86/kexec:
> Carry forward IMA measurement log on kexec") in 6.0, which is not
> suitable for stable.
>
> Mark ima_free_kexec_buffer() and its single caller
> ima_load_kexec_buffer() as __init in 5.15, as ima_load_kexec_buffer() is
> only called from ima_init(), which is __init, clearing up the warning.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> drivers/of/kexec.c | 2 +-
> include/linux/of.h | 2 +-
> security/integrity/ima/ima.h | 2 +-
> security/integrity/ima/ima_kexec.c | 2 +-
> 4 files changed, 4 insertions(+), 4 deletions(-)
>
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 5.15] of: kexec: Mark ima_{free,stable}_kexec_buffer() as __init
2023-09-06 20:28 ` Rob Herring
@ 2023-09-07 11:30 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2023-09-07 11:30 UTC (permalink / raw)
To: Rob Herring
Cc: Nathan Chancellor, stable, linux-security-module, devicetree,
frowand.list, robh+dt, sashal, dmitry.kasatkin, linux-integrity,
zohar
On Wed, Sep 06, 2023 at 03:28:51PM -0500, Rob Herring wrote:
>
> On Tue, 05 Sep 2023 13:36:11 -0700, Nathan Chancellor wrote:
> > This commit has no direct upstream equivalent.
> >
> > After commit d48016d74836 ("mm,ima,kexec,of: use memblock_free_late from
> > ima_free_kexec_buffer") in 5.15, there is a modpost warning for certain
> > configurations:
> >
> > WARNING: modpost: vmlinux.o(.text+0xb14064): Section mismatch in reference from the function ima_free_kexec_buffer() to the function .init.text:__memblock_free_late()
> > The function ima_free_kexec_buffer() references
> > the function __init __memblock_free_late().
> > This is often because ima_free_kexec_buffer lacks a __init
> > annotation or the annotation of __memblock_free_late is wrong.
> >
> > In mainline, there is no issue because ima_free_kexec_buffer() is marked
> > as __init, which was done as part of commit b69a2afd5afc ("x86/kexec:
> > Carry forward IMA measurement log on kexec") in 6.0, which is not
> > suitable for stable.
> >
> > Mark ima_free_kexec_buffer() and its single caller
> > ima_load_kexec_buffer() as __init in 5.15, as ima_load_kexec_buffer() is
> > only called from ima_init(), which is __init, clearing up the warning.
> >
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> > drivers/of/kexec.c | 2 +-
> > include/linux/of.h | 2 +-
> > security/integrity/ima/ima.h | 2 +-
> > security/integrity/ima/ima_kexec.c | 2 +-
> > 4 files changed, 4 insertions(+), 4 deletions(-)
> >
>
> Acked-by: Rob Herring <robh@kernel.org>
>
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-07 16:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-05 20:36 [PATCH 5.15] of: kexec: Mark ima_{free,stable}_kexec_buffer() as __init Nathan Chancellor
2023-09-06 20:28 ` Rob Herring
2023-09-07 11:30 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).