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
Initialize member data in PerigeeTrajectoryError #36895
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36895/28169
|
A new Pull Request was created by @Dr15Jones (Chris Jones) for master. It involves the following packages:
@jpata, @cmsbuild, @clacaputo, @slava77 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-7fd39e/22237/summary.html Comparison SummarySummary:
|
+reconstruction
|
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2) |
TrackingTools/TrajectoryParametrization/interface/PerigeeTrajectoryError.h
Outdated
Show resolved
Hide resolved
This should fix the UBSAN warnings.
0e4b742
to
b17a78f
Compare
Pull request #36895 was updated. @jpata, @clacaputo, @slava77 can you please check and sign again. |
please test |
Do not really understand this one. |
This stems from the UBSAN IB
e.g.
Based on all the reports I've looked at, it appears the UBSAN only detects when bools are not properly initialized and doesn't do so for any other builtin types. The few cases I've more closely looked at happen when either the copy constructor or
I've found that people who do not know that C++ doesn't initialize builtin type member data assume it will be initialized to 0 (so I was just following that chain of thought). |
This is what I would call a "false positive" and I object to fix correct code only because a tool does not understand the logic. |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-7fd39e/22268/summary.html Comparison SummarySummary:
|
So how do we want to proceed here? Do tracking experts confirm the behavior is intended (and UBSAN should be suppressed here), or should this be investigated further? Does UBSAN give some more information about where the uninitialized use is happening? |
The actual UBSAN log does give a traceback. Unfortunately, only the addresses inside the library are given, not the actual symbol names. @smuzaffar any ideas on getting the symbols? |
@Dr15Jones , I will enable |
cms-sw/cmsdist#7608 should build UBSAN in debug mode now |
I did a bit of poking about. An invalid PerigeeTrajectoryError is created in this constructor cmssw/TrackingTools/TrajectoryState/interface/TrajectoryStateClosestToPoint.h Lines 31 to 41 in e798919
then a call to cmssw/RecoVertex/VertexTools/interface/PerigeeLinearizedTrackState.h Lines 237 to 245 in e798919
can be made where
) which mean the returned info from the call to This does seem to mean that |
thanks, let's see what the tracking experts suggest here. |
So should we instead use |
|
@VinInn would you have some time to suggest a fix here? I was not able to dig up if just replacing by 1 is fine here or not, sorry. |
I would just leave it as it was... |
or fix the logic of the user of |
I just happened to spot that problem. There could be addition cases where the uninitialized data is read and there could be more in the future as people change/add code. |
How the class shall be used is clear: it has a method to ask if the error is available. |
It looks to me based on the above discussion that
Any objections? |
On 17 Feb, 2022, at 5:38 PM, Joosep Pata ***@***.***> wrote:
• some action is needed to either remove or prevent the possibility of the UB (just thinking out loud, could it be better to abort the job rather than have undefined behaviour?)
any uninitialized bool allocated on the heap will upset UBSAN. (not other type though, uint8_t is ok!)
It is a false positive. nothing to fix (but the tool).
and there is nothing to abort. the code is correct, there is no evidence that anybody is asking for the error when none is provided.
v.
|
-reconstruction As I understand, the fix proposed here by Chris is not universally accepted, so the tracking POG may be in a position decide here if/how this is to be fixed. I found an older issue for this #35036 (comment), where I updated the status. There are a few more cases in tracking packages. |
under protest I will close this |
PR description:
This should fix the UBSAN warnings.
PR validation:
Code compiles.