sh (pid 1081) segfaults for page address 00000000 at pc 00000000

walter harms wharms at bfs.de
Sun Jan 25 07:48:18 UTC 2009


does
if [ -z "$(pidof <process name>)" ]; then

change anything ?

re,
 wh

Cristian Ionescu-Idbohrn schrieb:
> This is: BusyBox v1.13.2, Linux 2.6.26 arch=crisv32
> 
> Have spent some time chasing this bug.
> I didn't find a simple way to reproduce, yet.
> 
> The bug occurs in a somewhat complex chain of forked processes. Seems
> 'pidof' is to blaim.  The shell code line:
> 
> 	if [ "$(pidof <process name>)" ]; then
> 
> That <process name> does not exist.
> 
> Changing that line to:
> 
> 	pid=$(pidof <process name>) || :
> 	if [ "$pid" ]; then
> 
> seems to work around the bug.  Still, that's not IMO a future safe
> solution.
> 
> After some tweaking with a SIGSEVG signal handler, I suspect a race in
> pidof between the point where readdir picks up pids under /proc/<pid> and
> the point where the /proc/<pid>/stat is read.  Some of those processes are
> dead.  Still, the linked list keeps some invalid data which, when used,
> might lead to overwritting the stack.  Not sure about that though.  Error
> handling may be missing/faulty.
> 
> Thoughts?
> 
> 
> Cheers,
> 


More information about the busybox mailing list