DeUTDetector - Protect getSectorDirect from out-of-bounds access
Adds runtime protection to prevent out-of-bounds array accesses, such as those triggering errors in the ubsan checks at
https://lhcb-nightlies.cern.ch/nightly/lhcb-sanitizers/build/332/
nullptr
is returned instead.
Merge request reports
Activity
added 1 commit
- 3672636e - DeUTDetector - Protect getSectorDirect from out-of-bounds access
- Resolved by Marco Cattaneo
Note, an alternative to what I have here is to return
return ( fullChanIdx < m_sectors_direct.size() ? m_sectors_direct[fullChanIdx] : nullptr );
then of course the responsibility is on the callee to handle the null pointer possibility.
Plus, of course, a small runtime penalty (although I think the method is only used during initialize() so that would not matter).
Edited by Christopher Rob Jones
added 1 commit
- 98da0b9f - DeUTDetector - Add some runtime array bounds checks and more asserts
- [2019-08-10 00:13] Validation started with lhcb-lcg-dev3#983
- [2019-08-11 00:06] Validation started with lhcb-lcg-dev4#993
- [2019-08-12 00:05] Validation started with lhcb-sanitizers#336
- [2019-08-12 00:06] Validation started with lhcb-lcg-dev4#994
- [2019-08-13 00:09] Validation started with lhcb-lcg-dev4#995
- [2019-08-13 00:10] Validation started with lhcb-sanitizers#337
- [2019-08-14 00:07] Validation started with lhcb-lcg-dev4#996
- [2019-08-14 00:10] Validation started with lhcb-sanitizers#338
- [2019-08-15 00:10] Validation started with lhcb-sanitizers#339
- [2019-08-15 00:10] Validation started with lhcb-lcg-dev4#997
Edited by Software for LHCb- Resolved by Marco Cattaneo
There are a couple of compilation warnings in the debug builds: https://lhcb-nightlies.cern.ch/logs/build/nightly/lhcb-lcg-dev4/993/x86_64-centos7-gcc8-dbg/LHCb/
added 5 commits
-
98da0b9f...e7db5988 - 2 commits from branch
lhcb:master
- 9c057cfb - DeUTDetector - Protect getSectorDirect from out-of-bounds access
- 51e22d72 - DeUTDetector - Add some runtime array bounds checks and more asserts
- c2ae4814 - DeUTDetector - Add more array access protections, retire unnecessary getSectorDirect method
Toggle commit list-
98da0b9f...e7db5988 - 2 commits from branch
mentioned in merge request Rec!1650 (merged)
added 1 commit
- 230c0074 - UTTell1ID - Clean up ostream printout, removing endl's
added 1 commit
- a068a0b1 - UTTell1ID - Clean up ostream printout, removing endl's
added 1 commit
- af656c62 - UTTell1ID - Clean up ostream printout, removing endl's
- Resolved by Marco Cattaneo
I thought I would have a quick look into the origin of the invalid UT IDs that are the cause of the null ptr warnings. The issue starts from the
tMap
vector read from conditions athttps://gitlab.cern.ch/lhcb/LHCb/blob/master/UT/UTDAQ/src/component/UTReadoutTool.cpp#L344
If I add
info() << layers[iReg] << " : " << tMap << endmsg;
I get output like
PrStoreUTHit.UTReadoutTool INFO UTbXMap : [22152192, 22153216, 22154240, 22155264, 22156288, 22157312, 22158336, 22159360, 22160384, 22161408, 22162432, 22163456, 22164480, 22165504, 22166528, 22167552, 22168576, 22169600, 22170624, 22171648, 22172672, 22173696, 22174720, 22175744, 22176768, 22177792, 22178816, 22179840, 22180864, 22181888, 22182912, 22183936, 22184960, 22185984, 22187008, 22188032, 22189056, 22190080, 22191104, 22192128, 22193152, 22194176, 22195200, 22196224, 22197248, 22198272, 22199296, 22200320, 22201344, 22202368, 22203392, 22204416, 22205440, 22206464, 22207488, 22208512, 22209536, 22210560, 22211584, 22212608, 22213632, 22214656, 22215680, 22216704, 22217728, 22218752, 22219776, 22220800, 22221824, 22222848, 22223872, 22224896, 22225920, 22226944, 22227968, 22228992, 22230016, 22231040, 22232064, 22233088, 22234112, 22235136, 22236160, 22237184, 22238208, 22239232, 22240256, 22241280, 22242304, 22243328, 22244352, 22245376, 22246400, 22247424, 22248448, 22249472, 22250496, 22251520, 0, 0, 0, 0, 22283264, 22284288, 22285312, 22286336, 22287360, 22288384, 22289408, 22290432, 22291456, 22292480, 22293504, 22294528, 22295552, 22296576, 22297600, 22298624, 22299648, 22300672, 22301696, 22302720, 22303744, 22304768, 22305792, 22306816, 22307840, 22308864, 22309888, 22310912, 22311936, 22312960, 22313984, 22315008, 22316032, 22317056, 22318080, 22319104, 22320128, 22321152, 22322176, 22323200, 22324224, 22325248, 22326272, 22327296, 22328320, 22329344, 22330368, 22331392, 22332416, 22333440, 22334464, 22335488, 22336512, 22337536, 22338560, 22339584, 22340608, 22341632, 22342656, 22343680, 22344704, 22345728, 22346752, 22347776, 22348800, 22349824, 22350848, 22351872, 22352896, 22353920, 22354944, 22355968, 22356992, 22358016, 22359040, 22360064, 22361088, 22362112, 22363136, 22364160, 0, 0, 0, 0, 22414336, 22415360, 22416384, 22417408, 22418432, 22419456, 22420480, 22421504, 22422528, 22423552, 22424576, 22425600, 22426624, 22427648, 22428672, 22429696, 22430720, 22431744, 22432768, 22433792, 22434816, 22435840, 22436864, 22437888, 22438912, 22439936, 22440960, 22441984, 22443008, 22444032, 22445056, 22446080, 22447104, 22448128, 22449152, 22450176, 22451200, 22452224, 22453248, 22454272, 22455296, 22456320, 22457344, 22458368, 22459392, 22460416, 22461440, 22462464, 22463488, 22464512, 22465536, 22466560, 22467584, 22468608, 22469632, 22470656, 22471680, 22472704, 22473728, 22474752, 22475776, 22476800, 22477824, 22478848, 22479872, 22480896, 22481920, 22482944, 22483968, 22484992, 22486016, 22487040, 22488064, 22489088, 22490112, 22491136, 22492160, 22493184, 22494208, 22495232, 22496256, 22497280, 22498304, 22499328, 22500352, 22501376, 22502400, 22503424, 22504448, 22505472, 22506496, 22507520, 22508544, 22509568, 22510592, 22511616, 22512640, 22513664, 0, 0, 0, 0]
See those groups of 0's. Its these that get added to the sectors at
https://gitlab.cern.ch/lhcb/LHCb/blob/master/UT/UTDAQ/src/component/UTReadoutTool.cpp#L364
which then causes the issues.
So I guess the questions to the UT people (who are ??) are
- Why are these 0's in the DB conditions ? should they be removed ?
- Should the
aBoard->addSector
calls be skipped for these zero entries ?
Edited by Christopher Rob Jones