Skip to content

Commit d2852a2

Browse files
borkmanndavem330
authored andcommitted
arch: add ARCH_HAS_SET_MEMORY config
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 <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 559c59b commit d2852a2

File tree

5 files changed

+8
-0
lines changed

5 files changed

+8
-0
lines changed

arch/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ config GENERIC_SMP_IDLE_THREAD
222222
config GENERIC_IDLE_POLL_SETUP
223223
bool
224224

225+
# Select if arch has all set_memory_ro/rw/x/nx() functions in asm/cacheflush.h
226+
config ARCH_HAS_SET_MEMORY
227+
bool
228+
225229
# Select if arch init_task initializer is different to init/init_task.c
226230
config ARCH_INIT_TASK
227231
bool

arch/arm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ config ARM
44
select ARCH_CLOCKSOURCE_DATA
55
select ARCH_HAS_DEVMEM_IS_ALLOWED
66
select ARCH_HAS_ELF_RANDOMIZE
7+
select ARCH_HAS_SET_MEMORY
78
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
89
select ARCH_HAVE_CUSTOM_GPIO_H
910
select ARCH_HAS_GCOV_PROFILE_ALL

arch/arm64/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ config ARM64
1212
select ARCH_HAS_GCOV_PROFILE_ALL
1313
select ARCH_HAS_GIGANTIC_PAGE
1414
select ARCH_HAS_KCOV
15+
select ARCH_HAS_SET_MEMORY
1516
select ARCH_HAS_SG_CHAIN
1617
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
1718
select ARCH_USE_CMPXCHG_LOCKREF

arch/s390/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ config S390
7272
select ARCH_HAS_GCOV_PROFILE_ALL
7373
select ARCH_HAS_GIGANTIC_PAGE
7474
select ARCH_HAS_KCOV
75+
select ARCH_HAS_SET_MEMORY
7576
select ARCH_HAS_SG_CHAIN
7677
select ARCH_HAS_UBSAN_SANITIZE_ALL
7778
select ARCH_HAVE_NMI_SAFE_CMPXCHG

arch/x86/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ config X86
5353
select ARCH_HAS_KCOV if X86_64
5454
select ARCH_HAS_MMIO_FLUSH
5555
select ARCH_HAS_PMEM_API if X86_64
56+
select ARCH_HAS_SET_MEMORY
5657
select ARCH_HAS_SG_CHAIN
5758
select ARCH_HAS_UBSAN_SANITIZE_ALL
5859
select ARCH_HAVE_NMI_SAFE_CMPXCHG

0 commit comments

Comments
 (0)