Skip to content

Error building - crypto_mech_name_t #12188

Closed
@dioni21

Description

@dioni21

System information

Type Version/Name
Distribution Name Fedora
Distribution Version fc34
Linux Kernel 5.12.8-300-fc34-x86_64
Architecture x86_64
ZFS Version master, as in f97142c
SPL Version same

Describe the problem you're observing

Cannot build a new release. Last release built and installed is

zfs-2.1.99-159_g2babd2004
zfs-kmod-2.1.99-159_g2babd2004

Latest version has probably been compiled with gcc-10.3.1, now I have gcc-11.1.1. This can be the real reason, since there is no error to build dkms or kmod.

Describe how to reproduce the problem

git checkout master
./autogen.sh
./configure --enable-silent-rules --enable-dependency-tracking --config-cache \
    --enable-linux-builtin --disable-nls --with-config=all --enable-debuginfo \
    --enable-debug --enable-debug-kmem --enable-debug-kmem-tracking
make

Include any warning/errors/backtraces from the system logs

  CC       api/kcf_miscapi.lo
  CC       api/kcf_mac.lo
  CC       algs/aes/aes_impl_aesni.lo
../../module/icp/api/kcf_miscapi.c:65:22: error: argument 1 of type 'char *' declared as a pointer [-Werror=array-parameter=]
   65 | crypto_mech2id(char *mechname)
      |                ~~~~~~^~~~~~~~
In file included from ../../module/icp/api/kcf_miscapi.c:28:
../../include/sys/crypto/api.h:61:61: note: previously declared as an array 'char[32]'
   61 | extern crypto_mech_type_t crypto_mech2id(crypto_mech_name_t name);
      |                                          ~~~~~~~~~~~~~~~~~~~^~~~
cc1: all warnings being treated as errors
  CC       algs/aes/aes_impl_generic.lo
make[5]: *** [Makefile:1159: api/kcf_miscapi.lo] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: Leaving directory '/tmp/zfs-build-jonny-uISReS3q/BUILD/zfs-2.1.99/lib/libicp'
make[4]: *** [Makefile:708: all-recursive] Error 1
make[4]: Leaving directory '/tmp/zfs-build-jonny-uISReS3q/BUILD/zfs-2.1.99/lib'

I tried this kick patch:

diff --git i/module/icp/api/kcf_miscapi.c w/module/icp/api/kcf_miscapi.c
index c0f415b26..80cbfc8a5 100644
--- i/module/icp/api/kcf_miscapi.c
+++ w/module/icp/api/kcf_miscapi.c
@@ -62,7 +62,7 @@ static kcf_ntfy_elem_t *ntfy_list_head;
  *     CRYPTO_MECH_INVALID otherwise.
  */
 crypto_mech_type_t
-crypto_mech2id(char *mechname)
+crypto_mech2id(crypto_mech_name_t mechname)
 {
        return (crypto_mech2id_common(mechname, B_TRUE));
 }

Just to catch another error, later:

make[3]: Entering directory '/root/zfs/zfs/lib/libzfs'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/root/zfs/zfs/lib/libzfs'
Making all in libzpool
make[3]: Entering directory '/root/zfs/zfs/lib/libzpool'
  CC       hkdf.lo
../../module/zfs/hkdf.c: In function ‘hkdf_sha512_extract’:
../../module/zfs/hkdf.c:34:24: error: ‘crypto_mech2id’ accessing 32 bytes in a region of size 16 [-Werror=stringop-overflow=]
   34 |         mech.cm_type = crypto_mech2id(SUN_CKM_SHA512_HMAC);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../module/zfs/hkdf.c:34:24: note: referencing argument 1 of type ‘char *’
In file included from ../../module/zfs/hkdf.c:20:
../../include/sys/crypto/api.h:61:27: note: in a call to function ‘crypto_mech2id’
   61 | extern crypto_mech_type_t crypto_mech2id(crypto_mech_name_t name);
      |                           ^~~~~~~~~~~~~~
../../module/zfs/hkdf.c: In function ‘hkdf_sha512_expand’:
../../module/zfs/hkdf.c:81:24: error: ‘crypto_mech2id’ accessing 32 bytes in a region of size 16 [-Werror=stringop-overflow=]
   81 |         mech.cm_type = crypto_mech2id(SUN_CKM_SHA512_HMAC);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../module/zfs/hkdf.c:81:24: note: referencing argument 1 of type ‘char *’
In file included from ../../module/zfs/hkdf.c:20:
../../include/sys/crypto/api.h:61:27: note: in a call to function ‘crypto_mech2id’
   61 | extern crypto_mech_type_t crypto_mech2id(crypto_mech_name_t name);
      |                           ^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [Makefile:1325: hkdf.lo] Error 1
make[3]: Leaving directory '/root/zfs/zfs/lib/libzpool'
make[2]: *** [Makefile:708: all-recursive] Error 1

I would submit a PR if I had any idea on how to fix this, but I'm afraid to change something cryptic in crypto (pun intended 😄).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Triage NeededNew issue which needs to be triagedType: DefectIncorrect behavior (e.g. crash, hang)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions