Commit Graph
1815 Commits
Author SHA1 Message Date
Jeremy Lorelli c19b832a6b libcom: Update doc comment for cantProceed 2026-10-14 15:45:57 +02:00
Jeremy Lorelli 7f87a839f9 libcom: Make EPICS_ABORT_ON_ASSERT affect cantProceed
EPICS_ABORT_ON_ASSERT was introduced to kill the entire IOC instead of
suspending an individual thread on assert failure. This behavior,
however, was not implemented for cantProceed, which left most of the
epicsMustBlah APIs with the suspention behavior (except for a couple
APIs that called assert() instead).
2026-10-14 15:45:57 +02:00
Jeremy Lorelli 9e4b366ee8 libcom: Switch epicsMutexMustLock() to cantProceed() 2026-10-14 15:45:57 +02:00
Jeremy Lorelli c50b7e4a0b libcom: Switch epicsThreadMustCreate to cantProceed() 2026-10-14 15:45:56 +02:00
zimoch 3a5e12786d Add search path for epics-gdb-helper.py to assembler options
Gcc before version 4.7 does not pass -I options to the assembler automatically.
2026-10-14 15:45:56 +02:00
Michael Davidsaver 4e7296287f rsrv: special case PUT with callback with scalar string
When dataType==DBR_STRING && count==1, libca may optimize
by sending less than 40 bytes.
Re-arrange write_notify_action() so that this case can
copy directly into the put notify buffer.

Factor out write_notify_cancel() to make clear that the
current message header / pBuffer are not used.

Also, call out magic 60 second timeout.
2026-10-14 15:45:56 +02:00
Michael Davidsaver 8c66842969 rsrv: special case PUT with scalar string
When dataType==DBR_STRING && count==1, libca may optimize
by sending less than 40 bytes.
Add a special scratch buffer for this case so that downstream
code can continue to assume MAX_STRING_SIZE.
2026-10-14 15:45:56 +02:00
Michael Davidsaver 620c07c1b5 dbPut/dbPutField check nRequest 2026-10-14 15:45:55 +02:00
Michael Davidsaver b46b1b0860 rsrv: remove pPayload for debug logging
Unused since 33f4d15ff3.
Now make clear that this is so.
2026-10-14 15:45:38 +02:00
Andrew Johnson d407821054 Silence Repeater announcement in non-debug mode 2026-10-14 15:13:14 +02:00
Michael Davidsaver 85a5bc61e4 dbCaLinkTest: test dbr_size_n 2026-10-14 15:13:14 +02:00
Michael Davidsaver cb75bf73c7 doc 2026-10-14 15:12:24 +02:00
Ralph Lange 5af37ca3d4 db: fix dbChannel_put() for DBR_TIME_STRING
DBR_TIME is the option mask 0x10 from dbAccessDefs.h, not a field data type
2026-10-14 15:12:10 +02:00
Brendan Chandler 5c3dba706f Configure Static IP with RTEMS libbsd (#853)
* Add RTEMS libbsd static network config for motload nvram

setBootConfigFromNVRAM() now configures static networking via the
libbsd rtems_bsd_ifconfig() API when building against RTEMS with
libbsd.  It only uses static networking if it can find a configured IP
and netmask from GEV or the mot script boot parameters, otherwise it
falls back to DHCP.

Also note, NTP was part of setBootConfigFromNVRAM() when using legacy
RTEMS networking, but is handled outside this function for LibBSD.  To
preserve the legacy behavior, setBootConfigFromNVRAM() still pulls out
NTP server info, but now stores it in an output parameter for outside
code to use.

* Wait for link to come up when starting RTEMS/libbsd/static IP

When configuring a static IP on RTEMS/libbsd, we need to intentionally
wait for the link to come up before continuing to configure ntp, etc.

* Separate common network setup from BSP specific implementations

All the BSP setBootConfigFromNVRAM() functions ultimately configured
the RTEMS networking the same way.  The common networking code
has been pulled out into a separate function now called from BSP specific
code.

All networking setup is now included and optionally used only
when the BSP sets the field appropriately.

This lets the setBootConfigFromNVRAM functions be independent of the
network stack, just focussing on collecting the configuration from each
BSP as appropriate.

* Fix unused function warnings for functions unused on certain BSPs

* Remove old comments about if MY_BOOTP

* Added release note entry

-- 
Co-authored-by: Brendan Chandler <bchandler@anl.gov>
2026-10-14 15:12:09 +02:00
Michael Davidsaver bc40b6155b db: dbPutNotifyBlocker type check 2026-10-14 15:12:09 +02:00
Sang Woo Kim bff771ac60 RTEMS-posix: free the epicsEventOSD in epicsEventDestroy()
epicsEventCreate() mallocs the wrapper but epicsEventDestroy() only
destroys the embedded rtems_binary_semaphore, leaking one heap block
per event lifecycle on every RTEMS >= 5 build.
2026-10-14 15:12:08 +02:00
Michael Davidsaver c867a6b9cb rsrv: log_header don't log string specially
payload may not be null terminated
2026-10-14 15:12:08 +02:00
Michael Davidsaver d06647836f rsrv: cross-check m_count message field with payload buffer length
Bounds check m_count / element count against dbChannel.

For write_notify_action only.
Bounds check DBR data size against received payload buffer length

For write_action, add pre-test with dbr_size_n() before caNetConvert()
2026-10-14 15:12:08 +02:00
Michael Davidsaver b2fde23f53 rsrv: clarify bucketID locking
Make clear that bucketID is guarded by clientQlock
2026-10-14 15:12:07 +02:00
Michael Davidsaver 187b9b961c rsrv: prevent use of CID between clients
In this context "CID" means Channel ID,
in this case meaning the server assigned identifier.
While in other contexts this is called SID (Server ID),
to distinguish from the Client ID (also CID :( )
2026-10-14 15:12:07 +02:00
Michael Davidsaver 2ae6e4f85a rsrv: catch overflow of extended message size
Treat as corruption, and ignore/close
2026-10-14 15:12:07 +02:00
Michael Davidsaver 3cd526411f rsrv: old TCP client tar pit
A short message could underflow, leaving a too old client stuck
in a tar pit.  An acceptable outcome, but not intended.
Instead, send back errors to each message.
2026-10-14 15:12:06 +02:00
Jacqueline GarrahanandClaude Opus 4.8 a0bfa01cf5 dbStaticLib: fix dbGetStringNum reading UINT64 through a 32-bit pointer
The DBF_UINT64 case dereferenced the 8-byte field as *(epicsUInt32 *),
reading only its low 32 bits, so large UINT64 values printed wrong
(e.g. 0x1_0000_0000 as "0") and save/restore round-tripping broke.  Cast
to epicsUInt64*, matching the adjacent DBF_INT64 case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-14 15:11:30 +02:00
Andrew Johnson 4886eaade8 Add better tests of the ResetHighWaterMark API 2026-10-14 11:25:44 +02:00
Jacqueline GarrahanandClaude Opus 4.8 a5eddfcd63 epicsRingBytes: fix reversed operands in ResetHighWaterMark
The used-bytes count is nextPut - nextGet everywhere else in this file
(epicsRingBytesPut, epicsRingBytesUsedBytes), but
epicsRingBytesResetHighWaterMark computed nextGet - nextPut.  For a ring
holding u bytes it therefore stored size-u; since Put only raises the
mark, the high-water mark stayed permanently inflated and wrong.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-14 11:24:59 +02:00
Jacqueline GarrahanandClaude Opus 4.8 547be3c935 histogramRecord: fix heap OOB write when SGNL approaches ULIM
The bin-search loop in add_count() assumes nelm*wdth == ulim-llim, but
wdth is a rounded quotient so nelm*wdth can be strictly less than
ulim-llim.  A SGNL value just below ULIM then leaves the loop with
i == nelm+1, and pdest = bptr + nelm writes one epicsUInt32 past the
nelm-element buffer.  This is reachable over Channel Access by putting a
value near ULIM to the SGNL field (special SPC_MOD).  Clamp the index to
nelm.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-14 11:24:38 +02:00
Sang Woo Kim 5a225a9bbb rsrv: reject a non-finite beacon period
The beacon-period gate in online_notify already rejected a parse
failure and a non-positive value, but epicsScanDouble parses "nan" and
"inf", and maxPeriod<=0.0 is false for both, so a non-finite period
reached the beacon delay loop. A NaN maxdelay makes delay<maxdelay
false forever, pinning the beacon interval at the 0.02 s startup value
- a ~50 Hz beacon flood on every configured interface; an infinite
maxdelay lets the doubling delay grow without bound, silencing beacons
entirely.

Gate on finite() (from epicsMath.h), matching the client-side
EPICS_CA_MAX_SEARCH_PERIOD handling in udpiiu.cpp, and name the actual
problem in the diagnostic instead of "float fetch failed" (the message
already covered the non-positive case, which is not a fetch failure).
2026-10-14 11:21:36 +02:00
Sang Woo Kim f373f04396 calcRecord: drop unhandled special(SPC_MOD) from INPM..INPU
INPM..INPU each declared special(SPC_MOD), but calcRecord's special()
only implements SPC_CALC and returns S_db_badChoice for anything else.
Every dbPutField/caput to one of those nine link fields therefore ran
special(after=TRUE), hit the fall-through, and failed with
S_db_badChoice ("bad special value") -- nine documented input links
were unwritable at run time.

The twelve sibling links INPA..INPL carry no special and accept writes,
and calcRecord (unlike calcoutRecord) does no run-time link
re-initialization, so there is no handler for SPC_MOD to reach. Remove
the erroneous attribute from the nine fields so they match INPA..INPL;
special() then runs only for CALC, which is the only field that still
carries a special.
2026-10-14 11:20:53 +02:00
Sang Woo Kim bd20c712f3 udpiiu: reject a non-finite or non-positive EPICS_CA_MAX_SEARCH_PERIOD
epicsScanDouble accepts "inf" and "nan", so envGetDoubleConfigParam
returns success for them and the parsed value flows into getMaxPeriod's
only range gate, maxPeriod < maxSearchPeriodLowerLimit. That comparison
is false for both inf and NaN, so a non-finite period reaches
getNTimers(), whose static_cast<unsigned> of 1 + log(maxPeriod/...)/log2
is an undefined float->unsigned conversion: inf aborts the client in
malloc via a garbage nTimers allocation, and NaN drives the search-timer
wheel off a NaN period where every deadline comparison is false.

Gate the parsed value on finite() (from epicsMath.h) and positivity
alongside the parse status, and fall back to the default period. A
non-positive period is not a "low" period to be clamped up to the 60 s
lower limit; it takes the same invalid-input path as inf/NaN.

getMaxPeriod() is getNTimers()'s only caller, so this makes the
conversion finite and positive by construction.
2026-10-14 11:20:25 +02:00
Sang Woo Kim 42db938a94 cac: reject a non-positive or non-finite EPICS_CA_CONN_TMO
A successful parse of EPICS_CA_CONN_TMO stored the value into connTMO
unchecked, so EPICS_CA_CONN_TMO=-5 or =0 left the connection-verify
watchdog deadline permanently in the past. The watchdog then fires
continuously, flooding stderr with "Virtual circuit unresponsive" and
pinning a CPU while updates still arrive. NaN and inf (which
epicsScanDouble also accepts) slip past any ordering comparison: a NaN
period leaves the watchdog deadline arithmetic undefined, and an
infinite period silently disables circuit verification.

Fold the validity check into the existing parse-failure branch, so an
unparsable, non-finite, or non-positive value takes the same path:
warn once and fall back to the 30 s CA_CONN_VERIFY_PERIOD default.
This mirrors the sibling EPICS_CA_MAX_ARRAY_BYTES handling a few lines
below, which already gates a parse failure and an out-of-range value
in one condition, and matches the finite() gate on
EPICS_CA_MAX_SEARCH_PERIOD in udpiiu.cpp.
2026-10-14 11:20:15 +02:00
Jacqueline GarrahanandClaude Opus 4.8 617a7902f2 printfRecord: fix one-byte VAL overflow in %ls conversion
In the long-string (%ls) branch dbGetLink(DBR_CHAR) / dbLoadLinkLS can
leave n at vspace+1, so pval[n] = 0 writes at pval[vspace+1], one byte
past the sizv-byte VAL buffer (pval + vspace + 1 == prec->val + sizv).
Clamp n to vspace immediately before writing the terminator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-14 11:19:59 +02:00
Michael Davidsaver b1d7bfb877 caget missing NULL check 2026-10-14 11:19:51 +02:00
Jacqueline GarrahanandClaude Opus 4.8 da3ee4fef6 iocsh: fix inverted parse test in 'on error wait <delay>'
epicsParseDouble returns 0 on success and non-zero on failure, but the
branches were swapped: a valid delay printed "Invalid 'on error wait'
delay" and the usage text, while an invalid delay was silently accepted
with timeout forced to 5.0.  Report the error on parse failure and accept
the value on success.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-14 11:19:42 +02:00
Jacqueline GarrahanandClaude Opus 4.8 f63c5e9d3b dbConvert: fix UInt64->String conversion truncating to 32 bits
putUInt64String used cvtUlongToString, which is cvtUInt32ToString, so the
64-bit source was narrowed to its low 32 bits (e.g. 0x1_0000_0007 printed
as "7").  Use cvtUInt64ToString, matching getUInt64String and every other
width-specific putXxxString.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-14 11:19:19 +02:00
Sang Woo Kim ee673d87ec seqRecord: fix upper display limit of the DLYn fields
get_graphic_double() assigns lower_disp_limit twice and never writes
upper_disp_limit, so a DBR_GR_DOUBLE read of any DLYn field reports
the inverted range lower=10, upper=0.  The second assignment was
evidently meant for the upper limit; the 0 in the upper slot is the
zeroed buffer dbAccess.c hands to the RSET, not a chosen value.

Both assignments date from commit 27e80be2e5 which introduced the
DLYn limits, so every release since 3.14.11 reports the inverted
range over both CA (DBR_GR/CTRL) and PVA (display.limitLow/High).

Extend seqTest with a DBR_GR_DOUBLE read of DLY0; the new cases
fail with lower=10, upper=0 before this fix.
2026-10-14 11:18:58 +02:00
Jacqueline GarrahanandClaude Opus 4.8 91aba2cb0a dbJLink: fix assignment-instead-of-compare in dbJLinkMapAll
The guard used recname[0] = '\0' (assignment) instead of == , which wrote
a NUL into the caller's string, truncating it to "", and evaluated to 0
so recname was left non-NULL pointing at "".  Every record then failed
the name comparison and nothing was mapped.  Use ==, matching dbjlr.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-14 11:18:33 +02:00
Sang Woo Kim 2ec624aad6 selRecord: fix the precision reported for the A-L and LA-LL fields
get_precision() walks pvalue and plvalue over the A-L and LA-LL fields,
then compares paddr->pfield against &pvalue and &plvalue -- the
addresses of the two local pointer variables, not of the fields they
point at.  Those are stack addresses, so neither test has ever matched
and every A-L or LA-LL precision request falls through to
recGblGetPrec().  The line just above gets it right: prec->val is a
field and needs the &, whereas pvalue and plvalue are already pointers.

Both tests date from e87551df24, the commit that added the loop, and
have been dead ever since, so every release since R3.12 has this.  They
carried a (void *) cast until 6d85a36397 removed it, which is why the
compiler was never shown a double ** to complain about.  That the
fields were meant to be covered is not in doubt: this record's
get_graphic_double() and get_control_double() both name A-L and LA-LL.

This changes what those fields report.  recGblGetPrec() substitutes 15
for a DOUBLE precision outside 0 to 15, so today A-L and LA-LL answer
15 for a PREC of 17 while VAL answers 17.  They now answer PREC
unclamped, which is what VAL has always done.

Add selTest, reading the precision of VAL, A, L, LA, LL and HIHI from a
record with PREC=17.  The four A-L and LA-LL cases report 15 before
this fix; VAL and HIHI pin the two paths either side of them.
2026-10-14 11:18:16 +02:00
Michael Davidsaver fe59acb15f rsrv: USE_TYPED_DBEVENT 2026-10-14 11:17:44 +02:00
Jacqueline GarrahanandClaude Opus 4.8 5107e2de49 errlog: fix out-of-bounds read when resizing the print buffer
errlogBufResize copied the print buffer from &pvt.print->base (the
address of the char* field inside the buffer_t struct) instead of
pvt.print->base (the buffer it points to), reading bufSize bytes from an
~8-byte struct field.  Drop the stray & so it reads the actual buffer,
matching the adjacent log-buffer copy.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-14 11:17:17 +02:00
Andrew Johnson 906abc98d7 Release notes, add a drvet to the example template 2026-10-14 11:17:11 +02:00
Andrew Johnson f73f888df8 Move -DUSE_TYPED_DRVET to USR_CPPFLAGS
Also fixes an issue in the generated registerRecordDeviceDriver code.
2026-10-14 11:17:01 +02:00
Érico Nogueira 5b29ce506e Fix UAF in caRepeaterThread
The ca_repeater function has some failure cases which can cause it to
return. In such a situation, a reference to the current thread's
epicsThreadId is kept in the taskwd, causing an eventual use-after-free
when the taskwd tries to determine the task's status.

We fix this problem by removing the thread from the taskwd if
ca_repeater ever returns.
2026-10-14 11:16:34 +02:00
Michael Davidsaver 2f460bdf26 rsrv: log_header paddr=
Currently prints dbChannel**
2026-10-14 11:16:22 +02:00
Michael Davidsaver c7e9310439 minor 2026-10-14 11:16:10 +02:00
Michael Davidsaver bb5b1b5c7b fix last LOCAL 2026-10-14 11:16:03 +02:00
Jeremy Lorelli 5b962a702b database: Replace epicsEventMustSignal -> epicsEventMustTrigger in comments 2026-10-14 11:15:56 +02:00
Michael Davidsaver 84c56e99b5 doc devSup.h 2026-10-14 11:15:36 +02:00
Michael Davidsaver 1dc953a672 Document dbScan.h 2026-10-14 11:15:24 +02:00
Michael Davidsaver 50c0fcc725 dbScan one more NUM_TIME_EVENTS 2026-10-14 11:15:03 +02:00
Michael Davidsaver 884e001f6e minor 2026-10-14 11:14:51 +02:00