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

[UBSAN] Undefined behavior in DataFormats/FEDRawData #35035

Closed
mrodozov opened this issue Aug 26, 2021 · 8 comments · Fixed by #35039
Closed

[UBSAN] Undefined behavior in DataFormats/FEDRawData #35035

mrodozov opened this issue Aug 26, 2021 · 8 comments · Fixed by #35039

Comments

@mrodozov
Copy link
Contributor

The UBSAN IB reports undefined behavior in 1 file, with example relval and step they appear in:

11603.0 step2
DataFormats/FEDRawData/src/FEDHeader.cc:37:24: runtime error: left shift of 65535 by 20 places cannot be represented in type 'int'

check the relval logs in here for the examples:
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/ubsan_logs/relvals/11603.0_SingleElectronPt1000+2021+SingleElectronPt1000_pythia8_GenSimINPUT+Digi+Reco+HARVEST+ALCA/step2_SingleElectronPt1000+2021+SingleElectronPt1000_pythia8_GenSimINPUT+Digi+Reco+HARVEST+ALCA.log

@cmsbuild
Copy link
Contributor

A new Issue was created by @mrodozov Mircho Rodozov.

@Dr15Jones, @perrotta, @dpiparo, @makortel, @smuzaffar, @qliphy can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@mrodozov
Copy link
Contributor Author

assign daq

@cmsbuild
Copy link
Contributor

New categories assigned: daq

@emeschi,@smorovic you have been requested to review this Pull request/Issue and eventually sign? Thanks

@smorovic
Copy link
Contributor

This is caused by (bxID << FED_BXID_SHIFT).
However, bunch crossing ID is always smaller than 4096, it's using only 12-bits when packed.

From DataFormats/FEDRawData/src/fed_header.h:

#define FED_BXID_WIDTH 0x00000fff
#define FED_BXID_SHIFT 20

So, instead of (bxID << FED_BXID_SHIFT), having ((bxID & FED_BXID_WIDTH) << FED_BXID_SHIFT) should (hopefully?) silence the checker.
I will prepare a PR.

@smorovic
Copy link
Contributor

+1

@cmsbuild
Copy link
Contributor

This issue is fully signed and ready to be closed.

@mrodozov
Copy link
Contributor Author

@smorovic when you make the PR we can test it against the UBSAN IB, and you can type in the description of the pr
Fixes: #35035
which will close this issue as well
Link it to this issue I'll run it against the UBSAN

@smorovic
Copy link
Contributor

Thanks, I edited the PR and included "Fixes: #35035"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants