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

Add Reproducible Error Injection [3.1] #21721

Open
wants to merge 4 commits into
base: openssl-3.1
Choose a base branch
from

Conversation

bernd-edlinger
Copy link
Member

@bernd-edlinger bernd-edlinger commented Aug 11, 2023

This adds reproducible memory error and test-data
error injection, to the fuzzy-test framework.

This feature can be enabled with ./config -DERROR_INJECT and additionally to enable call stacks -DERROR_CALLSTACK

If enable-asan is used, the callstack is printed by the sanitizer, otherwise please set a breakpoint
at the function "break_here", which is executed each time a memory allocation error is injected.

If called with the environment variable ERROR_INJECT defined to the empty string the initialization value is printed, and can be used to reproduce the failure later, by passing the value to the ERROR_INJECT variable.

There is a search script that can be used to look
for errors, and print the command to reproduce the bug:

./testrun.sh

This runs in endless mode until an error is found.

Checklist
  • documentation is added or updated
  • tests are added or updated

This adds reproducible memory error and test-data
error injection, to the fuzzy-test framework.

This feature can be enabled with ./config -DERROR_INJECT
and additionally to enable call stacks -DERROR_CALLSTACK

If enable-asan is used, the callstack is printed by the
sanitizer, otherwise please set a breakpoint
at the function "break_here", which is executed each
time a memory allocation error is injected.

If called with the environment variable ERROR_INJECT
defined to the empty string the initialization value
is printed, and can be used to reproduce the failure
later, by passing the value to the ERROR_INJECT variable.

There is a search script that can be used to look
for errors, and print the command to reproduce the bug:

./testrun.sh

This runs in endless mode until an error is found.
@bernd-edlinger bernd-edlinger added the branch: 3.1 Merge to openssl-3.1 label Aug 11, 2023
@bernd-edlinger
Copy link
Member Author

Here we have a reproducible memory leak, found after several unsuccessful attempts.
See https://github.com/openssl/openssl/actions/runs/5829594365:

2023-08-11T12:46:18.7565796Z ERROR_INJECT=1692383961 ../util/shlib_wrap.sh ./asn1-test ./corpora/asn1/9ce3254a22ff5c57936eb573e2e0f1a6f3a24a36
2023-08-11T12:46:18.7566753Z log file: asn1-9ce3254a22ff5c57936eb573e2e0f1a6f3a24a36-21074-test.out
2023-08-11T12:46:18.7577806Z ERROR_INJECT=1692383961
2023-08-11T12:46:18.7578404Z     #0 0x7f458f6fff18 in __sanitizer_print_stack_trace ../../../../src/libsanitizer/asan/asan_stack.cpp:86
2023-08-11T12:46:18.7579384Z     #1 0x564031ade6f4 in my_realloc fuzz/test-corpus.c:132
2023-08-11T12:46:18.7579740Z     #2 0x7f458e081430 in ERR_vset_error crypto/err/err_blocks.c:84
2023-08-11T12:46:18.7580081Z     #3 0x7f458e081ec9 in ERR_set_error crypto/err/err_blocks.c:45
2023-08-11T12:46:18.7580400Z     #4 0x7f458de159bc in BIO_new_file crypto/bio/bss_file.c:67
2023-08-11T12:46:18.7580727Z     #5 0x7f458ded36b6 in def_load crypto/conf/conf_def.c:175
2023-08-11T12:46:18.7581081Z     #6 0x7f458ded7074 in CONF_modules_load_file_ex crypto/conf/conf_mod.c:206
2023-08-11T12:46:18.7581433Z     #7 0x7f458ded7953 in ossl_config_int crypto/conf/conf_sap.c:68
2023-08-11T12:46:18.7582068Z     #8 0x7f458e1890be in ossl_init_config crypto/init.c:249
2023-08-11T12:46:18.7582398Z     #9 0x7f458e1890be in ossl_init_config_ossl_ crypto/init.c:247
2023-08-11T12:46:18.7593274Z     #10 0x7f458cc56f67  (/lib/x86_64-linux-gnu/libc.so.6+0x99f67)
2023-08-11T12:46:18.7593941Z     #11 0x7f458e1b547e in CRYPTO_THREAD_run_once crypto/threads_pthread.c:156
2023-08-11T12:46:18.7594330Z     #12 0x7f458e189a5b in OPENSSL_init_crypto crypto/init.c:588
2023-08-11T12:46:18.7594857Z     #13 0x7f458e1ad5cb in ossl_provider_find crypto/provider_core.c:419
2023-08-11T12:46:18.7595231Z     #14 0x7f458e1a4f9b in OSSL_PROVIDER_try_load crypto/provider.c:25
2023-08-11T12:46:18.7595567Z     #15 0x564031addf1e in FuzzerSetRand fuzz/fuzz_rand.c:161
2023-08-11T12:46:18.7596027Z     #16 0x564031adbb1c in FuzzerInitialize fuzz/asn1.c:287
2023-08-11T12:46:18.7596513Z     #17 0x564031adb493 in main fuzz/test-corpus.c:197
2023-08-11T12:46:18.7596929Z     #18 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7597408Z     #19 0x7f458cbe6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
2023-08-11T12:46:18.7597915Z     #20 0x564031adba44 in _start (/home/runner/work/openssl/openssl/fuzz/asn1-test+0x9a44)
2023-08-11T12:46:18.7598129Z 
2023-08-11T12:46:18.7598280Z # ./corpora/asn1/9ce3254a22ff5c57936eb573e2e0f1a6f3a24a36
2023-08-11T12:46:18.7598669Z     #0 0x7f458f6fff18 in __sanitizer_print_stack_trace ../../../../src/libsanitizer/asan/asan_stack.cpp:86
2023-08-11T12:46:18.7599120Z     #1 0x564031ade6f4 in my_realloc fuzz/test-corpus.c:132
2023-08-11T12:46:18.7599440Z     #2 0x7f458ddab9da in ASN1_STRING_set crypto/asn1/asn1_lib.c:306
2023-08-11T12:46:18.7599782Z     #3 0x7f458dd89353 in ossl_c2i_ASN1_INTEGER crypto/asn1/a_int.c:306
2023-08-11T12:46:18.7600112Z     #4 0x7f458ddc63c9 in asn1_ex_c2i crypto/asn1/tasn_dec.c:892
2023-08-11T12:46:18.7600454Z     #5 0x7f458ddc63c9 in asn1_d2i_ex_primitive crypto/asn1/tasn_dec.c:818
2023-08-11T12:46:18.7601072Z     #6 0x7f458ddc88aa in asn1_item_embed_d2i crypto/asn1/tasn_dec.c:256
2023-08-11T12:46:18.7601427Z     #7 0x7f458ddc9ce8 in asn1_template_noexp_d2i crypto/asn1/tasn_dec.c:682
2023-08-11T12:46:18.7601791Z     #8 0x7f458ddca7b8 in asn1_template_ex_d2i crypto/asn1/tasn_dec.c:558
2023-08-11T12:46:18.7602132Z     #9 0x7f458ddc8393 in asn1_item_embed_d2i crypto/asn1/tasn_dec.c:422
2023-08-11T12:46:18.7602490Z     #10 0x7f458ddc9ce8 in asn1_template_noexp_d2i crypto/asn1/tasn_dec.c:682
2023-08-11T12:46:18.7602851Z     #11 0x7f458ddca7b8 in asn1_template_ex_d2i crypto/asn1/tasn_dec.c:558
2023-08-11T12:46:18.7603204Z     #12 0x7f458ddc7e21 in asn1_item_embed_d2i crypto/asn1/tasn_dec.c:298
2023-08-11T12:46:18.7603543Z     #13 0x7f458ddcb534 in asn1_item_ex_d2i_intern crypto/asn1/tasn_dec.c:118
2023-08-11T12:46:18.7603893Z     #14 0x7f458ddcb534 in ASN1_item_d2i_ex crypto/asn1/tasn_dec.c:144
2023-08-11T12:46:18.7604234Z     #15 0x564031adbf0b in FuzzerTestOneInput fuzz/asn1.c:315
2023-08-11T12:46:18.7604636Z     #16 0x564031ade271 in testfile fuzz/test-corpus.c:185
2023-08-11T12:46:18.7605017Z     #17 0x564031adb89f in main fuzz/test-corpus.c:229
2023-08-11T12:46:18.7605417Z     #18 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7605858Z     #19 0x7f458cbe6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
2023-08-11T12:46:18.7606350Z     #20 0x564031adba44 in _start (/home/runner/work/openssl/openssl/fuzz/asn1-test+0x9a44)
2023-08-11T12:46:18.7606577Z 
2023-08-11T12:46:18.7606783Z     #0 0x7f458f6fff18 in __sanitizer_print_stack_trace ../../../../src/libsanitizer/asan/asan_stack.cpp:86
2023-08-11T12:46:18.7607228Z     #1 0x564031ade6f4 in my_realloc fuzz/test-corpus.c:132
2023-08-11T12:46:18.7607692Z     #2 0x7f458ddab9da in ASN1_STRING_set crypto/asn1/asn1_lib.c:306
2023-08-11T12:46:18.7608037Z     #3 0x7f458dd89623 in ossl_c2i_ASN1_INTEGER crypto/asn1/a_int.c:306
2023-08-11T12:46:18.7608370Z     #4 0x7f458ddc63c9 in asn1_ex_c2i crypto/asn1/tasn_dec.c:892
2023-08-11T12:46:18.7608852Z     #5 0x7f458ddc63c9 in asn1_d2i_ex_primitive crypto/asn1/tasn_dec.c:818
2023-08-11T12:46:18.7609216Z     #6 0x7f458ddc88aa in asn1_item_embed_d2i crypto/asn1/tasn_dec.c:256
2023-08-11T12:46:18.7609572Z     #7 0x7f458ddcb534 in asn1_item_ex_d2i_intern crypto/asn1/tasn_dec.c:118
2023-08-11T12:46:18.7609923Z     #8 0x7f458ddcb534 in ASN1_item_d2i_ex crypto/asn1/tasn_dec.c:144
2023-08-11T12:46:18.7610243Z     #9 0x7f458ddada88 in asn1_parse2 crypto/asn1/asn1_parse.c:265
2023-08-11T12:46:18.7610580Z     #10 0x7f458ddad84c in asn1_parse2 crypto/asn1/asn1_parse.c:143
2023-08-11T12:46:18.7610921Z     #11 0x7f458ddad84c in asn1_parse2 crypto/asn1/asn1_parse.c:143
2023-08-11T12:46:18.7611242Z     #12 0x7f458ddad84c in asn1_parse2 crypto/asn1/asn1_parse.c:143
2023-08-11T12:46:18.7611588Z     #13 0x7f458ddaee16 in ASN1_parse_dump crypto/asn1/asn1_parse.c:91
2023-08-11T12:46:18.7611945Z     #14 0x7f458ddd2cf3 in asn1_primitive_print crypto/asn1/tasn_prn.c:525
2023-08-11T12:46:18.7612308Z     #15 0x7f458ddd2cf3 in asn1_item_print_ctx crypto/asn1/tasn_prn.c:175
2023-08-11T12:46:18.7612646Z     #16 0x7f458ddd431e in ASN1_item_print crypto/asn1/tasn_prn.c:131
2023-08-11T12:46:18.7612987Z     #17 0x564031adbf5c in FuzzerTestOneInput fuzz/asn1.c:320
2023-08-11T12:46:18.7613399Z     #18 0x564031ade271 in testfile fuzz/test-corpus.c:185
2023-08-11T12:46:18.7613758Z     #19 0x564031adb89f in main fuzz/test-corpus.c:229
2023-08-11T12:46:18.7614154Z     #20 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7614607Z     #21 0x7f458cbe6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
2023-08-11T12:46:18.7615088Z     #22 0x564031adba44 in _start (/home/runner/work/openssl/openssl/fuzz/asn1-test+0x9a44)
2023-08-11T12:46:18.7615314Z 
2023-08-11T12:46:18.7615520Z     #0 0x7f458f6fff18 in __sanitizer_print_stack_trace ../../../../src/libsanitizer/asan/asan_stack.cpp:86
2023-08-11T12:46:18.7615964Z     #1 0x564031ade6f4 in my_realloc fuzz/test-corpus.c:132
2023-08-11T12:46:18.7616412Z     #2 0x7f458ddab9da in ASN1_STRING_set crypto/asn1/asn1_lib.c:306
2023-08-11T12:46:18.7616746Z     #3 0x7f458dd89623 in ossl_c2i_ASN1_INTEGER crypto/asn1/a_int.c:306
2023-08-11T12:46:18.7617077Z     #4 0x7f458ddc63c9 in asn1_ex_c2i crypto/asn1/tasn_dec.c:892
2023-08-11T12:46:18.7617418Z     #5 0x7f458ddc63c9 in asn1_d2i_ex_primitive crypto/asn1/tasn_dec.c:818
2023-08-11T12:46:18.7617758Z     #6 0x7f458ddc88aa in asn1_item_embed_d2i crypto/asn1/tasn_dec.c:256
2023-08-11T12:46:18.7618112Z     #7 0x7f458ddcb534 in asn1_item_ex_d2i_intern crypto/asn1/tasn_dec.c:118
2023-08-11T12:46:18.7618459Z     #8 0x7f458ddcb534 in ASN1_item_d2i_ex crypto/asn1/tasn_dec.c:144
2023-08-11T12:46:18.7618793Z     #9 0x7f458ddada88 in asn1_parse2 crypto/asn1/asn1_parse.c:265
2023-08-11T12:46:18.7619114Z     #10 0x7f458ddad84c in asn1_parse2 crypto/asn1/asn1_parse.c:143
2023-08-11T12:46:18.7619448Z     #11 0x7f458ddad84c in asn1_parse2 crypto/asn1/asn1_parse.c:143
2023-08-11T12:46:18.7619789Z     #12 0x7f458ddad84c in asn1_parse2 crypto/asn1/asn1_parse.c:143
2023-08-11T12:46:18.7620122Z     #13 0x7f458ddaee16 in ASN1_parse_dump crypto/asn1/asn1_parse.c:91
2023-08-11T12:46:18.7620478Z     #14 0x7f458ddd2cf3 in asn1_primitive_print crypto/asn1/tasn_prn.c:525
2023-08-11T12:46:18.7620838Z     #15 0x7f458ddd2cf3 in asn1_item_print_ctx crypto/asn1/tasn_prn.c:175
2023-08-11T12:46:18.7621183Z     #16 0x7f458ddd431e in ASN1_item_print crypto/asn1/tasn_prn.c:131
2023-08-11T12:46:18.7621510Z     #17 0x564031adbf5c in FuzzerTestOneInput fuzz/asn1.c:320
2023-08-11T12:46:18.7621913Z     #18 0x564031ade271 in testfile fuzz/test-corpus.c:185
2023-08-11T12:46:18.7622285Z     #19 0x564031adb89f in main fuzz/test-corpus.c:229
2023-08-11T12:46:18.7622670Z     #20 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7623117Z     #21 0x7f458cbe6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
2023-08-11T12:46:18.7623613Z     #22 0x564031adba44 in _start (/home/runner/work/openssl/openssl/fuzz/asn1-test+0x9a44)
2023-08-11T12:46:18.7623846Z 
2023-08-11T12:46:18.7624149Z     #0 0x7f458f6fff18 in __sanitizer_print_stack_trace ../../../../src/libsanitizer/asan/asan_stack.cpp:86
2023-08-11T12:46:18.7624588Z     #1 0x564031ade6f4 in my_realloc fuzz/test-corpus.c:132
2023-08-11T12:46:18.7624919Z     #2 0x7f458ddab9da in ASN1_STRING_set crypto/asn1/asn1_lib.c:306
2023-08-11T12:46:18.7625261Z     #3 0x7f458dd89623 in ossl_c2i_ASN1_INTEGER crypto/asn1/a_int.c:306
2023-08-11T12:46:18.7625577Z     #4 0x7f458ddc63c9 in asn1_ex_c2i crypto/asn1/tasn_dec.c:892
2023-08-11T12:46:18.7625919Z     #5 0x7f458ddc63c9 in asn1_d2i_ex_primitive crypto/asn1/tasn_dec.c:818
2023-08-11T12:46:18.7626270Z     #6 0x7f458ddc88aa in asn1_item_embed_d2i crypto/asn1/tasn_dec.c:256
2023-08-11T12:46:18.7626609Z     #7 0x7f458ddcb534 in asn1_item_ex_d2i_intern crypto/asn1/tasn_dec.c:118
2023-08-11T12:46:18.7626959Z     #8 0x7f458ddcb534 in ASN1_item_d2i_ex crypto/asn1/tasn_dec.c:144
2023-08-11T12:46:18.7627301Z     #9 0x7f458ddada88 in asn1_parse2 crypto/asn1/asn1_parse.c:265
2023-08-11T12:46:18.7627640Z     #10 0x7f458ddad84c in asn1_parse2 crypto/asn1/asn1_parse.c:143
2023-08-11T12:46:18.7627964Z     #11 0x7f458ddad84c in asn1_parse2 crypto/asn1/asn1_parse.c:143
2023-08-11T12:46:18.7628296Z     #12 0x7f458ddad84c in asn1_parse2 crypto/asn1/asn1_parse.c:143
2023-08-11T12:46:18.7628636Z     #13 0x7f458ddaee16 in ASN1_parse_dump crypto/asn1/asn1_parse.c:91
2023-08-11T12:46:18.7628975Z     #14 0x7f458ddd2cf3 in asn1_primitive_print crypto/asn1/tasn_prn.c:525
2023-08-11T12:46:18.7629333Z     #15 0x7f458ddd2cf3 in asn1_item_print_ctx crypto/asn1/tasn_prn.c:175
2023-08-11T12:46:18.7629679Z     #16 0x7f458ddd431e in ASN1_item_print crypto/asn1/tasn_prn.c:131
2023-08-11T12:46:18.7630017Z     #17 0x564031adbf5c in FuzzerTestOneInput fuzz/asn1.c:320
2023-08-11T12:46:18.7630407Z     #18 0x564031ade271 in testfile fuzz/test-corpus.c:185
2023-08-11T12:46:18.7630782Z     #19 0x564031adb89f in main fuzz/test-corpus.c:229
2023-08-11T12:46:18.7631277Z     #20 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7631720Z     #21 0x7f458cbe6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
2023-08-11T12:46:18.7632215Z     #22 0x564031adba44 in _start (/home/runner/work/openssl/openssl/fuzz/asn1-test+0x9a44)
2023-08-11T12:46:18.7632442Z 
2023-08-11T12:46:18.7632648Z     #0 0x7f458f6fff18 in __sanitizer_print_stack_trace ../../../../src/libsanitizer/asan/asan_stack.cpp:86
2023-08-11T12:46:18.7633095Z     #1 0x564031ade6f4 in my_realloc fuzz/test-corpus.c:132
2023-08-11T12:46:18.7633413Z     #2 0x7f458ddab9da in ASN1_STRING_set crypto/asn1/asn1_lib.c:306
2023-08-11T12:46:18.7633746Z     #3 0x7f458ddc6b8e in asn1_ex_c2i crypto/asn1/tasn_dec.c:943
2023-08-11T12:46:18.7634088Z     #4 0x7f458ddc6b8e in asn1_d2i_ex_primitive crypto/asn1/tasn_dec.c:818
2023-08-11T12:46:18.7634427Z     #5 0x7f458ddc88aa in asn1_item_embed_d2i crypto/asn1/tasn_dec.c:256
2023-08-11T12:46:18.7634782Z     #6 0x7f458ddc98fe in asn1_template_noexp_d2i crypto/asn1/tasn_dec.c:651
2023-08-11T12:46:18.7635154Z     #7 0x7f458ddca7b8 in asn1_template_ex_d2i crypto/asn1/tasn_dec.c:558
2023-08-11T12:46:18.7635497Z     #8 0x7f458ddc7ab0 in asn1_item_embed_d2i crypto/asn1/tasn_dec.c:214
2023-08-11T12:46:18.7635845Z     #9 0x7f458ddcb534 in asn1_item_ex_d2i_intern crypto/asn1/tasn_dec.c:118
2023-08-11T12:46:18.7636189Z     #10 0x7f458ddcb534 in ASN1_item_d2i_ex crypto/asn1/tasn_dec.c:144
2023-08-11T12:46:18.7636528Z     #11 0x564031adbf0b in FuzzerTestOneInput fuzz/asn1.c:315
2023-08-11T12:46:18.7636913Z     #12 0x564031ade271 in testfile fuzz/test-corpus.c:185
2023-08-11T12:46:18.7637286Z     #13 0x564031adb89f in main fuzz/test-corpus.c:229
2023-08-11T12:46:18.7637680Z     #14 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7638117Z     #15 0x7f458cbe6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
2023-08-11T12:46:18.7638609Z     #16 0x564031adba44 in _start (/home/runner/work/openssl/openssl/fuzz/asn1-test+0x9a44)
2023-08-11T12:46:18.7638839Z 
2023-08-11T12:46:18.7639141Z     #0 0x7f458f6fff18 in __sanitizer_print_stack_trace ../../../../src/libsanitizer/asan/asan_stack.cpp:86
2023-08-11T12:46:18.7639589Z     #1 0x564031ade774 in my_malloc fuzz/test-corpus.c:117
2023-08-11T12:46:18.7639946Z     #2 0x7f458e2fe7ac in stack_to_property_list crypto/property/property_parse.c:289
2023-08-11T12:46:18.7640350Z     #3 0x7f458e2ffafe in ossl_parse_property crypto/property/property_parse.c:365
2023-08-11T12:46:18.7640763Z     #4 0x7f458e05db06 in ossl_decoder_from_algorithm crypto/encode_decode/decoder_meth.c:217
2023-08-11T12:46:18.7641153Z     #5 0x7f458e05e411 in construct_decoder crypto/encode_decode/decoder_meth.c:312
2023-08-11T12:46:18.7641527Z     #6 0x7f458e18089d in ossl_method_construct_this crypto/core_fetch.c:109
2023-08-11T12:46:18.7641890Z     #7 0x7f458e17ff80 in algorithm_do_map crypto/core_algorithm.c:77
2023-08-11T12:46:18.7642247Z     #8 0x7f458e17ff80 in algorithm_do_this crypto/core_algorithm.c:122
2023-08-11T12:46:18.7642620Z     #9 0x7f458e1af23e in ossl_provider_doall_activated crypto/provider_core.c:1423
2023-08-11T12:46:18.7642998Z     #10 0x7f458e180529 in ossl_algorithm_do_all crypto/core_algorithm.c:162
2023-08-11T12:46:18.7643354Z     #11 0x7f458e181211 in ossl_method_construct crypto/core_fetch.c:153
2023-08-11T12:46:18.7643716Z     #12 0x7f458e05f880 in inner_ossl_decoder_fetch crypto/encode_decode/decoder_meth.c:382
2023-08-11T12:46:18.7644121Z     #13 0x7f458e05f880 in OSSL_DECODER_do_all_provided crypto/encode_decode/decoder_meth.c:558
2023-08-11T12:46:18.7644542Z     #14 0x7f458e06192a in ossl_decoder_ctx_setup_for_pkey crypto/encode_decode/decoder_pkey.c:446
2023-08-11T12:46:18.7644961Z     #15 0x7f458e061c09 in OSSL_DECODER_CTX_new_for_pkey crypto/encode_decode/decoder_pkey.c:503
2023-08-11T12:46:18.7645334Z     #16 0x7f458ddbaf1c in d2i_PrivateKey_decoder crypto/asn1/d2i_pr.c:67
2023-08-11T12:46:18.7645697Z     #17 0x7f458ddbaf1c in d2i_AutoPrivateKey_ex crypto/asn1/d2i_pr.c:237
2023-08-11T12:46:18.7646164Z     #18 0x564031add6dc in FuzzerTestOneInput fuzz/asn1.c:366
2023-08-11T12:46:18.7646560Z     #19 0x564031ade271 in testfile fuzz/test-corpus.c:185
2023-08-11T12:46:18.7646934Z     #20 0x564031adb89f in main fuzz/test-corpus.c:229
2023-08-11T12:46:18.7647477Z     #21 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7647937Z     #22 0x7f458cbe6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
2023-08-11T12:46:18.7648418Z     #23 0x564031adba44 in _start (/home/runner/work/openssl/openssl/fuzz/asn1-test+0x9a44)
2023-08-11T12:46:18.7648646Z 
2023-08-11T12:46:18.7648853Z     #0 0x7f458f6fff18 in __sanitizer_print_stack_trace ../../../../src/libsanitizer/asan/asan_stack.cpp:86
2023-08-11T12:46:18.7649314Z     #1 0x564031ade6f4 in my_realloc fuzz/test-corpus.c:132
2023-08-11T12:46:18.7649637Z     #2 0x7f458e3aad4a in sk_reserve crypto/stack/stack.c:215
2023-08-11T12:46:18.7649960Z     #3 0x7f458e3aad4a in OPENSSL_sk_insert crypto/stack/stack.c:271
2023-08-11T12:46:18.7650316Z     #4 0x7f458e331200 in sk_BIGNUM_const_push crypto/rsa/rsa_lib.c:839
2023-08-11T12:46:18.7650670Z     #5 0x7f458e331200 in ossl_rsa_get0_all_params crypto/rsa/rsa_lib.c:869
2023-08-11T12:46:18.7651004Z     #6 0x7f458e326a84 in ossl_rsa_todata crypto/rsa/rsa_backend.c:136
2023-08-11T12:46:18.7651388Z     #7 0x7f458e51801e in rsa_get_params providers/implementations/keymgmt/rsa_kmgmt.c:375
2023-08-11T12:46:18.7651790Z     #8 0x7f458e121588 in evp_keymgmt_util_cache_keyinfo crypto/evp/keymgmt_lib.c:306
2023-08-11T12:46:18.7652160Z     #9 0x7f458e1218b2 in evp_keymgmt_util_assign_pkey crypto/evp/keymgmt_lib.c:69
2023-08-11T12:46:18.7652539Z     #10 0x7f458e12192c in evp_keymgmt_util_make_pkey crypto/evp/keymgmt_lib.c:80
2023-08-11T12:46:18.7652927Z     #11 0x7f458e060770 in decoder_construct_pkey crypto/encode_decode/decoder_pkey.c:174
2023-08-11T12:46:18.7653315Z     #12 0x7f458e05b979 in decoder_process crypto/encode_decode/decoder_lib.c:745
2023-08-11T12:46:18.7653721Z     #13 0x7f458e4b147c in der2key_decode providers/implementations/encode_decode/decode_der2key.c:300
2023-08-11T12:46:18.7654262Z     #14 0x7f458e05beec in decoder_process crypto/encode_decode/decoder_lib.c:971
2023-08-11T12:46:18.7654645Z     #15 0x7f458e05c7f9 in OSSL_DECODER_from_bio crypto/encode_decode/decoder_lib.c:82
2023-08-11T12:46:18.7655028Z     #16 0x7f458e05ccac in OSSL_DECODER_from_data crypto/encode_decode/decoder_lib.c:157
2023-08-11T12:46:18.7655410Z     #17 0x7f458ddbaf49 in d2i_PrivateKey_decoder crypto/asn1/d2i_pr.c:74
2023-08-11T12:46:18.7655771Z     #18 0x7f458ddbaf49 in d2i_AutoPrivateKey_ex crypto/asn1/d2i_pr.c:237
2023-08-11T12:46:18.7656127Z     #19 0x564031add6dc in FuzzerTestOneInput fuzz/asn1.c:366
2023-08-11T12:46:18.7656522Z     #20 0x564031ade271 in testfile fuzz/test-corpus.c:185
2023-08-11T12:46:18.7656929Z     #21 0x564031adb89f in main fuzz/test-corpus.c:229
2023-08-11T12:46:18.7657333Z     #22 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7657774Z     #23 0x7f458cbe6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
2023-08-11T12:46:18.7658276Z     #24 0x564031adba44 in _start (/home/runner/work/openssl/openssl/fuzz/asn1-test+0x9a44)
2023-08-11T12:46:18.7658503Z 
2023-08-11T12:46:18.7658710Z     #0 0x7f458f6fff18 in __sanitizer_print_stack_trace ../../../../src/libsanitizer/asan/asan_stack.cpp:86
2023-08-11T12:46:18.7659151Z     #1 0x564031ade774 in my_malloc fuzz/test-corpus.c:117
2023-08-11T12:46:18.7659513Z     #2 0x7f458e068d38 in ossl_encoder_ctx_setup_for_pkey crypto/encode_decode/encoder_pkey.c:288
2023-08-11T12:46:18.7659930Z     #3 0x7f458e068d38 in OSSL_ENCODER_CTX_new_for_pkey crypto/encode_decode/encoder_pkey.c:383
2023-08-11T12:46:18.7660297Z     #4 0x7f458e134d06 in print_pkey crypto/evp/p_lib.c:1171
2023-08-11T12:46:18.7660628Z     #5 0x7f458e134d06 in EVP_PKEY_print_private crypto/evp/p_lib.c:1202
2023-08-11T12:46:18.7660978Z     #6 0x564031add727 in FuzzerTestOneInput fuzz/asn1.c:366
2023-08-11T12:46:18.7661483Z     #7 0x564031ade271 in testfile fuzz/test-corpus.c:185
2023-08-11T12:46:18.7661860Z     #8 0x564031adb89f in main fuzz/test-corpus.c:229
2023-08-11T12:46:18.7662243Z     #9 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7662696Z     #10 0x7f458cbe6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
2023-08-11T12:46:18.7663192Z     #11 0x564031adba44 in _start (/home/runner/work/openssl/openssl/fuzz/asn1-test+0x9a44)
2023-08-11T12:46:18.7663418Z 
2023-08-11T12:46:18.7663610Z     #0 0x7f458f6fff18 in __sanitizer_print_stack_trace ../../../../src/libsanitizer/asan/asan_stack.cpp:86
2023-08-11T12:46:18.7664058Z     #1 0x564031ade6f4 in my_realloc fuzz/test-corpus.c:132
2023-08-11T12:46:18.7664383Z     #2 0x7f458e3aad4a in sk_reserve crypto/stack/stack.c:215
2023-08-11T12:46:18.7664722Z     #3 0x7f458e3aad4a in OPENSSL_sk_insert crypto/stack/stack.c:271
2023-08-11T12:46:18.7665080Z     #4 0x7f458e2f9919 in sk_IMPLEMENTATION_push crypto/property/property.c:47
2023-08-11T12:46:18.7665471Z     #5 0x7f458e2f9919 in ossl_method_store_add crypto/property/property.c:357
2023-08-11T12:46:18.7665861Z     #6 0x7f458e064c93 in put_encoder_in_store crypto/encode_decode/encoder_meth.c:195
2023-08-11T12:46:18.7666224Z     #7 0x7f458e18098f in ossl_method_construct_this crypto/core_fetch.c:123
2023-08-11T12:46:18.7666587Z     #8 0x7f458e17ff80 in algorithm_do_map crypto/core_algorithm.c:77
2023-08-11T12:46:18.7666946Z     #9 0x7f458e17ff80 in algorithm_do_this crypto/core_algorithm.c:122
2023-08-11T12:46:18.7667325Z     #10 0x7f458e1af23e in ossl_provider_doall_activated crypto/provider_core.c:1423
2023-08-11T12:46:18.7667689Z     #11 0x7f458e180529 in ossl_algorithm_do_all crypto/core_algorithm.c:162
2023-08-11T12:46:18.7668046Z     #12 0x7f458e181211 in ossl_method_construct crypto/core_fetch.c:153
2023-08-11T12:46:18.7668424Z     #13 0x7f458e0654ae in inner_ossl_encoder_fetch crypto/encode_decode/encoder_meth.c:392
2023-08-11T12:46:18.7668822Z     #14 0x7f458e0670dd in OSSL_ENCODER_do_all_provided crypto/encode_decode/encoder_meth.c:549
2023-08-11T12:46:18.7669343Z     #15 0x7f458e068e9a in ossl_encoder_ctx_setup_for_pkey crypto/encode_decode/encoder_pkey.c:302
2023-08-11T12:46:18.7669767Z     #16 0x7f458e068e9a in OSSL_ENCODER_CTX_new_for_pkey crypto/encode_decode/encoder_pkey.c:383
2023-08-11T12:46:18.7670136Z     #17 0x7f458ddbe995 in i2d_provided crypto/asn1/i2d_evp.c:53
2023-08-11T12:46:18.7670459Z     #18 0x564031add74c in FuzzerTestOneInput fuzz/asn1.c:366
2023-08-11T12:46:18.7670863Z     #19 0x564031ade271 in testfile fuzz/test-corpus.c:185
2023-08-11T12:46:18.7671242Z     #20 0x564031adb89f in main fuzz/test-corpus.c:229
2023-08-11T12:46:18.7671625Z     #21 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7672078Z     #22 0x7f458cbe6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
2023-08-11T12:46:18.7672571Z     #23 0x564031adba44 in _start (/home/runner/work/openssl/openssl/fuzz/asn1-test+0x9a44)
2023-08-11T12:46:18.7672803Z 
2023-08-11T12:46:18.7672808Z 
2023-08-11T12:46:18.7672926Z =================================================================
2023-08-11T12:46:18.7673200Z ==173474==ERROR: LeakSanitizer: detected memory leaks
2023-08-11T12:46:18.7673382Z 
2023-08-11T12:46:18.7673525Z Direct leak of 32 byte(s) in 1 object(s) allocated from:
2023-08-11T12:46:18.7673911Z     #0 0x7f458f6f3887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
2023-08-11T12:46:18.7674265Z     #1 0x7f458e18b0e5 in CRYPTO_zalloc crypto/mem.c:197
2023-08-11T12:46:18.7674602Z     #2 0x7f458e3ad433 in OPENSSL_sk_new_reserve crypto/stack/stack.c:228
2023-08-11T12:46:18.7674998Z     #3 0x7f458e068a61 in ossl_encoder_ctx_setup_for_pkey crypto/encode_decode/encoder_pkey.c:259
2023-08-11T12:46:18.7675418Z     #4 0x7f458e068a61 in OSSL_ENCODER_CTX_new_for_pkey crypto/encode_decode/encoder_pkey.c:383
2023-08-11T12:46:18.7675767Z     #5 0x7f458e134d06 in print_pkey crypto/evp/p_lib.c:1171
2023-08-11T12:46:18.7676199Z     #6 0x7f458e134d06 in EVP_PKEY_print_private crypto/evp/p_lib.c:1202
2023-08-11T12:46:18.7676555Z     #7 0x564031add727 in FuzzerTestOneInput fuzz/asn1.c:366
2023-08-11T12:46:18.7676944Z     #8 0x564031ade271 in testfile fuzz/test-corpus.c:185
2023-08-11T12:46:18.7677317Z     #9 0x564031adb89f in main fuzz/test-corpus.c:229
2023-08-11T12:46:18.7677716Z     #10 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7677907Z 
2023-08-11T12:46:18.7678056Z Indirect leak of 32 byte(s) in 1 object(s) allocated from:
2023-08-11T12:46:18.7678425Z     #0 0x7f458f6f3887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
2023-08-11T12:46:18.7678790Z     #1 0x7f458e18b0e5 in CRYPTO_zalloc crypto/mem.c:197
2023-08-11T12:46:18.7679110Z     #2 0x7f458e3aaf46 in sk_reserve crypto/stack/stack.c:195
2023-08-11T12:46:18.7679429Z     #3 0x7f458e3aaf46 in OPENSSL_sk_insert crypto/stack/stack.c:271
2023-08-11T12:46:18.7679785Z     #4 0x7f458e068333 in collect_name crypto/encode_decode/encoder_pkey.c:145
2023-08-11T12:46:18.7680163Z     #5 0x7f458e068333 in collect_name crypto/encode_decode/encoder_pkey.c:136
2023-08-11T12:46:18.7680530Z     #6 0x7f458e18200d in ossl_namemap_doall_names crypto/core_namemap.c:166
2023-08-11T12:46:18.7680911Z     #7 0x7f458e068aff in ossl_encoder_ctx_setup_for_pkey crypto/encode_decode/encoder_pkey.c:266
2023-08-11T12:46:18.7681333Z     #8 0x7f458e068aff in OSSL_ENCODER_CTX_new_for_pkey crypto/encode_decode/encoder_pkey.c:383
2023-08-11T12:46:18.7681704Z     #9 0x7f458e134d06 in print_pkey crypto/evp/p_lib.c:1171
2023-08-11T12:46:18.7682030Z     #10 0x7f458e134d06 in EVP_PKEY_print_private crypto/evp/p_lib.c:1202
2023-08-11T12:46:18.7682379Z     #11 0x564031add727 in FuzzerTestOneInput fuzz/asn1.c:366
2023-08-11T12:46:18.7682778Z     #12 0x564031ade271 in testfile fuzz/test-corpus.c:185
2023-08-11T12:46:18.7683139Z     #13 0x564031adb89f in main fuzz/test-corpus.c:229
2023-08-11T12:46:18.7683539Z     #14 0x7f458cbe6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-11T12:46:18.7683734Z 
2023-08-11T12:46:18.7684044Z SUMMARY: AddressSanitizer: 64 byte(s) leaked in 2 allocation(s).
2023-08-11T12:46:23.7591233Z ##[error]Process completed with exit code 1.

@bernd-edlinger
Copy link
Member Author

Apparently the same error happened again here: https://github.com/openssl/openssl/actions/runs/5903175415

2023-08-18T13:56:09.0586415Z ERROR_INJECT=1691430364 ../util/shlib_wrap.sh ./asn1-test ./corpora/asn1/a06deb506879277221c053b2e7b635078422d0ec
2023-08-18T13:56:09.0587320Z log file: asn1-a06deb506879277221c053b2e7b635078422d0ec-21165-test.out
2023-08-18T13:56:09.0595669Z ERROR_INJECT=1691430364
2023-08-18T13:56:09.0596176Z # ./corpora/asn1/a06deb506879277221c053b2e7b635078422d0ec
2023-08-18T13:56:09.0597081Z     #0 0x7ff66ef24f18 in __sanitizer_print_stack_trace ../../../../src/libsanitizer/asan/asan_stack.cpp:86
2023-08-18T13:56:09.0597697Z     #1 0x55d668807774 in my_malloc fuzz/test-corpus.c:117
2023-08-18T13:56:09.0598082Z     #2 0x7ff66d88dd38 in ossl_encoder_ctx_setup_for_pkey crypto/encode_decode/encoder_pkey.c:288
2023-08-18T13:56:09.0598515Z     #3 0x7ff66d88dd38 in OSSL_ENCODER_CTX_new_for_pkey crypto/encode_decode/encoder_pkey.c:383
2023-08-18T13:56:09.0598878Z     #4 0x7ff66d5e3995 in i2d_provided crypto/asn1/i2d_evp.c:53
2023-08-18T13:56:09.0599211Z     #5 0x55d66880674c in FuzzerTestOneInput fuzz/asn1.c:366
2023-08-18T13:56:09.0599813Z     #6 0x55d668807271 in testfile fuzz/test-corpus.c:185
2023-08-18T13:56:09.0600549Z     #7 0x55d66880489f in main fuzz/test-corpus.c:229
2023-08-18T13:56:09.0600944Z     #8 0x7ff66c40bd8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-18T13:56:09.0601406Z     #9 0x7ff66c40be3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
2023-08-18T13:56:09.0601901Z     #10 0x55d668804a44 in _start (/home/runner/work/openssl/openssl/fuzz/asn1-test+0x9a44)
2023-08-18T13:56:09.0602129Z 
2023-08-18T13:56:09.0602135Z 
2023-08-18T13:56:09.0602236Z =================================================================
2023-08-18T13:56:09.0602522Z ==173828==ERROR: LeakSanitizer: detected memory leaks
2023-08-18T13:56:09.0602703Z 
2023-08-18T13:56:09.0602847Z Direct leak of 32 byte(s) in 1 object(s) allocated from:
2023-08-18T13:56:09.0603231Z     #0 0x7ff66ef18887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
2023-08-18T13:56:09.0603594Z     #1 0x7ff66d9b00e5 in CRYPTO_zalloc crypto/mem.c:197
2023-08-18T13:56:09.0603937Z     #2 0x7ff66dbd2433 in OPENSSL_sk_new_reserve crypto/stack/stack.c:228
2023-08-18T13:56:09.0604336Z     #3 0x7ff66d88da61 in ossl_encoder_ctx_setup_for_pkey crypto/encode_decode/encoder_pkey.c:259
2023-08-18T13:56:09.0604742Z     #4 0x7ff66d88da61 in OSSL_ENCODER_CTX_new_for_pkey crypto/encode_decode/encoder_pkey.c:383
2023-08-18T13:56:09.0605116Z     #5 0x7ff66d5e3995 in i2d_provided crypto/asn1/i2d_evp.c:53
2023-08-18T13:56:09.0605444Z     #6 0x55d66880674c in FuzzerTestOneInput fuzz/asn1.c:366
2023-08-18T13:56:09.0605837Z     #7 0x55d668807271 in testfile fuzz/test-corpus.c:185
2023-08-18T13:56:09.0606190Z     #8 0x55d66880489f in main fuzz/test-corpus.c:229
2023-08-18T13:56:09.0606581Z     #9 0x7ff66c40bd8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-18T13:56:09.0606767Z 
2023-08-18T13:56:09.0606912Z Indirect leak of 32 byte(s) in 1 object(s) allocated from:
2023-08-18T13:56:09.0607282Z     #0 0x7ff66ef18887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
2023-08-18T13:56:09.0607817Z     #1 0x7ff66d9b00e5 in CRYPTO_zalloc crypto/mem.c:197
2023-08-18T13:56:09.0608160Z     #2 0x7ff66dbcff46 in sk_reserve crypto/stack/stack.c:195
2023-08-18T13:56:09.0608504Z     #3 0x7ff66dbcff46 in OPENSSL_sk_insert crypto/stack/stack.c:271
2023-08-18T13:56:09.0608856Z     #4 0x7ff66d88d333 in collect_name crypto/encode_decode/encoder_pkey.c:145
2023-08-18T13:56:09.0609233Z     #5 0x7ff66d88d333 in collect_name crypto/encode_decode/encoder_pkey.c:136
2023-08-18T13:56:09.0609606Z     #6 0x7ff66d9a700d in ossl_namemap_doall_names crypto/core_namemap.c:166
2023-08-18T13:56:09.0609992Z     #7 0x7ff66d88daff in ossl_encoder_ctx_setup_for_pkey crypto/encode_decode/encoder_pkey.c:266
2023-08-18T13:56:09.0610417Z     #8 0x7ff66d88daff in OSSL_ENCODER_CTX_new_for_pkey crypto/encode_decode/encoder_pkey.c:383
2023-08-18T13:56:09.0610787Z     #9 0x7ff66d5e3995 in i2d_provided crypto/asn1/i2d_evp.c:53
2023-08-18T13:56:09.0611125Z     #10 0x55d66880674c in FuzzerTestOneInput fuzz/asn1.c:366
2023-08-18T13:56:09.0611521Z     #11 0x55d668807271 in testfile fuzz/test-corpus.c:185
2023-08-18T13:56:09.0611896Z     #12 0x55d66880489f in main fuzz/test-corpus.c:229
2023-08-18T13:56:09.0612290Z     #13 0x7ff66c40bd8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
2023-08-18T13:56:09.0612482Z 
2023-08-18T13:56:09.0612635Z SUMMARY: AddressSanitizer: 64 byte(s) leaked in 2 allocation(s).
2023-08-18T13:56:14.0654020Z ##[error]Process completed with exit code 1.

@mattcaswell
Copy link
Member

#21796 should fix the latest issue

@t8m t8m added triaged: bug The issue/pr is/fixes a bug tests: present The PR has suitable tests present hold: wait for master The pull request must wait for approval of the equivalent change on master labels Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch: 3.1 Merge to openssl-3.1 hold: wait for master The pull request must wait for approval of the equivalent change on master tests: present The PR has suitable tests present triaged: bug The issue/pr is/fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants