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

[FreeRDP] Pass CMake flag BUILD_TESTING and use a target for building fuzzers #10448

Merged
merged 3 commits into from
Jun 7, 2023
Merged

[FreeRDP] Pass CMake flag BUILD_TESTING and use a target for building fuzzers #10448

merged 3 commits into from
Jun 7, 2023

Conversation

ligurio
Copy link
Contributor

@ligurio ligurio commented Jun 2, 2023

Depends on PR FreeRDP/FreeRDP#9019

@ligurio ligurio marked this pull request as draft June 2, 2023 09:59
@ligurio
Copy link
Contributor Author

ligurio commented Jun 6, 2023

[320/322] Linking C executable Testing/TestFuzzCommonAssistanceBinToHexString                                                                                         
FAILED: Testing/TestFuzzCommonAssistanceBinToHexString                                                                                                                
: && /usr/local/bin/clang -O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-sc
ope -fsanitize=fuzzer-no-link -Wno-c11-extensions -Wno-gnu -fno-omit-frame-pointer -fsanitize=address -fsanitize-blacklist=/src/FreeRDP/scripts/blacklist-address-sani
tizer.txt -fsanitize-address-use-after-scope -g -flto=thin -O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=addres
s -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -stdlib=libc++ -fsanitize=address libfreerdp/common/test/CMakeFiles/TestFuzzCommonAssistanceBinToHexStr
ing.dir/TestFuzzCommonAssistanceBinToHexString.c.o -o Testing/TestFuzzCommonAssistanceBinToHexString  libfreerdp/libfreerdp3.a  winpr/libwinpr/libwinpr3.a  -lrt  -lm 
 /usr/lib/x86_64-linux-gnu/libicui18n.a  /usr/lib/x86_64-linux-gnu/libicuuc.a  /usr/lib/x86_64-linux-gnu/libicuio.a  /usr/lib/x86_64-linux-gnu/libssl.a  /usr/lib/x86_
64-linux-gnu/libcrypto.a  -ldl  -fsanitize=fuzzer && :
clang-15: error: unable to execute command: Segmentation fault (core dumped)                                                                                          
clang-15: error: linker command failed due to signal (use -v to see invocation)                                                                                       
[321/322] Linking C executable Testing/TestFuzzCommonAssistanceHexStringToBin                                                                                         
FAILED: Testing/TestFuzzCommonAssistanceHexStringToBin                                                                                                                
: && /usr/local/bin/clang -O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-sc
ope -fsanitize=fuzzer-no-link -Wno-c11-extensions -Wno-gnu -fno-omit-frame-pointer -fsanitize=address -fsanitize-blacklist=/src/FreeRDP/scripts/blacklist-address-sani
tizer.txt -fsanitize-address-use-after-scope -g -flto=thin -O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=addres
s -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -stdlib=libc++ -fsanitize=address libfreerdp/common/test/CMakeFiles/TestFuzzCommonAssistanceHexStringTo
Bin.dir/TestFuzzCommonAssistanceHexStringToBin.c.o -o Testing/TestFuzzCommonAssistanceHexStringToBin  libfreerdp/libfreerdp3.a  winpr/libwinpr/libwinpr3.a  -lrt  -lm 
 /usr/lib/x86_64-linux-gnu/libicui18n.a  /usr/lib/x86_64-linux-gnu/libicuuc.a  /usr/lib/x86_64-linux-gnu/libicuio.a  /usr/lib/x86_64-linux-gnu/libssl.a  /usr/lib/x86_
64-linux-gnu/libcrypto.a  -ldl  -fsanitize=fuzzer && :
clang-15: error: unable to execute command: Segmentation fault (core dumped)                                                                                          
clang-15: error: linker command failed due to signal (use -v to see invocation)                                                                                       
[322/322] Linking C executable Testing/TestFuzzCommonAssistanceParseFileBuffer                                                                                        
FAILED: Testing/TestFuzzCommonAssistanceParseFileBuffer                                                                                                               
: && /usr/local/bin/clang -O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-sc
ope -fsanitize=fuzzer-no-link -Wno-c11-extensions -Wno-gnu -fno-omit-frame-pointer -fsanitize=address -fsanitize-blacklist=/src/FreeRDP/scripts/blacklist-address-sani
tizer.txt -fsanitize-address-use-after-scope -g -flto=thin -O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=addres
s -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -stdlib=libc++ -fsanitize=address libfreerdp/common/test/CMakeFiles/TestFuzzCommonAssistanceParseFileBu
ffer.dir/TestFuzzCommonAssistanceParseFileBuffer.c.o -o Testing/TestFuzzCommonAssistanceParseFileBuffer  libfreerdp/libfreerdp3.a  winpr/libwinpr/libwinpr3.a  -lrt  -
lm  /usr/lib/x86_64-linux-gnu/libicui18n.a  /usr/lib/x86_64-linux-gnu/libicuuc.a  /usr/lib/x86_64-linux-gnu/libicuio.a  /usr/lib/x86_64-linux-gnu/libssl.a  /usr/lib/x
86_64-linux-gnu/libcrypto.a  -ldl  -fsanitize=fuzzer && :
clang-15: error: unable to execute command: Segmentation fault (core dumped)  

@ligurio ligurio mentioned this pull request Jun 6, 2023
@maflcko
Copy link
Contributor

maflcko commented Jun 6, 2023

No idea if it is going to help, but have you tried with lto disabled?

@ligurio
Copy link
Contributor Author

ligurio commented Jun 6, 2023

No idea if it is going to help, but have you tried with lto disabled?

@MarcoFalke seems it helps! thanks!

ligurio added 3 commits June 6, 2023 12:29
It is required because some modules enables testing only with this flag.
MSan triggers on OpenSSL function:

```
Uninitialized bytes in __interceptor_fopen64 at offset 0 inside [0x7020000178c0, 25)
==182==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0xe59129 in BIO_new_file (/tmp/not-out/tmpl27pqwad/TestFuzzCommonAssistanceParseFileBuffer+0xe59129)
    #1 0xfbd25d in def_load conf_def.o
    #2 0xe69a9c in CONF_modules_load_file (/tmp/not-out/tmpl27pqwad/TestFuzzCommonAssistanceParseFileBuffer+0xe69a9c)
    #3 0xf50bdf in openssl_config_int (/tmp/not-out/tmpl27pqwad/TestFuzzCommonAssistanceParseFileBuffer+0xf50bdf)
    #4 0xeb00f3 in ossl_init_config_ossl_ init.o
```

According to an issue [1] it is a false positive, MemorySanitizer
requires fully instrumented builds to be able to use the it. Disable
MemorySanitizer for now.

1. openssl/openssl#11013
@ligurio ligurio marked this pull request as ready for review June 7, 2023 13:25
@ligurio
Copy link
Contributor Author

ligurio commented Jun 7, 2023

@jonathanmetzman could you review, please?

Copy link
Contributor

@jonathanmetzman jonathanmetzman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jonathanmetzman
Copy link
Contributor

Do you have to disable MSAN?

@ligurio
Copy link
Contributor Author

ligurio commented Jun 7, 2023

Do you have to disable MSAN?

Right. Due to false positive in OpenSSL.
I don't have enough power to instrument all dependencies by MSan to avoid FP's.

@jonathanmetzman jonathanmetzman merged commit 5581ebe into google:master Jun 7, 2023
@ligurio ligurio deleted the ligurio/freerdp-fixes branch June 7, 2023 18:39
@ligurio
Copy link
Contributor Author

ligurio commented Jun 7, 2023

@jonathanmetzman is there a policy to squash commits on merge? All my commit messages with exlanations/descriptions were lost :(

@jonathanmetzman
Copy link
Contributor

Sorry about that. I don't think we do, and to be honest, I don't think we pay a whole lot of attention to what goes in the messages.
Would developers squashing their commits themselves fix this issue?

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

Successfully merging this pull request may close these issues.

3 participants