Skip to content

Commit d2de9c1

Browse files
Linux build: silence objtool warnings
After #17401 the Linux build produces some stack related warnings. Silence them with the `STACK_FRAME_NON_STANDARD` macro. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Signed-off-by: Attila Fülöp <attila@fueloep.org> Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #17410
1 parent 8756882 commit d2de9c1

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
@@ -31,8 +31,16 @@ extern "C" {
3131
#else
3232
#include <linux/frame.h>
3333
#endif
34+
#if defined(_ASM) && ! defined(HAVE_STACK_FRAME_NON_STANDARD_ASM)
35+
.macro STACK_FRAME_NON_STANDARD func:req
36+
.endm
37+
#endif
3438
#else
3539
#define STACK_FRAME_NON_STANDARD(func)
40+
#if defined(_ASM)
41+
.macro STACK_FRAME_NON_STANDARD func:req
42+
.endm
43+
#endif
3644
#endif
3745

3846
#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
@@ -50,6 +50,7 @@
5050

5151
#define _ASM
5252
#include <sys/asm_linkage.h>
53+
#include <sys/frame.h>
5354

5455
/* Windows userland links with OpenSSL */
5556
#if !defined (_WIN32) || defined (_KERNEL)
@@ -378,6 +379,7 @@ FUNCTION(_aesni_ctr32_ghash_6x)
378379
RET
379380
.cfi_endproc
380381
SET_SIZE(_aesni_ctr32_ghash_6x)
382+
STACK_FRAME_NON_STANDARD _aesni_ctr32_ghash_6x
381383
#endif /* ifdef HAVE_MOVBE */
382384

383385
.balign 32
@@ -706,6 +708,7 @@ FUNCTION(_aesni_ctr32_ghash_no_movbe_6x)
706708
RET
707709
.cfi_endproc
708710
SET_SIZE(_aesni_ctr32_ghash_no_movbe_6x)
711+
STACK_FRAME_NON_STANDARD _aesni_ctr32_ghash_no_movbe_6x
709712

710713
ENTRY_ALIGN(aesni_gcm_decrypt, 32)
711714
.cfi_startproc
@@ -823,6 +826,7 @@ ENTRY_ALIGN(aesni_gcm_decrypt, 32)
823826
RET
824827
.cfi_endproc
825828
SET_SIZE(aesni_gcm_decrypt)
829+
STACK_FRAME_NON_STANDARD aesni_gcm_decrypt
826830

827831
.balign 32
828832
FUNCTION(_aesni_ctr32_6x)
@@ -1198,6 +1202,7 @@ ENTRY_ALIGN(aesni_gcm_encrypt, 32)
11981202
RET
11991203
.cfi_endproc
12001204
SET_SIZE(aesni_gcm_encrypt)
1205+
STACK_FRAME_NON_STANDARD aesni_gcm_encrypt
12011206

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

@@ -1257,6 +1262,18 @@ SECTION_STATIC
12571262
.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
12581263
.balign 64
12591264

1265+
/* Workaround for missing asm macro in RHEL 8. */
1266+
#if defined(__linux__) && defined(HAVE_STACK_FRAME_NON_STANDARD) && \
1267+
! defined(HAVE_STACK_FRAME_NON_STANDARD_ASM)
1268+
.section .discard.func_stack_frame_non_standard, "aw"
1269+
#ifdef HAVE_MOVBE
1270+
.long _aesni_ctr32_ghash_6x - .
1271+
#endif
1272+
.long _aesni_ctr32_ghash_no_movbe_6x - .
1273+
.long aesni_gcm_decrypt - .
1274+
.long aesni_gcm_encrypt - .
1275+
#endif
1276+
12601277
/* Mark the stack non-executable. */
12611278
#if defined(__linux__) && defined(__ELF__)
12621279
.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
@@ -24,6 +24,7 @@
2424

2525
#define _ASM
2626
#include <sys/asm_linkage.h>
27+
#include <sys/frame.h>
2728

2829
SECTION_STATIC
2930

@@ -1420,6 +1421,7 @@ ENTRY_ALIGN(zfs_sha256_transform_x64, 16)
14201421
RET
14211422
.cfi_endproc
14221423
SET_SIZE(zfs_sha256_transform_x64)
1424+
STACK_FRAME_NON_STANDARD zfs_sha256_transform_x64
14231425

14241426
ENTRY_ALIGN(zfs_sha256_transform_shani, 64)
14251427
.cfi_startproc
@@ -1628,6 +1630,7 @@ ENTRY_ALIGN(zfs_sha256_transform_shani, 64)
16281630
RET
16291631
.cfi_endproc
16301632
SET_SIZE(zfs_sha256_transform_shani)
1633+
STACK_FRAME_NON_STANDARD zfs_sha256_transform_shani
16311634

16321635
ENTRY_ALIGN(zfs_sha256_transform_ssse3, 64)
16331636
.cfi_startproc
@@ -2739,6 +2742,7 @@ ENTRY_ALIGN(zfs_sha256_transform_ssse3, 64)
27392742
RET
27402743
.cfi_endproc
27412744
SET_SIZE(zfs_sha256_transform_ssse3)
2745+
STACK_FRAME_NON_STANDARD zfs_sha256_transform_ssse3
27422746

27432747
ENTRY_ALIGN(zfs_sha256_transform_avx, 64)
27442748
.cfi_startproc
@@ -3813,6 +3817,7 @@ ENTRY_ALIGN(zfs_sha256_transform_avx, 64)
38133817
RET
38143818
.cfi_endproc
38153819
SET_SIZE(zfs_sha256_transform_avx)
3820+
STACK_FRAME_NON_STANDARD zfs_sha256_transform_avx
38163821

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

51025119
#if defined(__ELF__)
51035120
.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
@@ -24,6 +24,7 @@
2424

2525
#define _ASM
2626
#include <sys/asm_linkage.h>
27+
#include <sys/frame.h>
2728

2829
SECTION_STATIC
2930

@@ -1463,6 +1464,7 @@ ENTRY_ALIGN(zfs_sha512_transform_x64, 16)
14631464
RET
14641465
.cfi_endproc
14651466
SET_SIZE(zfs_sha512_transform_x64)
1467+
STACK_FRAME_NON_STANDARD zfs_sha512_transform_x64
14661468

14671469
ENTRY_ALIGN(zfs_sha512_transform_avx, 64)
14681470
.cfi_startproc
@@ -2627,6 +2629,7 @@ ENTRY_ALIGN(zfs_sha512_transform_avx, 64)
26272629
RET
26282630
.cfi_endproc
26292631
SET_SIZE(zfs_sha512_transform_avx)
2632+
STACK_FRAME_NON_STANDARD zfs_sha512_transform_avx
26302633

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

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

0 commit comments

Comments
 (0)