]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Add BTI landing pads to the AArch64 SHA2 assembly
authorAndrew Turner <andrew@fubar.geek.nz>
Tue, 3 Oct 2023 22:12:36 +0000 (23:12 +0100)
committerGitHub <noreply@github.com>
Tue, 3 Oct 2023 22:12:36 +0000 (15:12 -0700)
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 <allan@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Signed-off-by: Andrew Turner <andrew.turner4@arm.com>
Closes #14862
Closes #15339

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

index fa50c4e74d5985e55db2e6e189c82005e5115642..7ae486e4e229db67fb668ea3567352e8b7780980 100644 (file)
@@ -49,6 +49,7 @@
 .type  zfs_sha256_block_armv7,%function
 .align 6
 zfs_sha256_block_armv7:
+       hint    #34                                     // bti c
        stp     x29,x30,[sp,#-128]!
        add     x29,sp,#0
 
@@ -1015,6 +1016,7 @@ zfs_sha256_block_armv7:
 .type  zfs_sha256_block_armv8,%function
 .align 6
 zfs_sha256_block_armv8:
+       hint            #34                             // bti c
 .Lv8_entry:
        stp             x29,x30,[sp,#-16]!
        add             x29,sp,#0
@@ -1155,6 +1157,7 @@ zfs_sha256_block_armv8:
 .type  zfs_sha256_block_neon,%function
 .align 4
 zfs_sha256_block_neon:
+       hint    #34                                     // bti c
 .Lneon_entry:
        stp     x29, x30, [sp, #-16]!
        mov     x29, sp
index 1683fc1ca53c8270d3beaf2f886f715132fcb477..9c61eeee4d7bdac394a5f9d51925aceed4bdc373 100644 (file)
@@ -73,6 +73,7 @@
 .type  zfs_sha512_block_armv7,%function
 .align 6
 zfs_sha512_block_armv7:
+       hint    #34                                     // bti c
        stp     x29,x30,[sp,#-128]!
        add     x29,sp,#0
 
@@ -1040,6 +1041,7 @@ zfs_sha512_block_armv7:
 .type  zfs_sha512_block_armv8,%function
 .align 6
 zfs_sha512_block_armv8:
+       hint            #34                             // bti c
 .Lv8_entry:
        // Armv8.3-A PAuth: even though x30 is pushed to stack it is not popped later
        stp             x29,x30,[sp,#-16]!