ps gets SIGSEGV

ps gets SIGSEGV

Post by Jimmy Ba » Thu, 13 Mar 1997 04:00:00



Hello all,
  When I run the command

        ps -fax

on a Linux 2.0.29 box, I get a segmentatation fault.  I am unable to
duplicate this on other 2.0.X systems.  Unfortunately, the bug seems
somewhat random and only occurs with these combined options.

Using strace, I have determined that the majority of the time the sigsegv
occurs during the proc read phase and never gets to the write phase but
that is not always the case.

This probably is not life-threatening in and of itself but it could lend
to a bigger problem which is why I would like any input that you might
provide.

Thanks,
Jimmy Ball

 
 
 

ps gets SIGSEGV

Post by Jay Thorn » Sat, 15 Mar 1997 04:00:00



> Hello all,
>   When I run the command

>         ps -fax

> on a Linux 2.0.29 box, I get a segmentatation fault.  I am unable to
> duplicate this on other 2.0.X systems.  Unfortunately, the bug seems
> somewhat random and only occurs with these combined options.

You get that when the number of processes exceeds 64 or the number of
processes in a tree exceeds 16.  Its 2 separate off by one errors in the
ps 1.01 code.  I've submitted a fix but it has not appeared.  The only
response I got was: Most people don't use the "forest mode" (-f)

Email me if you want a patch file.

--

--

the Net Result System Services

 
 
 

ps gets SIGSEGV

Post by Matthew Wilc » Wed, 19 Mar 1997 04:00:00


: Hello all,
:   When I run the command

:       ps -fax

: on a Linux 2.0.29 box, I get a segmentatation fault.  I am unable to
: duplicate this on other 2.0.X systems.  Unfortunately, the bug seems

pp_w0221_chbs:~$ uname -a
Linux pp_w0221_chbs 2.0.29 #15 Fri Feb 21 11:50:35 MET 1997 i586
pp_w0221_chbs:~$ ps -fax
  PID TTY STAT  TIME COMMAND
...

Works fine for me.

--
It's only work if someone makes you do it.

Matthew Wilcox - reluctant comp.sys.acorn.programmer FAQ maintainer
Beta version available from ftp.barnet.ac.uk:/pub/Acorn/programm.FAQ
My email and news postings reflect someone's opinions.  Probably.

 
 
 

ps gets SIGSEGV

Post by Panu Matilain » Thu, 20 Mar 1997 04:00:00




>: Hello all,
>:   When I run the command

>:   ps -fax

>: on a Linux 2.0.29 box, I get a segmentatation fault.  I am unable to
>: duplicate this on other 2.0.X systems.  Unfortunately, the bug seems

Have you checked that you have the correct version of procutils?
Old top and ps with certain flags segfault on 2.0.

Panu

Quote:

>pp_w0221_chbs:~$ uname -a
>Linux pp_w0221_chbs 2.0.29 #15 Fri Feb 21 11:50:35 MET 1997 i586
>pp_w0221_chbs:~$ ps -fax
>  PID TTY STAT  TIME COMMAND
>...

>Works fine for me.

>--
>It's only work if someone makes you do it.

>Matthew Wilcox - reluctant comp.sys.acorn.programmer FAQ maintainer
>Beta version available from ftp.barnet.ac.uk:/pub/Acorn/programm.FAQ
>My email and news postings reflect someone's opinions.  Probably.

 
 
 

ps gets SIGSEGV

Post by Hank Leininge » Sun, 23 Mar 1997 04:00:00





> >:   When I run the command
> >:      ps -fax
> >:
> >: on a Linux 2.0.29 box, I get a segmentatation fault.  I am unable to
> >: duplicate this on other 2.0.X systems.  Unfortunately, the bug seems
> Have you checked that you have the correct version of procutils?
> Old top and ps with certain flags segfault on 2.0.
> >pp_w0221_chbs:~$ uname -a
> >Linux pp_w0221_chbs 2.0.29 #15 Fri Feb 21 11:50:35 MET 1997 i586
> >pp_w0221_chbs:~$ ps -fax
> >  PID TTY STAT  TIME COMMAND
> >...

> >Works fine for me.

Even with the "correct" version of procps (1.01) there is a bug in 'ps'
such that running ps with the -f flag when there are more than 64 processes
will seg fault.

Hm.  I cannot, however, remember where the patch lives.  So I've just
reinvented it.  Usual caveats apply, though.  Get the source for procps1.01
from: http://sunsite.unc.edu/pub/Linux/system/status/ps/procps-1.01.tgz

Change line 518 of ps.c from:
    if (nodes > maxnodes) {
to:
    if (nodes >= maxnodes) {

Recompile 'ps', and it should work.  I've confirmed this on my 2.0.29 box,
which currently has 100 processes running.  'ps -fax' seg faults before my
patch, not after.


Senior Systems Integrator
Progressive Computer Concepts, Inc
(800)580-2640

 
 
 

ps gets SIGSEGV

Post by Jay Thorn » Wed, 26 Mar 1997 04:00:00



> Change line 518 of ps.c from:
>     if (nodes > maxnodes) {
> to:
>     if (nodes >= maxnodes) {

> Recompile 'ps', and it should work.  I've confirmed this on my 2.0.29 box,
> which currently has 100 processes running.  'ps -fax' seg faults before my
> patch, not after.


                 node[parent].child = (int*)malloc(16 * sizeof(int*));
                 node[parent].maxchildren = 16;
             }
-            else if (node[parent].children == node[parent].maxchildren)
{
+            else if (node[parent].children >= node[parent].maxchildren)
{
                 node[parent].maxchildren *= 2;
                 node[parent].child = (int*)realloc(node[parent].child,

node[parent].maxchildren

--

the Net Result System Services