-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARM: 9385/2: mm: Type-annotate all cache assembly routines
Tag all references to assembly functions with SYM_TYPED_FUNC_START() and SYM_FUNC_END() so they also become CFI-safe. When we add SYM_TYPED_FUNC_START() to assembly calls, a function prototype signature will be emitted into the object file at (pc-4) at the call site, so that the KCFI runtime check can compare this to the expected call. Example: 8011ae38: a540670c .word 0xa540670c 8011ae3c <v7_flush_icache_all>: 8011ae3c: e3a00000 mov r0, #0 8011ae40: ee070f11 mcr 15, 0, r0, cr7, cr1, {0} 8011ae44: e12fff1e bx lr This means no "fallthrough" code can enter a SYM_TYPED_FUNC_START() call from above it: there will be a function prototype signature there, so those are consistently converted to a branch or ret lr depending on context. Tested-by: Kees Cook <keescook@chromium.org> Reviewed-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
- Loading branch information
Linus Walleij
authored and
Russell King (Oracle)
committed
Apr 29, 2024
1 parent
6b0ef27
commit 1036b89
Showing
22 changed files
with
544 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,56 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
#include <linux/linkage.h> | ||
#include <linux/init.h> | ||
#include <linux/cfi_types.h> | ||
#include <asm/assembler.h> | ||
|
||
#include "proc-macros.S" | ||
|
||
ENTRY(nop_flush_icache_all) | ||
SYM_TYPED_FUNC_START(nop_flush_icache_all) | ||
ret lr | ||
ENDPROC(nop_flush_icache_all) | ||
SYM_FUNC_END(nop_flush_icache_all) | ||
|
||
.globl nop_flush_kern_cache_all | ||
.equ nop_flush_kern_cache_all, nop_flush_icache_all | ||
SYM_TYPED_FUNC_START(nop_flush_kern_cache_all) | ||
ret lr | ||
SYM_FUNC_END(nop_flush_kern_cache_all) | ||
|
||
.globl nop_flush_kern_cache_louis | ||
.equ nop_flush_kern_cache_louis, nop_flush_icache_all | ||
|
||
.globl nop_flush_user_cache_all | ||
.equ nop_flush_user_cache_all, nop_flush_icache_all | ||
SYM_TYPED_FUNC_START(nop_flush_user_cache_all) | ||
ret lr | ||
SYM_FUNC_END(nop_flush_user_cache_all) | ||
|
||
.globl nop_flush_user_cache_range | ||
.equ nop_flush_user_cache_range, nop_flush_icache_all | ||
SYM_TYPED_FUNC_START(nop_flush_user_cache_range) | ||
ret lr | ||
SYM_FUNC_END(nop_flush_user_cache_range) | ||
|
||
.globl nop_coherent_kern_range | ||
.equ nop_coherent_kern_range, nop_flush_icache_all | ||
SYM_TYPED_FUNC_START(nop_coherent_kern_range) | ||
ret lr | ||
SYM_FUNC_END(nop_coherent_kern_range) | ||
|
||
ENTRY(nop_coherent_user_range) | ||
SYM_TYPED_FUNC_START(nop_coherent_user_range) | ||
mov r0, 0 | ||
ret lr | ||
ENDPROC(nop_coherent_user_range) | ||
|
||
.globl nop_flush_kern_dcache_area | ||
.equ nop_flush_kern_dcache_area, nop_flush_icache_all | ||
SYM_FUNC_END(nop_coherent_user_range) | ||
|
||
.globl nop_dma_flush_range | ||
.equ nop_dma_flush_range, nop_flush_icache_all | ||
SYM_TYPED_FUNC_START(nop_flush_kern_dcache_area) | ||
ret lr | ||
SYM_FUNC_END(nop_flush_kern_dcache_area) | ||
|
||
.globl nop_dma_map_area | ||
.equ nop_dma_map_area, nop_flush_icache_all | ||
SYM_TYPED_FUNC_START(nop_dma_flush_range) | ||
ret lr | ||
SYM_FUNC_END(nop_dma_flush_range) | ||
|
||
.globl nop_dma_unmap_area | ||
.equ nop_dma_unmap_area, nop_flush_icache_all | ||
SYM_TYPED_FUNC_START(nop_dma_map_area) | ||
ret lr | ||
SYM_FUNC_END(nop_dma_map_area) | ||
|
||
__INITDATA | ||
|
||
@ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S) | ||
define_cache_functions nop | ||
|
||
SYM_TYPED_FUNC_START(nop_dma_unmap_area) | ||
ret lr | ||
SYM_FUNC_END(nop_dma_unmap_area) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.