openwall / john

John the Ripper jumbo - advanced offline password cracker, which supports hundreds of hash and cipher types, and runs on many operating systems, CPUs, GPUs, and even some FPGAs
https://www.openwall.com/john/
Other
10.33k stars 2.1k forks source link

gcc 12 warnings #5154

Open claudioandre-br opened 2 years ago

claudioandre-br commented 2 years ago

gcc (GCC) 12.1.1 20220507 (Red Hat 12.1.1-1)

I updated (some) CI builders to Fedora 36 (it is a --disable-openmp build)

Configure finished.  Now "make -s clean && make -sj4" to compile.
ar: creating aes.a
ar: creating poly1305-donna.a
ar: creating secp256k1.a
ar: creating ed25519-donna.a
pkcs12_plug.c: In function 'mbedtls_pkcs12_derivation_simd_sha1':
pkcs12_plug.c:448:9: error: 'pkcs12_fill_salt_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
  448 |         pkcs12_fill_salt_buffer_simd(salt_block, v, salt, saltlen, SSE_GROUP_SZ_SHA1);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:448:9: note: referencing argument 1 of type 'unsigned char *[3360]'
pkcs12_plug.c:375:13: note: in a call to function 'pkcs12_fill_salt_buffer_simd'
  375 | static void pkcs12_fill_salt_buffer_simd(unsigned char *data[SIMD_MAX_GROUP_PFX], size_t data_len,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:449:9: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
  449 |         pkcs12_fill_buffer_simd(pwd_block,  v, pwd,  pwdlen, SSE_GROUP_SZ_SHA1);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:449:9: note: referencing argument 1 of type 'unsigned char *[3360]'
pkcs12_plug.c:449:9: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
pkcs12_plug.c:449:9: note: referencing argument 3 of type 'const unsigned char *[3360]'
pkcs12_plug.c:449:9: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
pkcs12_plug.c:449:9: note: referencing argument 4 of type 'size_t[3360]' {aka 'long unsigned int[3360]'}
pkcs12_plug.c:396:13: note: in a call to function 'pkcs12_fill_buffer_simd'
  396 | static void pkcs12_fill_buffer_simd(unsigned char *data[SIMD_MAX_GROUP_PFX], size_t data_len,
      |             ^~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:497:17: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
  497 |                 pkcs12_fill_buffer_simd( hash_block, v, (const unsigned char**)hash_output, hlens, SSE_GROUP_SZ_SHA1);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:497:17: note: referencing argument 1 of type 'unsigned char *[3360]'
pkcs12_plug.c:497:17: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
pkcs12_plug.c:497:17: note: referencing argument 3 of type 'const unsigned char *[3360]'
pkcs12_plug.c:497:17: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
pkcs12_plug.c:497:17: note: referencing argument 4 of type 'size_t[3360]' {aka 'long unsigned int[3360]'}
pkcs12_plug.c:396:13: note: in a call to function 'pkcs12_fill_buffer_simd'
  396 | static void pkcs12_fill_buffer_simd(unsigned char *data[SIMD_MAX_GROUP_PFX], size_t data_len,
      |             ^~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c: In function 'mbedtls_pkcs12_derivation_simd_sha256':
pkcs12_plug.c:556:9: error: 'pkcs12_fill_salt_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
  556 |         pkcs12_fill_salt_buffer_simd(salt_block, v, salt, saltlen, SSE_GROUP_SZ_SHA256);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:556:9: note: referencing argument 1 of type 'unsigned char *[3360]'
pkcs12_plug.c:375:13: note: in a call to function 'pkcs12_fill_salt_buffer_simd'
  375 | static void pkcs12_fill_salt_buffer_simd(unsigned char *data[SIMD_MAX_GROUP_PFX], size_t data_len,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:557:9: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
  557 |         pkcs12_fill_buffer_simd(pwd_block,  v, pwd,  pwdlen, SSE_GROUP_SZ_SHA256);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:557:9: note: referencing argument 1 of type 'unsigned char *[3360]'
pkcs12_plug.c:557:9: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
pkcs12_plug.c:557:9: note: referencing argument 3 of type 'const unsigned char *[3360]'
pkcs12_plug.c:557:9: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
pkcs12_plug.c:557:9: note: referencing argument 4 of type 'size_t[3360]' {aka 'long unsigned int[3360]'}
pkcs12_plug.c:396:13: note: in a call to function 'pkcs12_fill_buffer_simd'
  396 | static void pkcs12_fill_buffer_simd(unsigned char *data[SIMD_MAX_GROUP_PFX], size_t data_len,
      |             ^~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:605:17: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
  605 |                 pkcs12_fill_buffer_simd( hash_block, v, (const unsigned char**)hash_output, hlens, SSE_GROUP_SZ_SHA256);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:605:17: note: referencing argument 1 of type 'unsigned char *[3360]'
pkcs12_plug.c:605:17: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
pkcs12_plug.c:605:17: note: referencing argument 3 of type 'const unsigned char *[3360]'
pkcs12_plug.c:605:17: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 128 [-Werror=stringop-overflow=]
pkcs12_plug.c:605:17: note: referencing argument 4 of type 'size_t[3360]' {aka 'long unsigned int[3360]'}
pkcs12_plug.c:396:13: note: in a call to function 'pkcs12_fill_buffer_simd'
  396 | static void pkcs12_fill_buffer_simd(unsigned char *data[SIMD_MAX_GROUP_PFX], size_t data_len,
      |             ^~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c: In function 'mbedtls_pkcs12_derivation_simd_sha512':
pkcs12_plug.c:705:9: error: 'pkcs12_fill_salt_buffer_simd' accessing 26880 bytes in a region of size 64 [-Werror=stringop-overflow=]
  705 |         pkcs12_fill_salt_buffer_simd(salt_block, v, salt, saltlen, SSE_GROUP_SZ_SHA512);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:705:9: note: referencing argument 1 of type 'unsigned char *[3360]'
pkcs12_plug.c:375:13: note: in a call to function 'pkcs12_fill_salt_buffer_simd'
  375 | static void pkcs12_fill_salt_buffer_simd(unsigned char *data[SIMD_MAX_GROUP_PFX], size_t data_len,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:706:9: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 64 [-Werror=stringop-overflow=]
  706 |         pkcs12_fill_buffer_simd(pwd_block,  v, pwd,  pwdlen, SSE_GROUP_SZ_SHA512);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:706:9: note: referencing argument 1 of type 'unsigned char *[3360]'
pkcs12_plug.c:706:9: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 64 [-Werror=stringop-overflow=]
pkcs12_plug.c:706:9: note: referencing argument 3 of type 'const unsigned char *[3360]'
pkcs12_plug.c:706:9: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 64 [-Werror=stringop-overflow=]
pkcs12_plug.c:706:9: note: referencing argument 4 of type 'size_t[3360]' {aka 'long unsigned int[3360]'}
pkcs12_plug.c:396:13: note: in a call to function 'pkcs12_fill_buffer_simd'
  396 | static void pkcs12_fill_buffer_simd(unsigned char *data[SIMD_MAX_GROUP_PFX], size_t data_len,
      |             ^~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:753:17: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 64 [-Werror=stringop-overflow=]
  753 |                 pkcs12_fill_buffer_simd( hash_block, v, (const unsigned char**)hash_output, hlens, SSE_GROUP_SZ_SHA512 );
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pkcs12_plug.c:753:17: note: referencing argument 1 of type 'unsigned char *[3360]'
pkcs12_plug.c:753:17: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 64 [-Werror=stringop-overflow=]
pkcs12_plug.c:753:17: note: referencing argument 3 of type 'const unsigned char *[3360]'
pkcs12_plug.c:753:17: error: 'pkcs12_fill_buffer_simd' accessing 26880 bytes in a region of size 64 [-Werror=stringop-overflow=]
pkcs12_plug.c:753:17: note: referencing argument 4 of type 'size_t[3360]' {aka 'long unsigned int[3360]'}
pkcs12_plug.c:396:13: note: in a call to function 'pkcs12_fill_buffer_simd'
  396 | static void pkcs12_fill_buffer_simd(unsigned char *data[SIMD_MAX_GROUP_PFX], size_t data_len,
      |             ^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:1556: pkcs12_plug.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:190: default] Error 2
claudioandre-br commented 2 years ago

Also emit warnings for --enable-openmp-for-fast-formats --enable-simd=avx2

xambroz commented 1 year ago

i see that on F37 as well

solardiz commented 5 months ago

I'm also getting these with gcc version 12.2.0 (Debian 12.2.0-14) building for powerpc64le-linux-gnu (but I think the latter doesn't matter). With gcc version 11.3.1 20220421 (Red Hat 11.3.1-2) (GCC) building for x86_64, I am getting these when I --enable-asan, but not without that configure option.

solardiz commented 5 months ago

with gcc version 12.2.0 (Debian 12.2.0-14) building for powerpc64le-linux-gnu

On the same system, building with --enable-asan, I get even more warnings:

krb5pa-sha1_fmt_plug.c: In function ‘split’:
krb5pa-sha1_fmt_plug.c:287:44: warning: ‘$’ directive output may be truncated writing 1 byte into a region of size between 0 and 374 [-Wformat-truncation=]
  287 |         snprintf(out, sizeof(out), "%s%s$%s$%s$%s$%s", FORMAT_TAG, e, u, r, s, tc);
      |                                            ^
krb5pa-sha1_fmt_plug.c:287:9: note: ‘snprintf’ output 13 or more bytes (assuming 515) into a destination of size 383
  287 |         snprintf(out, sizeof(out), "%s%s$%s$%s$%s$%s", FORMAT_TAG, e, u, r, s, tc);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dynamic_fmt.c: In function ‘prepare’:
dynamic_fmt.c:1159:71: warning: ‘$$F’ directive output may be truncated writing 3 bytes into a region of size between 1 and 1024 [-Wformat-truncation=]
 1159 |                                         snprintf(ct2, sizeof(ct2), "%s$$F%d%s", cpBuilding, i, split_fields[i]);
      |                                                                       ^~~
dynamic_fmt.c:1159:68: note: directive argument in the range [0, 9]
 1159 |                                         snprintf(ct2, sizeof(ct2), "%s$$F%d%s", cpBuilding, i, split_fields[i]);
      |                                                                    ^~~~~~~~~~~
dynamic_fmt.c:1159:41: note: ‘snprintf’ output 5 or more bytes (assuming 1028) into a destination of size 1024
 1159 |                                         snprintf(ct2, sizeof(ct2), "%s$$F%d%s", cpBuilding, i, split_fields[i]);
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[... pkcs12 warnings were here ...]
opencl_krb5pa-sha1_fmt_plug.c: In function ‘split’:
opencl_krb5pa-sha1_fmt_plug.c:445:44: warning: ‘$’ directive output may be truncated writing 1 byte into a region of size between 0 and 274 [-Wformat-truncation=]
  445 |         snprintf(out, sizeof(out), "%s%s$%s$%s$%s$%s", FORMAT_TAG, e, u, r, s, tc);
      |                                            ^
opencl_krb5pa-sha1_fmt_plug.c:445:9: note: ‘snprintf’ output 13 or more bytes (assuming 339) into a destination of size 283
  445 |         snprintf(out, sizeof(out), "%s%s$%s$%s$%s$%s", FORMAT_TAG, e, u, r, s, tc);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
opencl_common.c: In function ‘opencl_driver_info’:
opencl_common.c:354:69: warning: ‘%s’ directive output may be truncated writing up to 2111 bytes into a region of size between 51 and 2098 [-Wformat-truncation=]
  354 |                         snprintf(buf, sizeof(buf), "%s - AMDGPU-Pro %s", dname, name);
      |                                                                     ^~
opencl_common.c:354:25: note: ‘snprintf’ output between 15 and 4173 bytes into a destination of size 2112
  354 |                         snprintf(buf, sizeof(buf), "%s - AMDGPU-Pro %s", dname, name);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
opencl_common.c:352:66: warning: ‘%s’ directive output may be truncated writing up to 2111 bytes into a region of size between 54 and 2101 [-Wformat-truncation=]
  352 |                         snprintf(buf, sizeof(buf), "%s - Crimson %s", dname, name);
      |                                                                  ^~
opencl_common.c:352:25: note: ‘snprintf’ output between 12 and 4170 bytes into a destination of size 2112
  352 |                         snprintf(buf, sizeof(buf), "%s - Crimson %s", dname, name);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
opencl_common.c:350:67: warning: ‘%s’ directive output may be truncated writing up to 2111 bytes into a region of size between 53 and 2100 [-Wformat-truncation=]
  350 |                         snprintf(buf, sizeof(buf), "%s - Catalyst %s", dname, name);
      |                                                                   ^~
opencl_common.c:350:25: note: ‘snprintf’ output between 13 and 4171 bytes into a destination of size 2112
  350 |                         snprintf(buf, sizeof(buf), "%s - Catalyst %s", dname, name);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
solardiz commented 5 months ago

On the same system, building with --enable-asan, I get even more warnings:

We were also getting these with gcc 10 when building with ASan in #5139.

solardiz commented 1 week ago

The pkcs12_plug.c warnings here are also seen with gcc 14 (on our CI now).

claudioandre-br commented 1 week ago

The pkcs12 is the important warning that remains (appears everywhere). Also, the lack of prototype in gpg2john comes second.

Once this has been resolved, the rest will be done in one go.