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

Uninitialised variable in ec_GFp_mont_batch_get_window #1185

Closed
giordano opened this issue Sep 12, 2023 · 2 comments
Closed

Uninitialised variable in ec_GFp_mont_batch_get_window #1185

giordano opened this issue Sep 12, 2023 · 2 comments
Assignees

Comments

@giordano
Copy link

giordano commented Sep 12, 2023

Problem:

When building v1.15.0 targeting 32-bit ARM architectures like armv6l or armv7l I get:

[00:20:47] In file included from /workspace/srcdir/aws-lc/crypto/fipsmodule/bcm.c:96:0:
[00:20:47] /workspace/srcdir/aws-lc/crypto/fipsmodule/ec/simple_mul.c: In function ‘ec_GFp_mont_batch_get_window’:
[00:20:47] /workspace/srcdir/aws-lc/crypto/fipsmodule/ec/felem.c:65:19: error: ‘neg_Y.words[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
[00:20:47]      out->words[i] &= mask;
[00:20:47]                    ^~
[00:20:47] cc1: all warnings being treated as errors

Relevant details

AWS-LC commit: (aa90e50)

System information: for linux, below info can be collected by running uname -srvmp

  • target CPU architecture: armv6l or armv7l
  • CPU name: N/A
  • OS: Linux

Build log:

[00:20:24]  ---> cmake -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DDISABLE_GO=ON -DBUILD_SHARED_LIBS=OFF -GNinja ..
[00:20:24] -- The C compiler identification is GNU 7.1.0
[00:20:24] -- Detecting C compiler ABI info
[00:20:25] -- Detecting C compiler ABI info - done
[00:20:25] -- Check for working C compiler: /opt/bin/armv6l-linux-gnueabihf-libgfortran4-cxx11/arm-linux-gnueabihf-gcc - skipped
[00:20:25] -- Detecting C compile features
[00:20:25] -- Detecting C compile features - done
[00:20:25] -- The CXX compiler identification is GNU 7.1.0
[00:20:25] -- Detecting CXX compiler ABI info
[00:20:25] -- Detecting CXX compiler ABI info - done
[00:20:25] -- Check for working CXX compiler: /opt/bin/armv6l-linux-gnueabihf-libgfortran4-cxx11/arm-linux-gnueabihf-g++ - skipped
[00:20:25] -- Detecting CXX compile features
[00:20:25] -- Detecting CXX compile features - done
[00:20:25] -- Found Perl: /usr/bin/perl (found version "5.34.0")
[00:20:25] -- Go not found. Disabling some code generation and using pre-generated code in generated-src/
[00:20:25] -- Run check_run file_to_test 'memcmp_invalid_stripped_check.c', flag_to_set 'MEMCMP_INVALID_STRIPPED', and compile_flags '-O3 -DNDEBUG'.
[00:20:25] -- stdalign_check.c probe is positive, enabling AWS_LC_STDALIGN_AVAILABLE
[00:20:25] -- builtin_swap_check.c probe is positive, enabling AWS_LC_BUILTIN_SWAP_SUPPORTED
[00:20:25] -- The ASM compiler identification is GNU
[00:20:25] -- Found assembler: /opt/bin/armv6l-linux-gnueabihf-libgfortran4-cxx11/arm-linux-gnueabihf-gcc
[00:20:25] -- Looking for pthread.h
[00:20:25] -- Looking for pthread.h - found
[00:20:25] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
[00:20:25] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
[00:20:25] -- Looking for pthread_create in pthreads
[00:20:25] -- Looking for pthread_create in pthreads - not found
[00:20:25] -- Looking for pthread_create in pthread
[00:20:26] -- Looking for pthread_create in pthread - found
[00:20:26] -- Found Threads: TRUE
[00:20:26] -- Configuring done
[00:20:26] -- Generating done
[00:20:26] -- Build files have been written to: /workspace/srcdir/aws-lc/build

Side note, it'd be very much appreciated if -Werror wasn't enforced, or at very least if it was possible to easily disable it without having to manually hack the CMake file.

@justsmth justsmth self-assigned this Sep 19, 2023
@justsmth
Copy link
Contributor

Thanks for reporting. I'll try to resolve the warning/error.

We'll also consider the possibility of removing the enforcement of -Werror. We want such strict enforcement for our own CI/testing, but it can be an obstacle for people building on compilers/platforms not fully covered by our CI.

@justsmth
Copy link
Contributor

justsmth commented Oct 3, 2023

Hello -- I discussed with the team adding a build flag to allow compiler warnings to be ignored (i.e., allow warnings to NOT be errors). Our current consensus is that we prefer compiler warnings to always prevent our build from succeeding. Such warnings are important in helping us and our customers become aware of potential bugs and/or security concerns.

Please let us know any time you have a problem building AWS-LC. Thanks again for your report of this issue!

@justsmth justsmth closed this as completed Oct 3, 2023
manastasova added a commit to manastasova/aws-lc that referenced this issue Jan 13, 2025
manastasova added a commit to manastasova/aws-lc that referenced this issue Jan 13, 2025
justsmth pushed a commit that referenced this issue Jan 15, 2025
Previous discussion here: #1185
Similar issues here:
305ec03
Similar issues here:
d0501c5#diff-6fde57725bf74f073ccac9d404387d74a39824fbc2465a02cfe37e86e679bbe8R34

Causes CI fails

### Issues:
Resolves #P188618529

### Description of changes: 
Zero variables before use.

### Call-outs:
The fail only occurs for gcc-12 with ubuntu2204 on x86_64.
Only variables `|ftmp2|` and `|fourbeta|` are caught as maybe
uninitialized `error: 'var_name' may be used uninitialized
[-Werror=maybe-uninitialized]`.

### Testing:
CI tests.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.
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