EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: PCMON segmentation fault
From: Dirk Zimoch <[email protected]>
To: [email protected]
Date: Tue, 29 Apr 2014 10:08:31 +0200
Hello Nicoletta

I checked the code against our running version and found many differences, but not in the piece of code you mentioned.

However this line looks vulnerable: while(*p++ != '\n')
If for some reason, there is a line in /proc/meminfo that does not end in "\n", we are doomed (e.g. lines ending in "\n\r"). Also the buffer is only 1024 bytes large and any /proc/meminfo larger than this may result in an incomplete last line in the buffer not ending with "\n". Furthermore, the buffer is global and used in two functions. If for any reason these functions are called by different threads and preempt each other, strange things may end up in the buffer, also leading to incomplete lines. This may happen if the records for MemLoad and CpuLoad use different scan rates.

Maybe search the core file for the contents of the buf variable. Do you see incomplete lines?

How many bytes has /proc/meminfo?

Dirk


On 29.04.2014 09:40, Dirk Zimoch wrote:
Hi Nicoletta,

We are using this package all the time without problems. But I cannot
say at the moment if the version we are using is exactly the same as the
one on the download site. Maybe that one is old and not suitable for 64
bit. I have to check that. Also the developer of that software is not at
PSI any more.

To run outside a debugger, do this before running the ioc:
ulimit -c unlimited
The run the ioc, let it crash and do a post-mortem analysis with the
debugger and the core file created by the crash.

Dirk

On 28.04.2014 11:26, Nicoletta Petrella wrote:
Dear all,

I have downloaded the package PCMON from
http://epics.web.psi.ch/software/pcmon/, but If I try to run it I get a
segmentation fault while reading the memory status.

If I run the IOC inside the debugger I do not get any error and the
package works fine.

The problem apparently is in the devSysMon.c.

Reading the core file from the debugger I get:

Core was generated by `../../bin/linux-x86_64/pcMonitor st2.cmd'.
Program terminated with signal 11, Segmentation fault.
#0  meminfo () at ../devSysMon.c:437
437                    while(*p++ != '\n'); /* ignore lines we don't
understand */
Missing separate debuginfos, use: debuginfo-install
glibc-2.12-1.132.el6.x86_64 libgcc-4.4.7-4.el6.x86_64
libstdc++-4.4.7-4.el6.x86_64 ncurses-libs-5.7-3.20090208.el6.x86_64
readline-6.0-4.el6.x86_64
(gdb)

If I cut from the database all the records related to the Memory Status
which use the MEMLoad device, the package works fine.

Did anyone have the same problem? Would you know how to run the IOC
outside the debugger without getting a segmentation fault?

Thank you very much.
Kind regards,
Nicoletta




..... @@ ........
....@(';')@.......
..0==/--\==0....
....../___\........
......_| |_.........





References:
PCMON segmentation fault Nicoletta Petrella
Re: PCMON segmentation fault Dirk Zimoch

Navigate by Date:
Prev: Re: PCMON segmentation fault Dirk Zimoch
Next: RE: asyn vxi11 problem peter.owens
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: PCMON segmentation fault Dirk Zimoch
Next: Re: PCMON segmentation fault Nicoletta Petrella
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·