Subject: malloc writing to fd 2
To: None <tech-userlevel@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-userlevel
Date: 07/17/2003 22:44:58
I've just managed to persuade a program to output:

xyz in malloc(): warning: recursive call.
xyz: vasprintf(&scmd, "/sbin/umount /mnt2", ...: xyz in malloc(): warning: recursive call.
xyz in realloc(): warning: recursive call.
xyz in malloc(): warning: recursive call.
Cannot allocate memory

Now I can well believe I've persuaded the system to loop in malloc()
and possibly even run out of memory, however:

1) I don't think that malloc() (or any other part of libc for that matter)
   should be writing out error messages to fd 2.
   There is no requirement for that to be a log file of any description,
   (although it is useful to make it one).

2) The 'recursive call' check is actually (probably) caused by me typing
   ^C to interrupt the origial loop.
   The program calls exit() from within the signal handler (probably
   technically illegal) and has atexit() doing some tidying up...

Even if the code used longjump() to escape the signal handler, which is
supposed to be ok (isn't it?), then the malloc() code is still
well and trully stuffed - especially if THREAD_LOCK() is defined.

	David

-- 
David Laight: david@l8s.co.uk