Commit 2981557c authored by Peter Zijlstra's avatar Peter Zijlstra
Browse files

x86,kcfi: Fix EXPORT_SYMBOL vs kCFI



The expectation is that all EXPORT'ed symbols are free to have their
address taken and called indirectly. The majority of the assembly
defined functions currently violate this expectation.

Make then all use SYM_TYPED_FUNC_START() in order to emit the proper
kCFI preamble.

Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
Link: https://lore.kernel.org/r/20250207122546.302679189@infradead.org
parent 72e213a7
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
 */

#include <linux/linkage.h>
#include <linux/cfi_types.h>
#include <asm/frame.h>

#define CAMELLIA_TABLE_BYTE_LEN 272
@@ -882,7 +883,7 @@ SYM_FUNC_START_LOCAL(__camellia_dec_blk16)
	jmp .Ldec_max24;
SYM_FUNC_END(__camellia_dec_blk16)

SYM_FUNC_START(camellia_ecb_enc_16way)
SYM_TYPED_FUNC_START(camellia_ecb_enc_16way)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst (16 blocks)
@@ -907,7 +908,7 @@ SYM_FUNC_START(camellia_ecb_enc_16way)
	RET;
SYM_FUNC_END(camellia_ecb_enc_16way)

SYM_FUNC_START(camellia_ecb_dec_16way)
SYM_TYPED_FUNC_START(camellia_ecb_dec_16way)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst (16 blocks)
@@ -937,7 +938,7 @@ SYM_FUNC_START(camellia_ecb_dec_16way)
	RET;
SYM_FUNC_END(camellia_ecb_dec_16way)

SYM_FUNC_START(camellia_cbc_dec_16way)
SYM_TYPED_FUNC_START(camellia_cbc_dec_16way)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst (16 blocks)
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
 */

#include <linux/linkage.h>
#include <linux/cfi_types.h>
#include <asm/frame.h>

#define CAMELLIA_TABLE_BYTE_LEN 272
+5 −4
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
 */

#include <linux/linkage.h>
#include <linux/cfi_types.h>

.file "camellia-x86_64-asm_64.S"
.text
@@ -177,7 +178,7 @@
	bswapq				RAB0; \
	movq RAB0,			4*2(RIO);

SYM_FUNC_START(__camellia_enc_blk)
SYM_TYPED_FUNC_START(__camellia_enc_blk)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst
@@ -224,7 +225,7 @@ SYM_FUNC_START(__camellia_enc_blk)
	RET;
SYM_FUNC_END(__camellia_enc_blk)

SYM_FUNC_START(camellia_dec_blk)
SYM_TYPED_FUNC_START(camellia_dec_blk)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst
@@ -411,7 +412,7 @@ SYM_FUNC_END(camellia_dec_blk)
		bswapq				RAB1; \
		movq RAB1,			12*2(RIO);

SYM_FUNC_START(__camellia_enc_blk_2way)
SYM_TYPED_FUNC_START(__camellia_enc_blk_2way)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst
@@ -460,7 +461,7 @@ SYM_FUNC_START(__camellia_enc_blk_2way)
	RET;
SYM_FUNC_END(__camellia_enc_blk_2way)

SYM_FUNC_START(camellia_dec_blk_2way)
SYM_TYPED_FUNC_START(camellia_dec_blk_2way)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst
+4 −3
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
 */

#include <linux/linkage.h>
#include <linux/cfi_types.h>
#include <asm/frame.h>
#include "glue_helper-asm-avx.S"

@@ -656,7 +657,7 @@ SYM_FUNC_START_LOCAL(__serpent_dec_blk8_avx)
	RET;
SYM_FUNC_END(__serpent_dec_blk8_avx)

SYM_FUNC_START(serpent_ecb_enc_8way_avx)
SYM_TYPED_FUNC_START(serpent_ecb_enc_8way_avx)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst
@@ -674,7 +675,7 @@ SYM_FUNC_START(serpent_ecb_enc_8way_avx)
	RET;
SYM_FUNC_END(serpent_ecb_enc_8way_avx)

SYM_FUNC_START(serpent_ecb_dec_8way_avx)
SYM_TYPED_FUNC_START(serpent_ecb_dec_8way_avx)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst
@@ -692,7 +693,7 @@ SYM_FUNC_START(serpent_ecb_dec_8way_avx)
	RET;
SYM_FUNC_END(serpent_ecb_dec_8way_avx)

SYM_FUNC_START(serpent_cbc_dec_8way_avx)
SYM_TYPED_FUNC_START(serpent_cbc_dec_8way_avx)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst
+3 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
 */

#include <linux/linkage.h>
#include <linux/cfi_types.h>

.file "twofish-x86_64-asm-3way.S"
.text
@@ -220,7 +221,7 @@
	rorq $32,			RAB2; \
	outunpack3(mov, RIO, 2, RAB, 2);

SYM_FUNC_START(__twofish_enc_blk_3way)
SYM_TYPED_FUNC_START(__twofish_enc_blk_3way)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst
@@ -269,7 +270,7 @@ SYM_FUNC_START(__twofish_enc_blk_3way)
	RET;
SYM_FUNC_END(__twofish_enc_blk_3way)

SYM_FUNC_START(twofish_dec_blk_3way)
SYM_TYPED_FUNC_START(twofish_dec_blk_3way)
	/* input:
	 *	%rdi: ctx, CTX
	 *	%rsi: dst
Loading