Skip to content

Commit f795e90

Browse files
authored
Add BTI landing pads to the AArch64 SHA2 assembly
The Arm Branch Target Identification (BTI) extension guards against branching to an unintended instruction. To support BTI add the landing pad instructions to the SHA2 functions. These are from the hint space so are a nop on hardware that lacks BTI support or if BTI isn't enabled. Reviewed-by: Allan Jude <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Andrew Turner <[email protected]> Closes #14862 Closes #15339
1 parent eb955f6 commit f795e90

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

module/icp/asm-aarch64/sha2/sha256-armv8.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
.type zfs_sha256_block_armv7,%function
5050
.align 6
5151
zfs_sha256_block_armv7:
52+
hint #34 // bti c
5253
stp x29,x30,[sp,#-128]!
5354
add x29,sp,#0
5455

@@ -1015,6 +1016,7 @@ zfs_sha256_block_armv7:
10151016
.type zfs_sha256_block_armv8,%function
10161017
.align 6
10171018
zfs_sha256_block_armv8:
1019+
hint #34 // bti c
10181020
.Lv8_entry:
10191021
stp x29,x30,[sp,#-16]!
10201022
add x29,sp,#0
@@ -1155,6 +1157,7 @@ zfs_sha256_block_armv8:
11551157
.type zfs_sha256_block_neon,%function
11561158
.align 4
11571159
zfs_sha256_block_neon:
1160+
hint #34 // bti c
11581161
.Lneon_entry:
11591162
stp x29, x30, [sp, #-16]!
11601163
mov x29, sp

module/icp/asm-aarch64/sha2/sha512-armv8.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
.type zfs_sha512_block_armv7,%function
7474
.align 6
7575
zfs_sha512_block_armv7:
76+
hint #34 // bti c
7677
stp x29,x30,[sp,#-128]!
7778
add x29,sp,#0
7879

@@ -1040,6 +1041,7 @@ zfs_sha512_block_armv7:
10401041
.type zfs_sha512_block_armv8,%function
10411042
.align 6
10421043
zfs_sha512_block_armv8:
1044+
hint #34 // bti c
10431045
.Lv8_entry:
10441046
// Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later
10451047
stp x29,x30,[sp,#-16]!

0 commit comments

Comments
 (0)