]> git.proxmox.com Git - mirror_zfs.git/commitdiff
icp: fix rodata being marked as text in x86 Asm code
authorAlexander Lobakin <alobakin@pm.me>
Sun, 16 Oct 2022 21:23:44 +0000 (23:23 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 4 Nov 2022 18:25:51 +0000 (11:25 -0700)
objtool properly complains that it can't decode some of the
instructions from ICP x86 Asm code. As mentioned in the Makefile,
where those object files were excluded from objtool check (but they
can still be visible under IBT and LTO), those are just constants,
not code.
In that case, they must be placed in .rodata, so they won't be
marked as "allocatable, executable" (ax) in EFL headers and this
effectively prevents objtool from trying to decode this data. That
reveals a whole bunch of other issues in ICP Asm code, as previously
objtool was bailing out after that warning message.

Reviewed-by: Attila Fülöp <attila@fueloep.org>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Closes #14035

module/Kbuild.in
module/icp/asm-x86_64/modes/aesni-gcm-x86_64.S
module/icp/asm-x86_64/modes/ghash-x86_64.S

index 7a20e6ee4615d51a47ca3692c8febfa69aad1c32..581d50e64b4257e25d791f7cc84750040a4075c2 100644 (file)
@@ -150,12 +150,8 @@ $(addprefix $(obj)/icp/,$(ICP_OBJS) $(ICP_OBJS_X86) $(ICP_OBJS_X86_64) \
 $(addprefix $(obj)/icp/,$(ICP_OBJS) $(ICP_OBJS_X86) $(ICP_OBJS_X86_64) \
        $(ICP_OBJS_ARM64) $(ICP_OBJS_PPC_PPC64)) : ccflags-y += -I$(icp_include)
 
-# Suppress objtool "can't find jump dest instruction at" warnings.  They
-# are caused by the constants which are defined in the text section of the
-# assembly file using .byte instructions (e.g. bswap_mask).  The objtool
-# utility tries to interpret them as opcodes and obviously fails doing so.
+# Suppress objtool "return with modified stack frame" warnings.
 OBJECT_FILES_NON_STANDARD_aesni-gcm-x86_64.o := y
-OBJECT_FILES_NON_STANDARD_ghash-x86_64.o := y
 
 # Suppress objtool "unsupported stack pointer realignment" warnings. We are
 # not using a DRAP register while aligning the stack to a 64 byte boundary.
index 7414b3540f34b3f41bcfeef88054781519859ff9..6da43ee00597a65957990f3c9fa9939997094943 100644 (file)
@@ -1242,6 +1242,7 @@ atomic_toggle_boolean_nv:
        RET
 .size  atomic_toggle_boolean_nv,.-atomic_toggle_boolean_nv
 
+.pushsection .rodata
 .align 64
 .Lbswap_mask:
 .byte  15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
@@ -1255,6 +1256,7 @@ atomic_toggle_boolean_nv:
 .byte  1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 .byte  65,69,83,45,78,73,32,71,67,77,32,109,111,100,117,108,101,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
 .align 64
+.popsection
 
 /* Mark the stack non-executable. */
 #if defined(__linux__) && defined(__ELF__)
index 77a3ce18595276d66a6dbe7fbba63c6a5c0485e6..d7cdaeb368d71983e4cdefef559922dcb5defc67 100644 (file)
@@ -655,6 +655,8 @@ gcm_ghash_avx:
        RET
 .cfi_endproc
 .size  gcm_ghash_avx,.-gcm_ghash_avx
+
+.pushsection .rodata
 .align 64
 .Lbswap_mask:
 .byte  15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
@@ -708,6 +710,7 @@ gcm_ghash_avx:
 
 .byte  71,72,65,83,72,32,102,111,114,32,120,56,54,95,54,52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
 .align 64
+.popsection
 
 /* Mark the stack non-executable. */
 #if defined(__linux__) && defined(__ELF__)