Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building - crypto_mech_name_t #12188

Closed
dioni21 opened this issue Jun 3, 2021 · 2 comments · Fixed by #12237
Closed

Error building - crypto_mech_name_t #12188

dioni21 opened this issue Jun 3, 2021 · 2 comments · Fixed by #12237
Labels
Status: Triage Needed New issue which needs to be triaged Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@dioni21
Copy link
Contributor

dioni21 commented Jun 3, 2021

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 😄).

@dioni21 dioni21 added Status: Triage Needed New issue which needs to be triaged Type: Defect Incorrect behavior (e.g. crash, hang) labels Jun 3, 2021
@dioni21
Copy link
Contributor Author

dioni21 commented Jun 3, 2021

Related issue: #12130

@rincebrain
Copy link
Contributor

Even if you correct this error, others arise that require slightly more work to handle, to say nothing of checking the correctness of these changes.

Prodding...

AttilaFueloep added a commit to AttilaFueloep/zfs that referenced this issue Jun 13, 2021
@AttilaFueloep AttilaFueloep mentioned this issue Jun 13, 2021
13 tasks
AttilaFueloep added a commit to AttilaFueloep/zfs that referenced this issue Jun 23, 2021
Compiling with gcc 11.1.0 produces three new warnings.

Change the code slightly to avoid them.

Signed-off-by: Attila Fülöp <[email protected]>
Closes openzfs#12130
Closes openzfs#12188
mmaybee pushed a commit that referenced this issue Jun 23, 2021
Compiling with gcc 11.1.0 produces three new warnings.
Change the code slightly to avoid them.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Signed-off-by: Attila Fülöp <[email protected]>
Closes #12130
Closes #12188
Closes #12237
behlendorf pushed a commit that referenced this issue Jun 24, 2021
Compiling with gcc 11.1.0 produces three new warnings.
Change the code slightly to avoid them.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Signed-off-by: Attila Fülöp <[email protected]>
Closes #12130
Closes #12188
Closes #12237
rincebrain pushed a commit to rincebrain/zfs that referenced this issue Oct 23, 2021
Compiling with gcc 11.1.0 produces three new warnings.
Change the code slightly to avoid them.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Signed-off-by: Attila Fülöp <[email protected]>
Closes openzfs#12130
Closes openzfs#12188
Closes openzfs#12237
rincebrain pushed a commit to rincebrain/zfs that referenced this issue Oct 24, 2021
Compiling with gcc 11.1.0 produces three new warnings.
Change the code slightly to avoid them.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Signed-off-by: Attila Fülöp <[email protected]>
Closes openzfs#12130
Closes openzfs#12188
Closes openzfs#12237
tonyhutter pushed a commit that referenced this issue Nov 1, 2021
Compiling with gcc 11.1.0 produces three new warnings.
Change the code slightly to avoid them.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Signed-off-by: Attila Fülöp <[email protected]>
Closes #12130
Closes #12188
Closes #12237
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Nov 13, 2021
Compiling with gcc 11.1.0 produces three new warnings.
Change the code slightly to avoid them.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Signed-off-by: Attila Fülöp <[email protected]>
Closes openzfs#12130
Closes openzfs#12188
Closes openzfs#12237
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needed New issue which needs to be triaged Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants