-
Notifications
You must be signed in to change notification settings - Fork 87
DISPATCH-1467: enable AddressSanitizer build option (ASAN) #608
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #608 +/- ##
==========================================
+ Coverage 86.44% 86.47% +0.03%
==========================================
Files 91 91
Lines 20622 20618 -4
==========================================
+ Hits 17826 17830 +4
+ Misses 2796 2788 -8
Continue to review full report at Codecov.
|
|
I didn't notice the GH mention before. I read through the PR diff. I'll now try compiling and running with GCC and Clang. |
|
When compiling and running tests with gcc, with libwebsocket available, I got this crash in test 9 and in other tests which don't readily print these messages, and in test 19 which prints it. After that I killed ctest. When compiled without libwebsocket, I get clean result, except for system_tests_console. That probably should not run, when I don't have libwebsockets? The libwebsocket failConsole test fail |
|
With Clang, dispatch failed to link. I think this is because of |
|
Ok, it is the tsan change. http://clang.llvm.org/docs/AddressSanitizer.html mentions that the shared asan library will not link when -Wl,-z,defs is used. BeforeLines 213 to 215 in bd471c1
Nowqpid-dispatch/src/CMakeLists.txt Lines 145 to 149 in f03308c
|
246f80c to
1400707
Compare
The libwebsockets issue is known - there's some sort of illegal memory bug in certain versions of libwebsockets: |
|
@jdanekrh - thanks for the review. I've run the patch on Ubuntu 18.04 and 16.04 and have just pushed an update to the suppression files. I've also enabled ASAN checking on one of the travis builds and am testing that now. |
To run the AddressSanitizer, define RUNTIME_CHECK=asan via CMake: cmake .. -DRUNTIME_CHECK=asan This patch updates the .travis.yml file to enable address and undefined behavior checking. Also included are minor code tweaks to issues found when running with the sanitizer enabled. This closes apache#608
1400707 to
c5dddd8
Compare
|
Ok, this patch now passes travis so it's ready for review. |
README
Outdated
| This option turns on extra run time memory verification, including | ||
| leak checks. | ||
|
|
||
| Applicable only to GCC versions >= 7.4 and Clang versions >= 6.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Applicable only to GCC versions >= 7.4 and Clang versions >= 6.0. | |
| Applicable only to GCC versions >= 5.4 and Clang versions >= 6.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch will update thanks.
| getcwd_error = 1; | ||
| break; | ||
| if (errno != ERANGE) { | ||
| // Hard failure - can't recover from this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change does not seem particularly related to this PR. Or is it? If not, can we make this change in a different commit ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is related - the address sanitizer threw a fit on that section of the code - detected a possible buffer overflow. That change is the fix.
To run the AddressSanitizer, define RUNTIME_CHECK=asan via CMake: cmake .. -DRUNTIME_CHECK=asan This patch updates the .travis.yml file to enable address and undefined behavior checking. Also included are minor code tweaks to issues found when running with the sanitizer enabled. This closes apache#608
c5dddd8 to
1c2917d
Compare
Delete the pseudo egress dispatch connection in the same manner as a true tcp connection rather than on a timer thread. Use exact data lengths to verify the TCP counter values.
To run the AddressSanitizer, define RUNTIME_CHECK=asan via CMake:
cmake .. -DRUNTIME_CHECK=asan
This patch includes minor code tweaks to issues found when running
with the sanitizer enabled.