arch: add ARCH_HAS_SET_MEMORY config
authorDaniel Borkmann <daniel@iogearbox.net>
Tue, 21 Feb 2017 15:09:33 +0000 (16:09 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Feb 2017 18:30:13 +0000 (13:30 -0500)
Currently, there's no good way to test for the presence of
set_memory_ro/rw/x/nx() helpers implemented by archs such as
x86, arm, arm64 and s390.

There's DEBUG_SET_MODULE_RONX and DEBUG_RODATA, however both
don't really reflect that: set_memory_*() are also available
even when DEBUG_SET_MODULE_RONX is turned off, and DEBUG_RODATA
is set by parisc, but doesn't implement above functions. Thus,
add ARCH_HAS_SET_MEMORY that is selected by mentioned archs,
where generic code can test against this.

This also allows later on to move DEBUG_SET_MODULE_RONX out of
the arch specific Kconfig to define it only once depending on
ARCH_HAS_SET_MEMORY.

Suggested-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/Kconfig
arch/arm/Kconfig
arch/arm64/Kconfig
arch/s390/Kconfig
arch/x86/Kconfig

index bd04eace455c643eb7c7480c865b10baba6545b1..e8ada79ec71f6ad4e666dcdf86f2bb9523ae11b8 100644 (file)
@@ -222,6 +222,10 @@ config GENERIC_SMP_IDLE_THREAD
 config GENERIC_IDLE_POLL_SETUP
        bool
 
+# Select if arch has all set_memory_ro/rw/x/nx() functions in asm/cacheflush.h
+config ARCH_HAS_SET_MEMORY
+       bool
+
 # Select if arch init_task initializer is different to init/init_task.c
 config ARCH_INIT_TASK
        bool
index 186c4c214e0a756b4468b597d5680093408c28c3..edae056b2af03f5c281f563f2652c025a8204170 100644 (file)
@@ -4,6 +4,7 @@ config ARM
        select ARCH_CLOCKSOURCE_DATA
        select ARCH_HAS_DEVMEM_IS_ALLOWED
        select ARCH_HAS_ELF_RANDOMIZE
+       select ARCH_HAS_SET_MEMORY
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
        select ARCH_HAVE_CUSTOM_GPIO_H
        select ARCH_HAS_GCOV_PROFILE_ALL
index 1117421268976b62dd4e77cd3a523c10070f3ace..1853405a897e78fd301f119b6a5ae2bd68a230e3 100644 (file)
@@ -12,6 +12,7 @@ config ARM64
        select ARCH_HAS_GCOV_PROFILE_ALL
        select ARCH_HAS_GIGANTIC_PAGE
        select ARCH_HAS_KCOV
+       select ARCH_HAS_SET_MEMORY
        select ARCH_HAS_SG_CHAIN
        select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
        select ARCH_USE_CMPXCHG_LOCKREF
index c6722112527d6ed5937bd98870dbb8fb843b3dd1..094deb1abbe7bac595a0f5bc258410eb3fbc39b1 100644 (file)
@@ -72,6 +72,7 @@ config S390
        select ARCH_HAS_GCOV_PROFILE_ALL
        select ARCH_HAS_GIGANTIC_PAGE
        select ARCH_HAS_KCOV
+       select ARCH_HAS_SET_MEMORY
        select ARCH_HAS_SG_CHAIN
        select ARCH_HAS_UBSAN_SANITIZE_ALL
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
index e487493bbd47f0f84caed99f6c952bf6b3062413..434dd2a1c5f2d62845dda0f2fe5eb009c1c9d6a1 100644 (file)
@@ -53,6 +53,7 @@ config X86
        select ARCH_HAS_KCOV                    if X86_64
        select ARCH_HAS_MMIO_FLUSH
        select ARCH_HAS_PMEM_API                if X86_64
+       select ARCH_HAS_SET_MEMORY
        select ARCH_HAS_SG_CHAIN
        select ARCH_HAS_UBSAN_SANITIZE_ALL
        select ARCH_HAVE_NMI_SAFE_CMPXCHG