mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-15 14:32:06 +00:00
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>
57 lines
1.3 KiB
ArmAsm
57 lines
1.3 KiB
ArmAsm
/* 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"
|
|
|
|
SYM_TYPED_FUNC_START(nop_flush_icache_all)
|
|
ret lr
|
|
SYM_FUNC_END(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
|
|
|
|
SYM_TYPED_FUNC_START(nop_flush_user_cache_all)
|
|
ret lr
|
|
SYM_FUNC_END(nop_flush_user_cache_all)
|
|
|
|
SYM_TYPED_FUNC_START(nop_flush_user_cache_range)
|
|
ret lr
|
|
SYM_FUNC_END(nop_flush_user_cache_range)
|
|
|
|
SYM_TYPED_FUNC_START(nop_coherent_kern_range)
|
|
ret lr
|
|
SYM_FUNC_END(nop_coherent_kern_range)
|
|
|
|
SYM_TYPED_FUNC_START(nop_coherent_user_range)
|
|
mov r0, 0
|
|
ret lr
|
|
SYM_FUNC_END(nop_coherent_user_range)
|
|
|
|
SYM_TYPED_FUNC_START(nop_flush_kern_dcache_area)
|
|
ret lr
|
|
SYM_FUNC_END(nop_flush_kern_dcache_area)
|
|
|
|
SYM_TYPED_FUNC_START(nop_dma_flush_range)
|
|
ret lr
|
|
SYM_FUNC_END(nop_dma_flush_range)
|
|
|
|
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)
|