Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: Re: side-effect of malloc() in startup file
From: "Peregrine M. McGehee" <peregrine@lanl.gov>
To: tech-talk@aps.anl.gov
Date: Tue, 30 Jul 2002 11:24:09 -0600
The vxWorks tShell crashes after calls to both malloc() and
iocInit within a st.cmd have been traced to the drvTS.c TSinit() 
routine that is called within iocInit. The environment is 
Power PC; VxWorks 5.4; EPICS R3.13.5 and requires definition
of local synchronized timestamp support routines
(http://www.aps.anl.gov/asd/controls/hideos/GTS.html).

This is a consequence of insufficient (none!) range checking for 
access within the TSdata.event_table array of struct timespec
allocated in TSinit(). The quick patch is to always have an
ErSyncEvent() function that returns an event number less than
the return value of ErHaveReceiver() when supplying local 
timestamp support. The harder correction is to rewrite drvTS!

Specifically:
IF
o ErHaveReceiver() is defined and returns a non-zero number of events
(TSdata.total_events).
AND IF
o The sync event number (TSdata.sync_event) exceeds TSdata.total_events 
THEN
possible corruption of vxWorks data structures (in our case we suspect 
the Task Control Block) may occur.

Note that the TSdata.sync_event is defined by ErSyncEvent() if it exists,
otherwise defaults to ER_EVENT_RESET_TICK = 0x7d (a large number!).

This occurs for both Master Timing IOCS (as a result of TSstampServer)
and Slave IOCs (as a result of the TSsyncClient).

- Peregrine
-- 
Peregrine M. McGehee	peregrine@lanl.gov	(505) 667-3273
Sloan Digital Sky Survey / Spallation Neutron Source
MS H820, Los Alamos National Laboratory, Los Alamos, NM 87545

Replies:
Re: side-effect of malloc() in startup file Korhonen Timo
References:
side-effect of malloc() in startup file Peregrine M. McGehee

Navigate by Date:
Prev: Re: How do I use registryFunctionAdd Marty Kraimer
Next: Re: side-effect of malloc() in startup file Korhonen Timo
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
Navigate by Thread:
Prev: side-effect of malloc() in startup file Peregrine M. McGehee
Next: Re: side-effect of malloc() in startup file Korhonen Timo
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·