Skip to contentSkip to conversation

arm64: fix the mm build error in mm/kfence/core.c

PATCH In review Hui Su 3 participants 5 messages Dec 5, 2020 – Dec 7, 2020

Subsystems (2)
lore
Share & tools
lore

Hui Su

author
#0 lore raw

PATCH 1/1 arm64: fix the mm build error in mm/kfence/core.c

When I build kernel with ARCH=arm64, the building errors came out like this:
CC mm/kfence/core.o
In file included from ../mm/kfence/core.c:21:
../arch/arm64/include/asm/kfence.h: In function ‘kfence_protect_page’:
../arch/arm64/include/asm/kfence.h:12:2: error: implicit declaration of function ‘set_memory_valid’ [-Werror=implicit-function-declaration]

   12 |  set_memory_valid(addr, 1, !protect);
      |  ^~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

which introduced by commit d54febeba2ff ("kfence: use pt_regs to generate stack trace on faults").

---
 arch/arm64/include/asm/kfence.h | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/include/asm/kfence.h +1 -0
index 6c0afeeab635..4d73e34da59d 100644
@@ -4,6 +4,7 @@
 #define __ASM_KFENCE_H
 
 #include <asm/cacheflush.h>
+#include <linux/set_memory.h>
 
 static inline bool arch_kfence_init_pool(void) { return true; }
 
Signature · 8 lines
2.25.1



_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

Hi all,

[Cc'd Andrew Morton]

Quoted 34 lines · On Sun, 6 Dec 2020 01:22:07 +0800 Hui Su <[email protected]> wrote:

When I build kernel with ARCH=arm64, the building errors came out like this:
CC mm/kfence/core.o
In file included from ../mm/kfence/core.c:21:
../arch/arm64/include/asm/kfence.h: In function ‘kfence_protect_page’:
../arch/arm64/include/asm/kfence.h:12:2: error: implicit declaration of function ‘set_memory_valid’ [-Werror=implicit-function-declaration]

   12 |  set_memory_valid(addr, 1, !protect);
      |  ^~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

which introduced by commit d54febeba2ff ("kfence: use pt_regs to generate stack trace on faults").

---
 arch/arm64/include/asm/kfence.h | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/include/asm/kfence.h +1 -0
index 6c0afeeab635..4d73e34da59d 100644
@@ -4,6 +4,7 @@
 #define __ASM_KFENCE_H
 
 #include <asm/cacheflush.h>
+#include <linux/set_memory.h>
 
 static inline bool arch_kfence_init_pool(void) { return true; }
 
Signature · 1 line
2.25.1

Added to linux-next today. I think it actually fixes patch "arm64,
kfence: enable KFENCE for ARM64" since that actually introduces the set_memory_valid() call?

Signature · 2 lines
Cheers,
Stephen Rothwell
maintainer
#2 lore raw
Quoted 25 lines · Stephen Rothwell

Hi all,

[Cc'd Andrew Morton]

Quoted 19 lines · On Sun, 6 Dec 2020 01:22:07 +0800 Hui Su <[email protected]> wrote:

When I build kernel with ARCH=arm64, the building errors came out like this:
CC mm/kfence/core.o
In file included from ../mm/kfence/core.c:21:
../arch/arm64/include/asm/kfence.h: In function ‘kfence_protect_page’:
../arch/arm64/include/asm/kfence.h:12:2: error: implicit declaration of function ‘set_memory_valid’ [-Werror=implicit-function-declaration]

   12 |  set_memory_valid(addr, 1, !protect);
      |  ^~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

which introduced by commit d54febeba2ff ("kfence: use pt_regs to generate stack trace on faults").

---
 arch/arm64/include/asm/kfence.h | 1 +
 1 file changed, 1 insertion(+)

Thanks, but a patch for this is already in the -mm tree:
https://lore.kernel.org/mm-commits/20201205011409.o9PNsRntR%[email protected]/

Perhaps try the latest -next?

Quoted 10 lines
Quoted 10 lines
arch/arm64/include/asm/kfence.h +1 -0
index 6c0afeeab635..4d73e34da59d 100644
@@ -4,6 +4,7 @@
 #define __ASM_KFENCE_H
 
 #include <asm/cacheflush.h>
+#include <linux/set_memory.h>
 
Quoted 8 lines
Quoted 4 lines
arch/arm64/include/asm/kfence.h +0 -1
 static inline bool arch_kfence_init_pool(void) { return true; }
 
--

2.25.1

Added to linux-next today. I think it actually fixes patch "arm64,
kfence: enable KFENCE for ARM64" since that actually introduces the set_memory_valid() call?

The patch that moved the declaration was after the kfence patch, so it'd be the other way around:
https://lkml.kernel.org/r/[email protected]

Thanks,
-- Marco

maintainer
#3 lore raw
Quoted 1 line · Marco Elver

On Sun, 6 Dec 2020 at 22:23, Stephen Rothwell <[email protected]> wrote:

[...]

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines

../arch/arm64/include/asm/kfence.h:12:2: error: implicit declaration of function ‘set_memory_valid’ [-Werror=implicit-function-declaration]

   12 |  set_memory_valid(addr, 1, !protect);
      |  ^~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

Quoted 7 lines
Quoted 7 lines

which introduced by commit d54febeba2ff ("kfence: use pt_regs to generate stack trace on faults").

---
 arch/arm64/include/asm/kfence.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 4 lines

Thanks, but a patch for this is already in the -mm tree:
https://lore.kernel.org/mm-commits/20201205011409.o9PNsRntR%[email protected]/

Perhaps try the latest -next?

Although I notice that patch somehow was dropped from -mm, or maybe I'm not looking hard enough?

Quoted 9 lines
Quoted 9 lines

arch/arm64/include/asm/kfence.h line 7

Quoted 9 lines
arch/arm64/include/asm/kfence.h +1 -0
index 6c0afeeab635..4d73e34da59d 100644
@@ -4,6 +4,7 @@
 #define __ASM_KFENCE_H
 
 #include <asm/cacheflush.h>
+#include <linux/set_memory.h>

I preferred the patch at

https://lore.kernel.org/mm-commits/20201205011409.o9PNsRntR%[email protected]/

because it removed <asm/cacheflush.h> and only included <asm/set_memory.h>.

I hope the right patch finds its way into the queue. :-)

Thanks,
-- Marco

Quoted 15 lines
Quoted 8 lines
Quoted 4 lines
arch/arm64/include/asm/kfence.h +0 -1
 static inline bool arch_kfence_init_pool(void) { return true; }
 
--

2.25.1

Added to linux-next today. I think it actually fixes patch "arm64,
kfence: enable KFENCE for ARM64" since that actually introduces the set_memory_valid() call?

The patch that moved the declaration was after the kfence patch, so it'd be the other way around:
https://lkml.kernel.org/r/[email protected]

Thanks,
-- Marco

#4 lore raw

Hi Marco,

Quoted 18 lines · On Mon, 7 Dec 2020 15:52:07 +0100 Marco Elver <[email protected]> wrote:
Quoted 1 line · Marco Elver

On Sun, 6 Dec 2020 at 22:23, Stephen Rothwell <[email protected]> wrote:

[...]

Quoted 14 lines
Quoted 13 lines
Quoted 13 lines

../arch/arm64/include/asm/kfence.h:12:2: error: implicit declaration of function ‘set_memory_valid’ [-Werror=implicit-function-declaration]

   12 |  set_memory_valid(addr, 1, !protect);
      |  ^~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

which introduced by commit d54febeba2ff ("kfence: use pt_regs to generate stack trace on faults").

---
 arch/arm64/include/asm/kfence.h | 1 +
 1 file changed, 1 insertion(+)  
Quoted 7 lines
Quoted 4 lines

Thanks, but a patch for this is already in the -mm tree:
https://lore.kernel.org/mm-commits/20201205011409.o9PNsRntR%[email protected]/

Perhaps try the latest -next?

Although I notice that patch somehow was dropped from -mm, or maybe I'm not looking hard enough?

It may just be that Andrew has not published that version of his patch series yet.

Signature · 2 lines
Cheers,
Stephen Rothwell