-
Notifications
You must be signed in to change notification settings - Fork 863
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
MSAN Errors Reported by Clang Memory Sanitizer #1609
Comments
Related to #1547 |
I don't know exactly how the results from Sanitizer should be interpreted, but my analysis of the code doesn't confirm your statements at all:
True, but you have actually shown an example where all global variables are in the same source file. In this case, AFAIK, C++ guarantees that they are initialized in the order of declaration (between one another in this unit only).
Neither the constructor of As I analyze the call stack you provided, it looks like this call passes down the value that is later accused of not having been initialized (symbols simplified):
It is unclear from the call stack which of two are being accused, but there are two possibilities:
The initialization of both takes place:
And referring to this, you are speaking about a variable that is earlier defined as this one, and in the same translation unit, so according to the C++ initialization rules it's not possible that its constructor isn't called yet.
I think in these cases the sanitizer is simply wrong, or at least I have no idea what criteria it has used to define this case as the creation of uninitialized value, but this at least isn't the case according to C++ standard. Other cases I saw is referring to likely Not analyzed the whole report yet, but others look very similar. |
HMM. You are right. The first messages seem to the complaining about using unitialized content of the stack variable I guess we should consider this spurious and close the issue. |
The log, however, contains more information and this likely should be analyzed; I'll continue looking into the rest of them. |
Ok, per the amount of changes that went in in the meantime, I think the sanitizer analysis should be now repeated. This info is now likely outdated. |
Closing this issue. The work on the sanitizer issues will be tracked under #1813 further. |
Describe the bug
test-msan-2021014-01.log
During global variable initialization before start of main, there are various global variables in different source files that cause other global object variables in other source files to be accessed before the constructor of the object has run. Many of these objects are STL objects and not in a valid state when this happens. A solution to this problem is to consolidate all of the global variables into one source file and list them in the order that their constructors need to run. C++ does not guarantee the order of global variable construction between source files.
For instance the attached log shows this global variable being initialized:
#12 0x48df44 in __cxx_global_var_init.22 /mnt/share/open/srt-testing/srt/apps/logsupport.cpp:102:12
The constructor eventually calls
/mnt/share/open/srt-testing/srt/apps/logsupport.cpp:95
Which uses another global variable:
/mnt/share/open/srt-testing/srt/apps/logsupport.cpp:28
Whose constructor has not been called yet.
There are many cases like this.
To Reproduce
Run srt-live-transmit for instance:
./stage/bin/srt-live-transmit udp://239.66.133.30:4902 srt://:12345
Expected behavior
All global objects should have been properly constructed before used.
Screenshots
None.
Desktop (please provide the following information):
Additional context
None.
test-msan-2021014-01.log
The text was updated successfully, but these errors were encountered: