All of lore.kernel.org
 help / color / mirror / Atom feed
* [tip:x86/kdump 1/1] WARNING: modpost: vmlinux.o(.text+0x1e7210c): Section mismatch in reference from the function ima_free_kexec_buffer() to the function .meminit.text:memblock_phys_free()
@ 2022-06-29  2:52 kernel test robot
  2022-06-29  8:38   ` Borislav Petkov
  0 siblings, 1 reply; 12+ messages in thread
From: kernel test robot @ 2022-06-29  2:52 UTC (permalink / raw)
  To: Jonathan McDowell
  Cc: llvm, kbuild-all, linux-kernel, x86, Borislav Petkov, Mimi Zohar,
	Baoquan He

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/kdump
head:   69243968bd526641e549ed231c750ce92e3eeb35
commit: 69243968bd526641e549ed231c750ce92e3eeb35 [1/1] x86/kexec: Carry forward IMA measurement log on kexec
config: x86_64-randconfig-a016 (https://download.01.org/0day-ci/archive/20220629/202206291039.yGgljGbx-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project df18167ac56d05f2ab55f9d874aee7ab6d5bc9a2)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=69243968bd526641e549ed231c750ce92e3eeb35
        git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
        git fetch --no-tags tip x86/kdump
        git checkout 69243968bd526641e549ed231c750ce92e3eeb35
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

>> WARNING: modpost: vmlinux.o(.text+0x1e7210c): Section mismatch in reference from the function ima_free_kexec_buffer() to the function .meminit.text:memblock_phys_free()
The function ima_free_kexec_buffer() references
the function __meminit memblock_phys_free().
This is often because ima_free_kexec_buffer lacks a __meminit
annotation or the annotation of memblock_phys_free is wrong.

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [tip:x86/kdump 1/1] WARNING: modpost: vmlinux.o(.text+0x1e7210c): Section mismatch in reference from the function ima_free_kexec_buffer() to the function .meminit.text:memblock_phys_free()
  2022-06-29  2:52 [tip:x86/kdump 1/1] WARNING: modpost: vmlinux.o(.text+0x1e7210c): Section mismatch in reference from the function ima_free_kexec_buffer() to the function .meminit.text:memblock_phys_free() kernel test robot
@ 2022-06-29  8:38   ` Borislav Petkov
  0 siblings, 0 replies; 12+ messages in thread
From: Borislav Petkov @ 2022-06-29  8:38 UTC (permalink / raw)
  To: kernel test robot
  Cc: Jonathan McDowell, llvm, kbuild-all, linux-kernel, x86,
	Mimi Zohar, Baoquan He

On Wed, Jun 29, 2022 at 10:52:13AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/kdump
> head:   69243968bd526641e549ed231c750ce92e3eeb35
> commit: 69243968bd526641e549ed231c750ce92e3eeb35 [1/1] x86/kexec: Carry forward IMA measurement log on kexec

I've zapped it from tip for the time being.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [tip:x86/kdump 1/1] WARNING: modpost: vmlinux.o(.text+0x1e7210c): Section mismatch in reference from the function ima_free_kexec_buffer() to the function .meminit.text:memblock_phys_free()
@ 2022-06-29  8:38   ` Borislav Petkov
  0 siblings, 0 replies; 12+ messages in thread
From: Borislav Petkov @ 2022-06-29  8:38 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 458 bytes --]

On Wed, Jun 29, 2022 at 10:52:13AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/kdump
> head:   69243968bd526641e549ed231c750ce92e3eeb35
> commit: 69243968bd526641e549ed231c750ce92e3eeb35 [1/1] x86/kexec: Carry forward IMA measurement log on kexec

I've zapped it from tip for the time being.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] of: Correctly annotate IMA kexec buffer functions
  2022-06-29  8:38   ` Borislav Petkov
  (?)
@ 2022-06-29  9:52     ` Jonathan McDowell
  -1 siblings, 0 replies; 12+ messages in thread
From: Jonathan McDowell @ 2022-06-29  9:52 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: kernel test robot, llvm, kbuild-all, linux-kernel, x86,
	Mimi Zohar, Baoquan He, devicetree, linux-integrity, kexec

On Wed, Jun 29, 2022 at 10:38:46AM +0200, Borislav Petkov wrote:
> On Wed, Jun 29, 2022 at 10:52:13AM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/kdump
> > head:   69243968bd526641e549ed231c750ce92e3eeb35
> > commit: 69243968bd526641e549ed231c750ce92e3eeb35 [1/1] x86/kexec: Carry forward IMA measurement log on kexec
> 
> I've zapped it from tip for the time being.

This turns out to be the old OF code that can now be hit on x86 when
CONFIG_OF=y because it defines HAVE_IMA_KEXEC. I suspect the warning
already exists on ARM64/PowerPC. Fix is to mark those functions up in
the same manner as the new x86 variants.

Below is on top of what was in tip; I can roll a v7 if preferred but
I think seeing the fix on its own is clearer.
---

ima_free_kexec_buffer() calls into memblock_phys_free() so must be
annotated __meminit. Equally ima_kexec_get_buffer() is executed during
__init so can be marked as such. This was already done in the new x86
IMA kexec passing functions but not for the pre-existing OF based
functions.

Signed-off-by: Jonathan McDowell <noodles@fb.com>
Reported-by: kernel test robot <lkp@intel.com>
---
 drivers/of/kexec.c  | 4 ++--
 include/linux/ima.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
index d3ec430fa403..95cd5532b503 100644
--- a/drivers/of/kexec.c
+++ b/drivers/of/kexec.c
@@ -124,7 +124,7 @@ static int do_get_kexec_buffer(const void *prop, int len, unsigned long *addr,
  *
  * Return: 0 on success, negative errno on error.
  */
-int ima_get_kexec_buffer(void **addr, size_t *size)
+int __init ima_get_kexec_buffer(void **addr, size_t *size)
 {
 	int ret, len;
 	unsigned long tmp_addr;
@@ -148,7 +148,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 __meminit ima_free_kexec_buffer(void)
 {
 	int ret;
 	unsigned long addr;
diff --git a/include/linux/ima.h b/include/linux/ima.h
index ff4bd993e432..8d4698e63190 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -141,8 +141,8 @@ static inline int ima_measure_critical_data(const char *event_label,
 #endif /* CONFIG_IMA */
 
 #ifdef CONFIG_HAVE_IMA_KEXEC
-int ima_free_kexec_buffer(void);
-int ima_get_kexec_buffer(void **addr, size_t *size);
+int __meminit ima_free_kexec_buffer(void);
+int __init ima_get_kexec_buffer(void **addr, size_t *size);
 #endif
 
 #ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT
-- 
2.36.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] of: Correctly annotate IMA kexec buffer functions
@ 2022-06-29  9:52     ` Jonathan McDowell
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan McDowell @ 2022-06-29  9:52 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: kernel test robot, llvm, kbuild-all, linux-kernel, x86,
	Mimi Zohar, Baoquan He, devicetree, linux-integrity, kexec

On Wed, Jun 29, 2022 at 10:38:46AM +0200, Borislav Petkov wrote:
> On Wed, Jun 29, 2022 at 10:52:13AM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/kdump
> > head:   69243968bd526641e549ed231c750ce92e3eeb35
> > commit: 69243968bd526641e549ed231c750ce92e3eeb35 [1/1] x86/kexec: Carry forward IMA measurement log on kexec
> 
> I've zapped it from tip for the time being.

This turns out to be the old OF code that can now be hit on x86 when
CONFIG_OF=y because it defines HAVE_IMA_KEXEC. I suspect the warning
already exists on ARM64/PowerPC. Fix is to mark those functions up in
the same manner as the new x86 variants.

Below is on top of what was in tip; I can roll a v7 if preferred but
I think seeing the fix on its own is clearer.
---

ima_free_kexec_buffer() calls into memblock_phys_free() so must be
annotated __meminit. Equally ima_kexec_get_buffer() is executed during
__init so can be marked as such. This was already done in the new x86
IMA kexec passing functions but not for the pre-existing OF based
functions.

Signed-off-by: Jonathan McDowell <noodles@fb.com>
Reported-by: kernel test robot <lkp@intel.com>
---
 drivers/of/kexec.c  | 4 ++--
 include/linux/ima.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
index d3ec430fa403..95cd5532b503 100644
--- a/drivers/of/kexec.c
+++ b/drivers/of/kexec.c
@@ -124,7 +124,7 @@ static int do_get_kexec_buffer(const void *prop, int len, unsigned long *addr,
  *
  * Return: 0 on success, negative errno on error.
  */
-int ima_get_kexec_buffer(void **addr, size_t *size)
+int __init ima_get_kexec_buffer(void **addr, size_t *size)
 {
 	int ret, len;
 	unsigned long tmp_addr;
@@ -148,7 +148,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 __meminit ima_free_kexec_buffer(void)
 {
 	int ret;
 	unsigned long addr;
diff --git a/include/linux/ima.h b/include/linux/ima.h
index ff4bd993e432..8d4698e63190 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -141,8 +141,8 @@ static inline int ima_measure_critical_data(const char *event_label,
 #endif /* CONFIG_IMA */
 
 #ifdef CONFIG_HAVE_IMA_KEXEC
-int ima_free_kexec_buffer(void);
-int ima_get_kexec_buffer(void **addr, size_t *size);
+int __meminit ima_free_kexec_buffer(void);
+int __init ima_get_kexec_buffer(void **addr, size_t *size);
 #endif
 
 #ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT
-- 
2.36.1

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] of: Correctly annotate IMA kexec buffer functions
@ 2022-06-29  9:52     ` Jonathan McDowell
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan McDowell @ 2022-06-29  9:52 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2637 bytes --]

On Wed, Jun 29, 2022 at 10:38:46AM +0200, Borislav Petkov wrote:
> On Wed, Jun 29, 2022 at 10:52:13AM +0800, kernel test robot wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/kdump
> > head:   69243968bd526641e549ed231c750ce92e3eeb35
> > commit: 69243968bd526641e549ed231c750ce92e3eeb35 [1/1] x86/kexec: Carry forward IMA measurement log on kexec
> 
> I've zapped it from tip for the time being.

This turns out to be the old OF code that can now be hit on x86 when
CONFIG_OF=y because it defines HAVE_IMA_KEXEC. I suspect the warning
already exists on ARM64/PowerPC. Fix is to mark those functions up in
the same manner as the new x86 variants.

Below is on top of what was in tip; I can roll a v7 if preferred but
I think seeing the fix on its own is clearer.
---

ima_free_kexec_buffer() calls into memblock_phys_free() so must be
annotated __meminit. Equally ima_kexec_get_buffer() is executed during
__init so can be marked as such. This was already done in the new x86
IMA kexec passing functions but not for the pre-existing OF based
functions.

Signed-off-by: Jonathan McDowell <noodles@fb.com>
Reported-by: kernel test robot <lkp@intel.com>
---
 drivers/of/kexec.c  | 4 ++--
 include/linux/ima.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
index d3ec430fa403..95cd5532b503 100644
--- a/drivers/of/kexec.c
+++ b/drivers/of/kexec.c
@@ -124,7 +124,7 @@ static int do_get_kexec_buffer(const void *prop, int len, unsigned long *addr,
  *
  * Return: 0 on success, negative errno on error.
  */
-int ima_get_kexec_buffer(void **addr, size_t *size)
+int __init ima_get_kexec_buffer(void **addr, size_t *size)
 {
 	int ret, len;
 	unsigned long tmp_addr;
@@ -148,7 +148,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 __meminit ima_free_kexec_buffer(void)
 {
 	int ret;
 	unsigned long addr;
diff --git a/include/linux/ima.h b/include/linux/ima.h
index ff4bd993e432..8d4698e63190 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -141,8 +141,8 @@ static inline int ima_measure_critical_data(const char *event_label,
 #endif /* CONFIG_IMA */
 
 #ifdef CONFIG_HAVE_IMA_KEXEC
-int ima_free_kexec_buffer(void);
-int ima_get_kexec_buffer(void **addr, size_t *size);
+int __meminit ima_free_kexec_buffer(void);
+int __init ima_get_kexec_buffer(void **addr, size_t *size);
 #endif
 
 #ifdef CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT
-- 
2.36.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] of: Correctly annotate IMA kexec buffer functions
  2022-06-29  9:52     ` Jonathan McDowell
  (?)
@ 2022-06-29 14:01       ` Borislav Petkov
  -1 siblings, 0 replies; 12+ messages in thread
From: Borislav Petkov @ 2022-06-29 14:01 UTC (permalink / raw)
  To: Jonathan McDowell
  Cc: kernel test robot, llvm, kbuild-all, linux-kernel, x86,
	Mimi Zohar, Baoquan He, devicetree, linux-integrity, kexec

On Wed, Jun 29, 2022 at 09:52:50AM +0000, Jonathan McDowell wrote:
> Below is on top of what was in tip; I can roll a v7 if preferred but
> I think seeing the fix on its own is clearer.

Yes, and you don't have to base it on top because, as I've said, I've
zapped your other patch there.

Once IMA folks are fine with that fix of yours I can take both, if they
wish so.

> ima_free_kexec_buffer() calls into memblock_phys_free() so must be
> annotated __meminit.

Why __meminit?

The very sparse comment over it says:

/* Used for MEMORY_HOTPLUG */
#define __meminit        __section(".meminit.text") __cold notrace \
                                                  __latent_entropy

so how does ima_free_kexec_buffer() have anything to do with
MEMORY_HOTPLUG?

It calls memblock_phys_free() which is __init_memblock.

Now __init_memblock is defined as

#define __init_memblock __meminit

for some CONFIG_ARCH_KEEP_MEMBLOCK thing so I guess that is the
connection.

But then the couple other functions which call into memblock are all
__init...

IOW, I probably am missing something...

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] of: Correctly annotate IMA kexec buffer functions
@ 2022-06-29 14:01       ` Borislav Petkov
  0 siblings, 0 replies; 12+ messages in thread
From: Borislav Petkov @ 2022-06-29 14:01 UTC (permalink / raw)
  To: Jonathan McDowell
  Cc: kernel test robot, llvm, kbuild-all, linux-kernel, x86,
	Mimi Zohar, Baoquan He, devicetree, linux-integrity, kexec

On Wed, Jun 29, 2022 at 09:52:50AM +0000, Jonathan McDowell wrote:
> Below is on top of what was in tip; I can roll a v7 if preferred but
> I think seeing the fix on its own is clearer.

Yes, and you don't have to base it on top because, as I've said, I've
zapped your other patch there.

Once IMA folks are fine with that fix of yours I can take both, if they
wish so.

> ima_free_kexec_buffer() calls into memblock_phys_free() so must be
> annotated __meminit.

Why __meminit?

The very sparse comment over it says:

/* Used for MEMORY_HOTPLUG */
#define __meminit        __section(".meminit.text") __cold notrace \
                                                  __latent_entropy

so how does ima_free_kexec_buffer() have anything to do with
MEMORY_HOTPLUG?

It calls memblock_phys_free() which is __init_memblock.

Now __init_memblock is defined as

#define __init_memblock __meminit

for some CONFIG_ARCH_KEEP_MEMBLOCK thing so I guess that is the
connection.

But then the couple other functions which call into memblock are all
__init...

IOW, I probably am missing something...

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] of: Correctly annotate IMA kexec buffer functions
@ 2022-06-29 14:01       ` Borislav Petkov
  0 siblings, 0 replies; 12+ messages in thread
From: Borislav Petkov @ 2022-06-29 14:01 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1223 bytes --]

On Wed, Jun 29, 2022 at 09:52:50AM +0000, Jonathan McDowell wrote:
> Below is on top of what was in tip; I can roll a v7 if preferred but
> I think seeing the fix on its own is clearer.

Yes, and you don't have to base it on top because, as I've said, I've
zapped your other patch there.

Once IMA folks are fine with that fix of yours I can take both, if they
wish so.

> ima_free_kexec_buffer() calls into memblock_phys_free() so must be
> annotated __meminit.

Why __meminit?

The very sparse comment over it says:

/* Used for MEMORY_HOTPLUG */
#define __meminit        __section(".meminit.text") __cold notrace \
                                                  __latent_entropy

so how does ima_free_kexec_buffer() have anything to do with
MEMORY_HOTPLUG?

It calls memblock_phys_free() which is __init_memblock.

Now __init_memblock is defined as

#define __init_memblock __meminit

for some CONFIG_ARCH_KEEP_MEMBLOCK thing so I guess that is the
connection.

But then the couple other functions which call into memblock are all
__init...

IOW, I probably am missing something...

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] of: Correctly annotate IMA kexec buffer functions
  2022-06-29 14:01       ` Borislav Petkov
  (?)
@ 2022-06-29 17:49         ` Jonathan McDowell
  -1 siblings, 0 replies; 12+ messages in thread
From: Jonathan McDowell @ 2022-06-29 17:49 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: kernel test robot, llvm, kbuild-all, linux-kernel, x86,
	Mimi Zohar, Baoquan He, devicetree, linux-integrity, kexec

On Wed, Jun 29, 2022 at 04:01:15PM +0200, Borislav Petkov wrote:
> On Wed, Jun 29, 2022 at 09:52:50AM +0000, Jonathan McDowell wrote:
> > Below is on top of what was in tip; I can roll a v7 if preferred but
> > I think seeing the fix on its own is clearer.
> 
> Yes, and you don't have to base it on top because, as I've said, I've
> zapped your other patch there.
> 
> Once IMA folks are fine with that fix of yours I can take both, if they
> wish so.

I'll roll a v7 collapsing them together and moving to __init as per
below.

> > ima_free_kexec_buffer() calls into memblock_phys_free() so must be
> > annotated __meminit.
> 
> Why __meminit?
> 
> The very sparse comment over it says:
> 
> /* Used for MEMORY_HOTPLUG */
> #define __meminit        __section(".meminit.text") __cold notrace \
>                                                   __latent_entropy
> 
> so how does ima_free_kexec_buffer() have anything to do with
> MEMORY_HOTPLUG?
> 
> It calls memblock_phys_free() which is __init_memblock.
> 
> Now __init_memblock is defined as
> 
> #define __init_memblock __meminit
> 
> for some CONFIG_ARCH_KEEP_MEMBLOCK thing so I guess that is the
> connection.
> 
> But then the couple other functions which call into memblock are all
> __init...
> 
> IOW, I probably am missing something...

I think the answer is that __meminit (or __init_memblock) works out as
the minimum required annotation, because memblock_phys_free() has that
annotation, but having looked closer at the call stack all of the usage
is under ima_init() which is marked __init, so it's more appropriate to
use that and discard the code after boot. There's no need for the ima
related functions to stay hanging around in the case memory hotplug is
enabled, because it's purely a boot time mechanism for passing the
buffer over a kexec boundary.

J.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] of: Correctly annotate IMA kexec buffer functions
@ 2022-06-29 17:49         ` Jonathan McDowell
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan McDowell @ 2022-06-29 17:49 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: kernel test robot, llvm, kbuild-all, linux-kernel, x86,
	Mimi Zohar, Baoquan He, devicetree, linux-integrity, kexec

On Wed, Jun 29, 2022 at 04:01:15PM +0200, Borislav Petkov wrote:
> On Wed, Jun 29, 2022 at 09:52:50AM +0000, Jonathan McDowell wrote:
> > Below is on top of what was in tip; I can roll a v7 if preferred but
> > I think seeing the fix on its own is clearer.
> 
> Yes, and you don't have to base it on top because, as I've said, I've
> zapped your other patch there.
> 
> Once IMA folks are fine with that fix of yours I can take both, if they
> wish so.

I'll roll a v7 collapsing them together and moving to __init as per
below.

> > ima_free_kexec_buffer() calls into memblock_phys_free() so must be
> > annotated __meminit.
> 
> Why __meminit?
> 
> The very sparse comment over it says:
> 
> /* Used for MEMORY_HOTPLUG */
> #define __meminit        __section(".meminit.text") __cold notrace \
>                                                   __latent_entropy
> 
> so how does ima_free_kexec_buffer() have anything to do with
> MEMORY_HOTPLUG?
> 
> It calls memblock_phys_free() which is __init_memblock.
> 
> Now __init_memblock is defined as
> 
> #define __init_memblock __meminit
> 
> for some CONFIG_ARCH_KEEP_MEMBLOCK thing so I guess that is the
> connection.
> 
> But then the couple other functions which call into memblock are all
> __init...
> 
> IOW, I probably am missing something...

I think the answer is that __meminit (or __init_memblock) works out as
the minimum required annotation, because memblock_phys_free() has that
annotation, but having looked closer at the call stack all of the usage
is under ima_init() which is marked __init, so it's more appropriate to
use that and discard the code after boot. There's no need for the ima
related functions to stay hanging around in the case memory hotplug is
enabled, because it's purely a boot time mechanism for passing the
buffer over a kexec boundary.

J.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] of: Correctly annotate IMA kexec buffer functions
@ 2022-06-29 17:49         ` Jonathan McDowell
  0 siblings, 0 replies; 12+ messages in thread
From: Jonathan McDowell @ 2022-06-29 17:49 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1880 bytes --]

On Wed, Jun 29, 2022 at 04:01:15PM +0200, Borislav Petkov wrote:
> On Wed, Jun 29, 2022 at 09:52:50AM +0000, Jonathan McDowell wrote:
> > Below is on top of what was in tip; I can roll a v7 if preferred but
> > I think seeing the fix on its own is clearer.
> 
> Yes, and you don't have to base it on top because, as I've said, I've
> zapped your other patch there.
> 
> Once IMA folks are fine with that fix of yours I can take both, if they
> wish so.

I'll roll a v7 collapsing them together and moving to __init as per
below.

> > ima_free_kexec_buffer() calls into memblock_phys_free() so must be
> > annotated __meminit.
> 
> Why __meminit?
> 
> The very sparse comment over it says:
> 
> /* Used for MEMORY_HOTPLUG */
> #define __meminit        __section(".meminit.text") __cold notrace \
>                                                   __latent_entropy
> 
> so how does ima_free_kexec_buffer() have anything to do with
> MEMORY_HOTPLUG?
> 
> It calls memblock_phys_free() which is __init_memblock.
> 
> Now __init_memblock is defined as
> 
> #define __init_memblock __meminit
> 
> for some CONFIG_ARCH_KEEP_MEMBLOCK thing so I guess that is the
> connection.
> 
> But then the couple other functions which call into memblock are all
> __init...
> 
> IOW, I probably am missing something...

I think the answer is that __meminit (or __init_memblock) works out as
the minimum required annotation, because memblock_phys_free() has that
annotation, but having looked closer at the call stack all of the usage
is under ima_init() which is marked __init, so it's more appropriate to
use that and discard the code after boot. There's no need for the ima
related functions to stay hanging around in the case memory hotplug is
enabled, because it's purely a boot time mechanism for passing the
buffer over a kexec boundary.

J.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-06-29 17:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29  2:52 [tip:x86/kdump 1/1] WARNING: modpost: vmlinux.o(.text+0x1e7210c): Section mismatch in reference from the function ima_free_kexec_buffer() to the function .meminit.text:memblock_phys_free() kernel test robot
2022-06-29  8:38 ` Borislav Petkov
2022-06-29  8:38   ` Borislav Petkov
2022-06-29  9:52   ` [PATCH] of: Correctly annotate IMA kexec buffer functions Jonathan McDowell
2022-06-29  9:52     ` Jonathan McDowell
2022-06-29  9:52     ` Jonathan McDowell
2022-06-29 14:01     ` Borislav Petkov
2022-06-29 14:01       ` Borislav Petkov
2022-06-29 14:01       ` Borislav Petkov
2022-06-29 17:49       ` Jonathan McDowell
2022-06-29 17:49         ` Jonathan McDowell
2022-06-29 17:49         ` Jonathan McDowell

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.