Skip to content

Commit b608b95

Browse files
Linux build: silence objtool warnings
After openzfs#17401 the Linux build produces some stack related warnings. Silence them with the `STACK_FRAME_NON_STANDARD` macro. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Attila Fülöp <[email protected]> Co-authored-by: Brian Behlendorf <[email protected]> Closes openzfs#17410
1 parent d0ea4c6 commit b608b95

File tree

5 files changed

+74
-0
lines changed

5 files changed

+74
-0
lines changed

config/kernel-objtool.m4

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ AC_DEFUN([ZFS_AC_KERNEL_OBJTOOL_HEADER], [
1111
#include <linux/objtool.h>
1212
],[
1313
],[
14+
objtool_header=$LINUX/include/linux/objtool.h
1415
AC_DEFINE(HAVE_KERNEL_OBJTOOL_HEADER, 1,
1516
[kernel has linux/objtool.h])
1617
AC_MSG_RESULT(linux/objtool.h)
1718
],[
19+
objtool_header=$LINUX/include/linux/frame.h
1820
AC_MSG_RESULT(linux/frame.h)
1921
])
2022
])
@@ -62,6 +64,23 @@ AC_DEFUN([ZFS_AC_KERNEL_OBJTOOL], [
6264
AC_MSG_RESULT(yes)
6365
AC_DEFINE(HAVE_STACK_FRAME_NON_STANDARD, 1,
6466
[STACK_FRAME_NON_STANDARD is defined])
67+
68+
dnl # Needed for kernels missing the asm macro. We grep
69+
dnl # for it in the header file since there is currently
70+
dnl # no test to check the result of assembling a file.
71+
AC_MSG_CHECKING(
72+
[whether STACK_FRAME_NON_STANDARD asm macro is defined])
73+
dnl # Escape square brackets.
74+
sp='@<:@@<:@:space:@:>@@:>@'
75+
dotmacro='@<:@.@:>@macro'
76+
regexp="^$sp*$dotmacro$sp+STACK_FRAME_NON_STANDARD$sp"
77+
AS_IF([$EGREP -s -q "$regexp" $objtool_header],[
78+
AC_MSG_RESULT(yes)
79+
AC_DEFINE(HAVE_STACK_FRAME_NON_STANDARD_ASM, 1,
80+
[STACK_FRAME_NON_STANDARD asm macro is defined])
81+
],[
82+
AC_MSG_RESULT(no)
83+
])
6584
],[
6685
AC_MSG_RESULT(no)
6786
])

include/sys/frame.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,16 @@ extern "C" {
3030
#else
3131
#include <linux/frame.h>
3232
#endif
33+
#if defined(_ASM) && ! defined(HAVE_STACK_FRAME_NON_STANDARD_ASM)
34+
.macro STACK_FRAME_NON_STANDARD func:req
35+
.endm
36+
#endif
3337
#else
3438
#define STACK_FRAME_NON_STANDARD(func)
39+
#if defined(_ASM)
40+
.macro STACK_FRAME_NON_STANDARD func:req
41+
.endm
42+
#endif
3543
#endif
3644

3745
#ifdef __cplusplus

module/icp/asm-x86_64/modes/aesni-gcm-x86_64.S

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
#define _ASM
5151
#include <sys/asm_linkage.h>
52+
#include <sys/frame.h>
5253

5354
/* Windows userland links with OpenSSL */
5455
#if !defined (_WIN32) || defined (_KERNEL)
@@ -377,6 +378,7 @@ FUNCTION(_aesni_ctr32_ghash_6x)
377378
RET
378379
.cfi_endproc
379380
SET_SIZE(_aesni_ctr32_ghash_6x)
381+
STACK_FRAME_NON_STANDARD _aesni_ctr32_ghash_6x
380382
#endif /* ifdef HAVE_MOVBE */
381383

382384
.balign 32
@@ -705,6 +707,7 @@ FUNCTION(_aesni_ctr32_ghash_no_movbe_6x)
705707
RET
706708
.cfi_endproc
707709
SET_SIZE(_aesni_ctr32_ghash_no_movbe_6x)
710+
STACK_FRAME_NON_STANDARD _aesni_ctr32_ghash_no_movbe_6x
708711

709712
ENTRY_ALIGN(aesni_gcm_decrypt, 32)
710713
.cfi_startproc
@@ -822,6 +825,7 @@ ENTRY_ALIGN(aesni_gcm_decrypt, 32)
822825
RET
823826
.cfi_endproc
824827
SET_SIZE(aesni_gcm_decrypt)
828+
STACK_FRAME_NON_STANDARD aesni_gcm_decrypt
825829

826830
.balign 32
827831
FUNCTION(_aesni_ctr32_6x)
@@ -1197,6 +1201,7 @@ ENTRY_ALIGN(aesni_gcm_encrypt, 32)
11971201
RET
11981202
.cfi_endproc
11991203
SET_SIZE(aesni_gcm_encrypt)
1204+
STACK_FRAME_NON_STANDARD aesni_gcm_encrypt
12001205

12011206
#endif /* !_WIN32 || _KERNEL */
12021207

@@ -1256,6 +1261,18 @@ SECTION_STATIC
12561261
.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
12571262
.balign 64
12581263

1264+
/* Workaround for missing asm macro in RHEL 8. */
1265+
#if defined(__linux__) && defined(HAVE_STACK_FRAME_NON_STANDARD) && \
1266+
! defined(HAVE_STACK_FRAME_NON_STANDARD_ASM)
1267+
.section .discard.func_stack_frame_non_standard, "aw"
1268+
#ifdef HAVE_MOVBE
1269+
.long _aesni_ctr32_ghash_6x - .
1270+
#endif
1271+
.long _aesni_ctr32_ghash_no_movbe_6x - .
1272+
.long aesni_gcm_decrypt - .
1273+
.long aesni_gcm_encrypt - .
1274+
#endif
1275+
12591276
/* Mark the stack non-executable. */
12601277
#if defined(__linux__) && defined(__ELF__)
12611278
.section .note.GNU-stack,"",%progbits

module/icp/asm-x86_64/sha2/sha256-x86_64.S

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#define _ASM
2525
#include <sys/asm_linkage.h>
26+
#include <sys/frame.h>
2627

2728
SECTION_STATIC
2829

@@ -1419,6 +1420,7 @@ ENTRY_ALIGN(zfs_sha256_transform_x64, 16)
14191420
RET
14201421
.cfi_endproc
14211422
SET_SIZE(zfs_sha256_transform_x64)
1423+
STACK_FRAME_NON_STANDARD zfs_sha256_transform_x64
14221424

14231425
ENTRY_ALIGN(zfs_sha256_transform_shani, 64)
14241426
.cfi_startproc
@@ -1627,6 +1629,7 @@ ENTRY_ALIGN(zfs_sha256_transform_shani, 64)
16271629
RET
16281630
.cfi_endproc
16291631
SET_SIZE(zfs_sha256_transform_shani)
1632+
STACK_FRAME_NON_STANDARD zfs_sha256_transform_shani
16301633

16311634
ENTRY_ALIGN(zfs_sha256_transform_ssse3, 64)
16321635
.cfi_startproc
@@ -2738,6 +2741,7 @@ ENTRY_ALIGN(zfs_sha256_transform_ssse3, 64)
27382741
RET
27392742
.cfi_endproc
27402743
SET_SIZE(zfs_sha256_transform_ssse3)
2744+
STACK_FRAME_NON_STANDARD zfs_sha256_transform_ssse3
27412745

27422746
ENTRY_ALIGN(zfs_sha256_transform_avx, 64)
27432747
.cfi_startproc
@@ -3812,6 +3816,7 @@ ENTRY_ALIGN(zfs_sha256_transform_avx, 64)
38123816
RET
38133817
.cfi_endproc
38143818
SET_SIZE(zfs_sha256_transform_avx)
3819+
STACK_FRAME_NON_STANDARD zfs_sha256_transform_avx
38153820

38163821
ENTRY_ALIGN(zfs_sha256_transform_avx2, 64)
38173822
.cfi_startproc
@@ -5097,6 +5102,18 @@ ENTRY_ALIGN(zfs_sha256_transform_avx2, 64)
50975102
RET
50985103
.cfi_endproc
50995104
SET_SIZE(zfs_sha256_transform_avx2)
5105+
STACK_FRAME_NON_STANDARD zfs_sha256_transform_avx2
5106+
5107+
/* Workaround for missing asm macro in RHEL 8. */
5108+
#if defined(__linux__) && defined(HAVE_STACK_FRAME_NON_STANDARD) && \
5109+
! defined(HAVE_STACK_FRAME_NON_STANDARD_ASM)
5110+
.section .discard.func_stack_frame_non_standard, "aw"
5111+
.long zfs_sha256_transform_x64 - .
5112+
.long zfs_sha256_transform_shani - .
5113+
.long zfs_sha256_transform_ssse3 - .
5114+
.long zfs_sha256_transform_avx - .
5115+
.long zfs_sha256_transform_avx2 - .
5116+
#endif
51005117

51015118
#if defined(__ELF__)
51025119
.section .note.GNU-stack,"",%progbits

module/icp/asm-x86_64/sha2/sha512-x86_64.S

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#define _ASM
2525
#include <sys/asm_linkage.h>
26+
#include <sys/frame.h>
2627

2728
SECTION_STATIC
2829

@@ -1462,6 +1463,7 @@ ENTRY_ALIGN(zfs_sha512_transform_x64, 16)
14621463
RET
14631464
.cfi_endproc
14641465
SET_SIZE(zfs_sha512_transform_x64)
1466+
STACK_FRAME_NON_STANDARD zfs_sha512_transform_x64
14651467

14661468
ENTRY_ALIGN(zfs_sha512_transform_avx, 64)
14671469
.cfi_startproc
@@ -2626,6 +2628,7 @@ ENTRY_ALIGN(zfs_sha512_transform_avx, 64)
26262628
RET
26272629
.cfi_endproc
26282630
SET_SIZE(zfs_sha512_transform_avx)
2631+
STACK_FRAME_NON_STANDARD zfs_sha512_transform_avx
26292632

26302633
ENTRY_ALIGN(zfs_sha512_transform_avx2, 64)
26312634
.cfi_startproc
@@ -4004,6 +4007,16 @@ ENTRY_ALIGN(zfs_sha512_transform_avx2, 64)
40044007
RET
40054008
.cfi_endproc
40064009
SET_SIZE(zfs_sha512_transform_avx2)
4010+
STACK_FRAME_NON_STANDARD zfs_sha512_transform_avx2
4011+
4012+
/* Workaround for missing asm macro in RHEL 8. */
4013+
#if defined(__linux__) && defined(HAVE_STACK_FRAME_NON_STANDARD) && \
4014+
! defined(HAVE_STACK_FRAME_NON_STANDARD_ASM)
4015+
.section .discard.func_stack_frame_non_standard, "aw"
4016+
.long zfs_sha512_transform_x64 - .
4017+
.long zfs_sha512_transform_avx - .
4018+
.long zfs_sha512_transform_avx2 - .
4019+
#endif
40074020

40084021
#if defined(__ELF__)
40094022
.section .note.GNU-stack,"",%progbits

0 commit comments

Comments
 (0)