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

ci: add ktls + asan build #4213

Merged
merged 4 commits into from
Oct 4, 2023
Merged

ci: add ktls + asan build #4213

merged 4 commits into from
Oct 4, 2023

Conversation

lrstewart
Copy link
Contributor

@lrstewart lrstewart commented Sep 20, 2023

Description of changes:

Most of the ktls code is hit by the standard valgrind and asan tests, but our self-talk tests only run in the specific ktls CI build. For thoroughness, we should probably have at least asan run against the self-talk tests.

While testing, I also found some related issues:

  • S2N_KTLS_TESTING_EXPECTED wasn't actually being passed to the final unit test run on the VM. I fixed that, and tested it by making the memory leak I used in my testing only happen if S2N_KTLS_TESTING_EXPECTED is set.
  • ASAN needs detect_odr_violation=0 in order not to fail on existing unit tests. I'm not actually sure why detect_odr_violation is enabled by default-- the documentation says that it should be disabled by default, but the documentation might be out of date.

Testing:

I manually kicked off s2nGeneralBatch. You can see the new "ktlsASAN" build passing. It's output says that AddressSanitizer is being configured:

-- Running tests with environment: S2N_DONT_MLOCK=1;S2N_ADDRESS_SANITIZER=1;ASAN_OPTIONS=detect_odr_violation=0
...
1: Test command: /home/codebuild/s2n-tls/build/bin/s2n_3des_test
1: Working Directory: /home/codebuild/s2n-tls/tests/unit
1: Environment variables: 
1:  S2N_DONT_MLOCK=1
1:  S2N_ADDRESS_SANITIZER=1
1:  ASAN_OPTIONS=detect_odr_violation=0

I created a branch with a memory leak that only the ktls build will catch. I manually kicked off a build, and ktlsASAN failed as expected:

170: Running /home/codebuild/s2n-tls/tests/unit/s2n_self_talk_ktls_test.c ... 
170: =================================================================
170: ==17473==ERROR: LeakSanitizer: detected memory leaks
170: 
170: Direct leak of 100 byte(s) in 1 object(s) allocated from:
170:     #0 0x7ffff768d7cf in __interceptor_malloc (/nix/store/5lp5v0sa76mhvc42bdc4z8vxwysp18r9-gcc-11.3.0-lib/lib/libasan.so.6+0xb17cf)
170:     #1 0x41f7bc in s2n_mem_malloc_no_mlock_impl /home/codebuild/s2n-tls/utils/s2n_mem.c:127
170:     #2 0x420377 in s2n_realloc /home/codebuild/s2n-tls/utils/s2n_mem.c:195
170:     #3 0x420a46 in s2n_alloc /home/codebuild/s2n-tls/utils/s2n_mem.c:158
170:     #4 0x405d76 in main /home/codebuild/s2n-tls/tests/unit/s2n_self_talk_ktls_test.c:97
170:     #5 0x7ffff6d1324d in __libc_start_call_main (/nix/store/9xfad3b5z4y00mzmk2wnn4900q0qmxns-glibc-2.35-224/lib/libc.so.6+0x2924d)
170: 
170: SUMMARY: AddressSanitizer: 100 byte(s) leaked in 1 allocation(s).
165/250 Test #170: s2n_self_talk_ktls_test ..........................***Failed    3.51 sec

...

99% tests passed, 1 tests failed out of 250

Label Time Summary:
unit    = 3556.38 sec*proc (250 tests)

Total Test time (real) = 1252.12 sec

The following tests FAILED:
    170 - s2n_self_talk_ktls_test (Failed)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the s2n-core team label Sep 20, 2023
@lrstewart lrstewart marked this pull request as ready for review September 20, 2023 08:10
@lrstewart lrstewart requested a review from dougch as a code owner September 20, 2023 08:10
@lrstewart lrstewart requested a review from jmayclin September 20, 2023 08:10
@lrstewart lrstewart force-pushed the asan branch 2 times, most recently from 6faa1ee to 9ea27cf Compare September 29, 2023 07:34
@lrstewart lrstewart requested a review from dougch September 29, 2023 09:33
@lrstewart lrstewart enabled auto-merge (squash) October 3, 2023 18:38
@lrstewart lrstewart merged commit 76fb286 into aws:main Oct 4, 2023
@lrstewart lrstewart deleted the asan branch October 4, 2023 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants