Hi Folks,
I encountered a strange problem with EPICS 7.0.8 under Ubuntu 22.04 on x86_64. My IOC crashes when loading ADBase.template:
>dbLoadRecords("/home/srsi2d/EPICS/EPICS-7.0.8/modules/src/areaDetector/ADCore/db/ADBase.template", "P=WIZZLERHD:HZDR:,R=asicam3:,PORT=ASICAM3,ADDR=0,TIMEOUT=1")
>epicsMutex pthread_mutex_unlock epicsMutexOsdUnlock failed: ERROR Operation not permitted
>epicsMutex pthread_mutex_unlock epicsMutexOsdUnlock failed: ERROR Operation not permitted
>*** buffer overflow detected ***: terminated
The gdb backtrace shows the following:
>#8 0x00007ffff7d0c9f9 in strcpy (__src=0x555555636cb0 "0", __dest=0x55555571a288 "")
> at /usr/include/x86_64-linux-gnu/bits/string_fortified.h:79
>#9 dbAllocRecord
> (pdbentry=pdbentry@entry=0x555555731348, precordName=precordName@entry=0x555555731288 "cam:SetAcquireBusy") at ../dbStatic/dbStaticRun.c:125
>#10 0x00007ffff7d00d13 in dbCreateRecord
> (pdbentry=pdbentry@entry=0x555555731348, precordName=precordName@entry=0x555555731288 "cam:SetAcquireBusy") at ../dbStatic/dbStaticLib.c:1441
>#11 0x00007ffff7d07e67 in dbRecordHead
> (visible=0, name=0x555555731288 "cam:SetAcquireBusy", recordType=0x5555557312e8 "calcout")
> at ../dbStatic/dbLexRoutines.c:1132
>#12 dbRecordHead
> (recordType=0x5555557312e8 "calcout", name=0x555555731288 "cam:SetAcquireBusy", visible=0)
> at ../dbStatic/dbLexRoutines.c:1099
If I comment out the calcout record it crashes at the next busy record. So it seems that my base installation has a problem, but why and what?
The ai, ao, bi, bo and stringin records seem to work fine. The calcout and busy records are defined in my apps dbd file.
Any idea what could be wrong?
Yes.
Ubuntu 22.04 bumped the "-D_FORTIFY_SOURCE" level to 3, which causes EPICS binaries to bail out because of an alleged "buffer overflow". The GCC detection engine is getting triggered by specific pointer casting in Base.
Testing this PR would help us verify this change as a quick way out. (Given the popularity of Ubuntu, this might justify a bugfix release of Base.)
Other than that, I have no striking idea how to avoid the issue.
Cheers,
~Ralph