5104bd
From 72e6d27e08c86c16e8931739a5e6ecbc06b102d5 Mon Sep 17 00:00:00 2001
5104bd
From: "H.J. Lu" <hjl.tools@gmail.com>
5104bd
Date: Thu, 20 Jan 2022 05:40:56 -0800
5104bd
Subject: [PATCH] spdk/isa-l/CET: Add CET marker to x86-64 crc32 assembly codes
5104bd
5104bd
Add .note.gnu.property section to x86-64 crc32 assembly codes to mark
5104bd
for IBT and SHSTK compatibility.
5104bd
---
5104bd
 crc/crc32_gzip_refl_by8.asm | 9 +++++++++
5104bd
 crc/crc32_ieee_01.asm       | 8 ++++++++
5104bd
 crc/crc32_ieee_by4.asm      | 9 +++++++++
5104bd
 crc/crc32_iscsi_00.asm      | 8 ++++++++
5104bd
 crc/crc32_iscsi_01.asm      | 8 ++++++++
5104bd
 5 files changed, 42 insertions(+)
5104bd
5104bd
diff --git a/src/spdk/isa-l/crc/crc32_gzip_refl_by8.asm b/src/spdk/isa-l/crc/crc32_gzip_refl_by8.asm
5104bd
index 62f7e7d..97b0c4a 100644
5104bd
--- a/src/spdk/isa-l/crc/crc32_gzip_refl_by8.asm
5104bd
+++ b/src/spdk/isa-l/crc/crc32_gzip_refl_by8.asm
5104bd
@@ -622,3 +622,12 @@ dq 0x0706050403020100, 0x000e0d0c0b0a0908
5104bd
 
5104bd
 ;;;       func        core, ver, snum
5104bd
 slversion crc32_gzip_refl_by8, 01,   00,  002c
5104bd
+
5104bd
+%ifidn __OUTPUT_FORMAT__, elf64
5104bd
+; inform linker that this doesn't require executable stack
5104bd
+section .note.GNU-stack noalloc noexec nowrite progbits
5104bd
+; inform linker that this is compatible with IBT and SHSTK
5104bd
+section .note.gnu.property  note  alloc noexec align=8
5104bd
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
5104bd
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
5104bd
+%endif
5104bd
diff --git a/src/spdk/isa-l/crc/crc32_ieee_01.asm b/src/spdk/isa-l/crc/crc32_ieee_01.asm
5104bd
index 32495ed..cfc443b 100644
5104bd
--- a/src/spdk/isa-l/crc/crc32_ieee_01.asm
5104bd
+++ b/src/spdk/isa-l/crc/crc32_ieee_01.asm
5104bd
@@ -653,3 +653,11 @@ dq 0x0706050403020100, 0x000e0d0c0b0a0908
5104bd
 ;;;       func        core, ver, snum
5104bd
 slversion crc32_ieee_01, 01,   06,  0011
5104bd
 
5104bd
+%ifidn __OUTPUT_FORMAT__, elf64
5104bd
+; inform linker that this doesn't require executable stack
5104bd
+section .note.GNU-stack noalloc noexec nowrite progbits
5104bd
+; inform linker that this is compatible with IBT and SHSTK
5104bd
+section .note.gnu.property  note  alloc noexec align=8
5104bd
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
5104bd
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
5104bd
+%endif
5104bd
diff --git a/src/spdk/isa-l/crc/crc32_ieee_by4.asm b/src/spdk/isa-l/crc/crc32_ieee_by4.asm
5104bd
index 39bed5a..847d0bd 100644
5104bd
--- a/src/spdk/isa-l/crc/crc32_ieee_by4.asm
5104bd
+++ b/src/spdk/isa-l/crc/crc32_ieee_by4.asm
5104bd
@@ -563,3 +563,12 @@ SHUF_MASK	dq 0x08090A0B0C0D0E0F, 0x0001020304050607
5104bd
 
5104bd
 ;;;       func             core, ver, snum
5104bd
 slversion crc32_ieee_by4, 05,   02,  0017
5104bd
+
5104bd
+%ifidn __OUTPUT_FORMAT__, elf64
5104bd
+; inform linker that this doesn't require executable stack
5104bd
+section .note.GNU-stack noalloc noexec nowrite progbits
5104bd
+; inform linker that this is compatible with IBT and SHSTK
5104bd
+section .note.gnu.property  note  alloc noexec align=8
5104bd
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
5104bd
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
5104bd
+%endif
5104bd
diff --git a/src/spdk/isa-l/crc/crc32_iscsi_00.asm b/src/spdk/isa-l/crc/crc32_iscsi_00.asm
5104bd
index 4f81e3a..3d6b2d1 100644
5104bd
--- a/src/spdk/isa-l/crc/crc32_iscsi_00.asm
5104bd
+++ b/src/spdk/isa-l/crc/crc32_iscsi_00.asm
5104bd
@@ -669,3 +669,11 @@ DD 0x54851c7f,0x89e3d7c4,0xeba4fdf8,0x36c23643
5104bd
 ;;;       func            core, ver, snum
5104bd
 slversion crc32_iscsi_00, 00,   04,  0014
5104bd
 
5104bd
+%ifidn __OUTPUT_FORMAT__, elf64
5104bd
+; inform linker that this doesn't require executable stack
5104bd
+section .note.GNU-stack noalloc noexec nowrite progbits
5104bd
+; inform linker that this is compatible with IBT and SHSTK
5104bd
+section .note.gnu.property  note  alloc noexec align=8
5104bd
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
5104bd
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
5104bd
+%endif
5104bd
diff --git a/src/spdk/isa-l/crc/crc32_iscsi_01.asm b/src/spdk/isa-l/crc/crc32_iscsi_01.asm
5104bd
index 2a81517..c048413 100644
5104bd
--- a/src/spdk/isa-l/crc/crc32_iscsi_01.asm
5104bd
+++ b/src/spdk/isa-l/crc/crc32_iscsi_01.asm
5104bd
@@ -588,3 +588,11 @@ K_table:
5104bd
 ;;;       func            core, ver, snum
5104bd
 slversion crc32_iscsi_01, 01,   04,  0015
5104bd
 
5104bd
+%ifidn __OUTPUT_FORMAT__, elf64
5104bd
+; inform linker that this doesn't require executable stack
5104bd
+section .note.GNU-stack noalloc noexec nowrite progbits
5104bd
+; inform linker that this is compatible with IBT and SHSTK
5104bd
+section .note.gnu.property  note  alloc noexec align=8
5104bd
+DD 0x00000004,0x00000010,0x00000005,0x00554e47
5104bd
+DD 0xc0000002,0x00000004,0x00000003,0x00000000
5104bd
+%endif
5104bd
-- 
5104bd
2.34.1
5104bd