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

Compile error in Fedora 28: strncpy’ specified bound equals destination size #7826

Closed
dioni21 opened this issue Aug 24, 2018 · 4 comments
Closed
Milestone

Comments

@dioni21
Copy link
Contributor

dioni21 commented Aug 24, 2018

System information

Type Version/Name
Distribution Name Fedora
Distribution Version 28
Linux Kernel 4.17.12-200.fc28.x86_64
Architecture x86_64
ZFS Version commit 55972a6
SPL Version XXX

Describe the problem you're observing

Error compiling the current master on Fedora 28. It worked on Fedora 27

I suspect Fedora 28 has enabled by default stricter compile verification.

Describe how to reproduce the problem

git checkout master
./autogen.sh && ./configure --enable-debuginfo --enable-silent-rules --enable-dependency-tracking --enable-asan --enable-debug --enable-debug-kmem

Include any warning/errors/backtraces from the system logs

...
  CC       asm-x86_64/aes/aeskey.lo
  CPPAS    asm-x86_64/aes/aes_amd64.lo
  CPPAS    asm-x86_64/aes/aes_aesni.lo
  CPPAS    asm-x86_64/modes/gcm_pclmulqdq.lo
  CPPAS    asm-x86_64/sha1/sha1-x86_64.lo
../../module/icp/core/kcf_mech_tabs.c: In function ‘kcf_create_mech_entry’:
../../module/icp/core/kcf_mech_tabs.c:324:11: error: ‘strncpy’ specified bound 32 equals destination size [-Werror=stringop-truncation]
    (void) strncpy(me_tab[i].me_name, mechname,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        CRYPTO_MAX_MECH_NAME);
        ~~~~~~~~~~~~~~~~~~~~~
  CPPAS    asm-x86_64/sha2/sha256_impl.lo
cc1: all warnings being treated as errors
make[3]: *** [Makefile:1006: core/kcf_mech_tabs.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/root/zfs/zfs/lib/libicp'
make[2]: *** [Makefile:610: all-recursive] Error 1
make[2]: Leaving directory '/root/zfs/zfs/lib'
make[1]: *** [Makefile:782: all-recursive] Error 1
make[1]: Leaving directory '/root/zfs/zfs'
make: *** [Makefile:651: all] Error 2
@dioni21
Copy link
Contributor Author

dioni21 commented Aug 24, 2018

BTW:

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.1.1 20180712 (Red Hat 8.1.1-5) (GCC) 

@behlendorf
Copy link
Contributor

@dioni21 thanks for filing this. When Fedora 28 was first released with gcc 8.1 we fixed a bunch of these kinds of warnings, see commit 21a4f5c. I thought we'd gotten all of them since our Fedora 28 builds have been cleanly passing since then. But clearly we missed at least one. Although I'm not sure why your additional build options would have caused it.

@dioni21
Copy link
Contributor Author

dioni21 commented Aug 25, 2018

Sent my first github PR. Hope it is ok.

@behlendorf
Copy link
Contributor

@dioni21 thanks!

tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Aug 28, 2018
Fix a bunch of truncation compiler warnings that show up
on Fedora 28 (GCC 8.0.1).

Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Issue openzfs#7368 
Closes openzfs#7826 
Closes openzfs#7830
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Aug 30, 2018
Fix a bunch of truncation compiler warnings that show up
on Fedora 28 (GCC 8.0.1).

Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Issue openzfs#7368
Closes openzfs#7826
Closes openzfs#7830
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Sep 5, 2018
Fix a bunch of truncation compiler warnings that show up
on Fedora 28 (GCC 8.0.1).

Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Issue openzfs#7368
Closes openzfs#7826
Closes openzfs#7830
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants